Search in sources :

Example 1 with SetOfTwo

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;
}
Also used : EnergyTerm(org.vcell.util.graphlayout.energybased.EnergySum.EnergyTerm) SetOfTwo(org.sbpax.util.sets.SetOfTwo) ListOfTwo(org.vcell.sybil.util.lists.ListOfTwo) Node(org.vcell.util.graphlayout.ContainedGraph.Node) HashSet(java.util.HashSet)

Example 2 with SetOfTwo

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);
}
Also used : EnergyFunction(org.vcell.util.graphlayout.energybased.EnergySum.EnergyFunction) EnergyTerm(org.vcell.util.graphlayout.energybased.EnergySum.EnergyTerm) SetOfTwo(org.sbpax.util.sets.SetOfTwo)

Example 3 with SetOfTwo

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);
}
Also used : EnergyFunction(org.vcell.util.graphlayout.energybased.EnergySum.EnergyFunction) EnergyTerm(org.vcell.util.graphlayout.energybased.EnergySum.EnergyTerm) SetOfTwo(org.sbpax.util.sets.SetOfTwo)

Example 4 with SetOfTwo

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);
    }
}
Also used : SetOfTwo(org.sbpax.util.sets.SetOfTwo) SetOfThree(org.sbpax.util.sets.SetOfThree) Resource(org.openrdf.model.Resource) Value(org.openrdf.model.Value) URI(org.openrdf.model.URI)

Aggregations

SetOfTwo (org.sbpax.util.sets.SetOfTwo)4 EnergyTerm (org.vcell.util.graphlayout.energybased.EnergySum.EnergyTerm)3 EnergyFunction (org.vcell.util.graphlayout.energybased.EnergySum.EnergyFunction)2 HashSet (java.util.HashSet)1 Resource (org.openrdf.model.Resource)1 URI (org.openrdf.model.URI)1 Value (org.openrdf.model.Value)1 SetOfThree (org.sbpax.util.sets.SetOfThree)1 ListOfTwo (org.vcell.sybil.util.lists.ListOfTwo)1 Node (org.vcell.util.graphlayout.ContainedGraph.Node)1