use of org.vcell.util.graphlayout.energybased.EnergySum.EnergyTerm in project vcell by virtualcell.
the class AllNodePairsEnergyTermFactory method generateTerms.
public Set<EnergyTerm> generateTerms(ContainedGraph graph) {
Set<SetOfTwo<Node>> nodePairs = new HashSet<SetOfTwo<Node>>();
for (Node node1 : graph.getNodes()) {
for (Node node2 : graph.getNodes()) {
if (node1 != node2 && (acrossContainers || node1.getContainer() == node2.getContainer())) {
SetOfTwo<Node> nodePair = new SetOfTwo<Node>(node1, node2);
if (!nodePairs.contains(nodePair)) {
nodePairs.add(nodePair);
}
}
}
}
HashSet<EnergyTerm> terms = new HashSet<EnergyTerm>();
for (SetOfTwo<Node> nodePair : nodePairs) {
terms.add(new EnergyTerm.Default(new ListOfTwo<Node>(nodePair.getElement1(), nodePair.getElement2()), function));
}
return terms;
}
Aggregations