use of org.sbpax.util.sets.SetOfTwo 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;
}
use of org.sbpax.util.sets.SetOfTwo in project vcell by virtualcell.
the class ShootAndCutLayouter method createTermFactories.
public static Set<EnergyTerm.Factory> createTermFactories() {
EnergyFunction nodesRepulsion = new NailShapeEnergyFunction(REPULSION_RANGE, REPULSION_STRENGTH);
EnergyFunction edgesPull = new ParabularEnergyFunction(EDGE_SPRING_STRENGTH);
EnergyTerm.Factory nodesRepulsionFactory = new AllNodePairsEnergyTermFactory(nodesRepulsion, REPULSION_IS_ACROSS_CONTAINERS);
EnergyTerm.Factory edgesPullFactory = new AllEdgesEnergyTermFactory(edgesPull);
return new SetOfTwo<EnergyTerm.Factory>(nodesRepulsionFactory, edgesPullFactory);
}
use of org.sbpax.util.sets.SetOfTwo in project vcell by virtualcell.
the class WerewolfLayouter method createTermFactories.
public static Set<EnergyTerm.Factory> createTermFactories() {
EnergyFunction nodesRepulsion = new NailShapeEnergyFunction(REPULSION_RANGE, REPULSION_STRENGTH);
EnergyFunction edgesPull = new ParabularEnergyFunction(EDGE_SPRING_STRENGTH);
EnergyTerm.Factory nodesRepulsionFactory = new AllNodePairsEnergyTermFactory(nodesRepulsion, REPULSION_IS_ACROSS_CONTAINERS);
EnergyTerm.Factory edgesPullFactory = new AllEdgesEnergyTermFactory(edgesPull);
return new SetOfTwo<EnergyTerm.Factory>(nodesRepulsionFactory, edgesPullFactory);
}
use of org.sbpax.util.sets.SetOfTwo in project vcell by virtualcell.
the class OntologyInfo method resourcesFromStatement.
public static Set<Resource> resourcesFromStatement(Statement statement) {
Resource subject = statement.getSubject();
URI predicate = statement.getPredicate();
Value object = statement.getObject();
if (object instanceof Resource) {
return new SetOfThree<Resource>(subject, predicate, (Resource) object);
} else {
return new SetOfTwo<Resource>(subject, predicate);
}
}
Aggregations