Exemplo n.º 1
0
 // ## operation getMatchedFunctionalGroup(LinkedList)
 public LinkedList getMatchedFunctionalGroup(LinkedList p_reactants) {
   // #[ operation getMatchedFunctionalGroup(LinkedList)
   LinkedList fgCollection = new LinkedList();
   boolean found = false;
   Iterator r_iter = p_reactants.iterator();
   while (r_iter.hasNext()) {
     found = false;
     Object o = r_iter.next();
     ChemGraph cg = null;
     if (o instanceof Species) cg = ((Species) r_iter.next()).getChemGraph();
     else cg = (ChemGraph) o;
     Iterator t_iter = reactantTree.iterator();
     while (t_iter.hasNext()) {
       HierarchyTree t = (HierarchyTree) t_iter.next();
       Stack s = t.findMatchedPath(cg);
       if (s != null && !s.isEmpty()) {
         found = true;
         fgCollection.add(s);
       }
     }
     if (!found) {
       // System.out.println("can't find matched path: " + cg.toString());
       // System.exit(0);
       return null;
     }
   }
   return fgCollection;
   // #]
 }
Exemplo n.º 2
0
 // ## operation getReactants()
 public Iterator getReactants() {
   // #[ operation getReactants()
   Iterator iter = reactants.iterator();
   return iter;
   // #]
 }