示例#1
0
 /**
  * Returns a HashSet with the operations that have data element 'data' as output element.
  *
  * @param data PDMDataElement
  * @return HashSet
  */
 public HashSet getOperationsWithOutputElement(PDMDataElement data) {
   HashSet opso = new HashSet();
   Object[] ops = operations.values().toArray();
   for (int i = 0; i < ops.length; i++) {
     PDMOperation op = (PDMOperation) ops[i];
     HashMap outputs = op.getOutputElements();
     if (outputs.containsValue(data)) {
       opso.add(op);
     }
   }
   return opso;
 }
示例#2
0
 public boolean quicker() {
   HashMap<Integer, Integer> hs = new HashMap();
   for (int i = 0; i < a.length; i++) {
     hs.put(a[i], sum - a[i]);
   }
   Iterator<Integer> i = hs.keySet().iterator();
   while (i.hasNext()) {
     int tempKey = (int) i.next();
     int diff = sum - tempKey;
     if (hs.containsValue(new Integer(diff))) return true;
   }
   return false;
 }