Class 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.
    • 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 - TODO
        nodeID1 -
        nodeID2 -
        commonSplitNodeID -
        Returns:
      • getStatsString

        public String getStatsString()
        Print stats.
      • atLeastOneIsExecutedBefore

        public boolean atLeastOneIsExecutedBefore​(Collection<Integer> optionalPreds,
                                                  int nodeID)
        Determines that at least one of the designated preceding nodes is really executed before the designated reading node. The designated preceding nodes may be in an alternative branch and thus only executed "optionally". The reason behind this is that the designated node reads a data element mandatorily which is written by the designated preceding nodes. So each execution path has to contain at least one of these preceding nodes to ensure the data element has been written.
        Parameters:
        optionalPreds - Predecessors of node, which have an OPTIONAL before relation to node and which write the data element.
        nodeID - ID of the node which reads the data element.
        Returns:
        Whether all execution paths to the designated reading nodes contains at least one of the designated preceding nodes.