Class NodeRelations
- java.lang.Object
-
- de.aristaflow.adept2.model.processmodel.tools.NodeRelations
-
public class NodeRelations extends Object
Class which allows for work on execution orders between nodes. FIXME must handle or join of and-or-blocks like and-joins(!) Requires: correct branch IDs, topological order.- Author:
- Kevin Goeser
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NodeRelations.NodeRelation
This represents the relation between two nodes.
-
Constructor Summary
Constructors Constructor Description NodeRelations(Template template)
Create a new NodeRelations object for the given template.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
atLeastOneIsExecutedBefore(HashSet<Integer> optionalPreds, int nodeID)
Returns true, if one of the predecessors is executed for sure.NodeRelations.NodeRelation
getNodeRelation(int nodeID1, int nodeID2)
Get the BEFORE relation between the given nodes, or what the relation is like, if node1 is not before node2.String
getStatsString()
Print stats.static boolean
isBefore(NodeRelations.NodeRelation nodeRelation)
protected static boolean
nodesAreOnDifferentBranchesOfSplit(Template template, int nodeID1, int nodeID2, int commonSplitNodeID)
Returns true, if the given nodes are on different branches relative to the given split node.
-
-
-
Field Detail
-
logger
protected final Logger logger
my logger
-
-
Constructor Detail
-
NodeRelations
public NodeRelations(Template template)
Create a new NodeRelations object for the given template.- Parameters:
template
-
-
-
Method Detail
-
getNodeRelation
public NodeRelations.NodeRelation getNodeRelation(int nodeID1, int nodeID2)
Get the BEFORE relation between the given nodes, or what the relation is like, if node1 is not before node2.- Parameters:
nodeID1
- The first node, preferably it is before node2.nodeID2
- The second node, preferable after node1.- Returns:
- The relation between node1 and node2.
- See Also:
NodeRelations(Template)
-
nodesAreOnDifferentBranchesOfSplit
protected static boolean nodesAreOnDifferentBranchesOfSplit(Template template, int nodeID1, int nodeID2, int commonSplitNodeID)
Returns true, if the given nodes are on different branches relative to the given split node.false: n1 n2 / \ / \ x ----- x ---x-----x--... / sn --- ... true: ... n1 / sn \ ... n2
FIXME this is just quick'n'dirty low-performance garbage code, rewrite- Parameters:
template
- TODOnodeID1
-nodeID2
-commonSplitNodeID
-- Returns:
-
isBefore
public static boolean isBefore(NodeRelations.NodeRelation nodeRelation)
-
getStatsString
public String getStatsString()
Print stats.
-
atLeastOneIsExecutedBefore
public boolean atLeastOneIsExecutedBefore(HashSet<Integer> optionalPreds, int nodeID)
Returns true, if one of the predecessors is executed for sure. TODO re-check if complete / partly re-code / optimize- Parameters:
optionalPreds
- Predecessors of node, which have an OPTIONAL before relation to node.nodeID
-- Returns:
-
-