leanifiedMolecules.add(currentGraph);
}
contextualMolecules = new HashSet<MaximumContextualMolecule>();
for (Iterator<Graph> iter = leanifiedMolecules.iterator(); iter
.hasNext();) {
Graph current = iter.next();
if (!isSubgrapgOfOther(current, leanifiedMolecules)) {
ContextualMoleculeImpl contextualMolecule = new ContextualMoleculeImpl();
contextualMolecule.addAll(current);
contextualMolecule.markFinalized();
contextualMolecules.add(contextualMolecule);
} else {
iter.remove();
}
}
}
Map<FunctionallyGroundedNode, FunctionallyGroundedNode> fgNodeMap = new HashMap<FunctionallyGroundedNode, FunctionallyGroundedNode>();
for (FunctionallyGroundedNode fgNode : refDec
.getFunctionallyGroundedNodes()) {
fgNodeMap.put(fgNode, fgNode);
}
fgNodeMap = FgNodeMerger.mergeFgNodes(fgNodeMap);
boolean nodeReplaced = false;
Set<TerminalMolecule> terminalMolecules = refDec.getTerminalMolecules();
//TODO iterate over molecules
for (Entry<FunctionallyGroundedNode, FunctionallyGroundedNode> entry : fgNodeMap
.entrySet()) {
FunctionallyGroundedNode orig = entry.getKey();
FunctionallyGroundedNode current = entry.getValue();
if (!current.equals(orig)) {
Set<MaximumContextualMolecule> newContextualModelcules = new HashSet<MaximumContextualMolecule>();
for (MaximumContextualMolecule maximumContextualMolecule : contextualMolecules) {
try {
ContextualMoleculeImpl replacement = new ContextualMoleculeImpl();
new GraphUtil<MaximumContextualMolecule>()