Class TDLActionsGraph


  • public class TDLActionsGraph
    extends java.lang.Object
    A representation of the schedule of all actions in a TDL module in a graph. Nodes in this graph describe TDLActions (@see #TDLAction), edges describe the causal dependencies between those actions. The weight of nodes are the TDLAction objects, the weight of edges are the time that passes between two actions.
    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Patricia Derler
    • Constructor Summary

      Constructors 
      Constructor Description
      TDLActionsGraph​(TDLModule module, FSMActor controller)
      Create a new TDLActionsGraph for a TDL module.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void buildGraph​(State startmode)
      Build the graph by iterating through all the modes of the TDL module.
      java.util.List<Node> getEventsFollowingAction​(Node node)
      Returns all forward reachable nodes in the graph that are connected to the given node.
      java.util.HashMap<Node,​java.util.List<TDLAction>> getNextJoinNodes​(Node justExecuted, Node node, java.util.List<Node> visited)
      Recursively compute the set of nodes reachable from a given node that depend on more than one node or are scheduled to happen at a future time.
      Node getNode​(java.lang.Object actor, Time lower, Time upper)
      Get a node which executes a given actor.
      Node getNode​(Time invocationTime, java.lang.Object actor)
      Return the node that is used for the execution of an actor at a certain time.
      Node getNode​(TDLAction action)
      Get node for a given TDLAction.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TDLActionsGraph

        public TDLActionsGraph​(TDLModule module,
                               FSMActor controller)
        Create a new TDLActionsGraph for a TDL module.
        Parameters:
        module - The TDL module.
        controller - The controller of the TDL module.
    • Method Detail

      • buildGraph

        public void buildGraph​(State startmode)
                        throws IllegalActionException
        Build the graph by iterating through all the modes of the TDL module. Create nodes for transitions, TDL tasks and actuators and connect them.
        Parameters:
        startmode - This is the initial mode of the TDL module.
        Throws:
        IllegalActionException - Thrown if TDL parameters in the module cannot be read.
      • getEventsFollowingAction

        public java.util.List<Node> getEventsFollowingAction​(Node node)
        Returns all forward reachable nodes in the graph that are connected to the given node. Those forward reachable nodes do not depend on other nodes and the actions defined in the nodes are scheduled to happen at the same time as the action in the given node.
        Parameters:
        node - Given node.
        Returns:
        List of nodes that are forward reachable from the given node.
      • getNextJoinNodes

        public java.util.HashMap<Node,​java.util.List<TDLAction>> getNextJoinNodes​(Node justExecuted,
                                                                                        Node node,
                                                                                        java.util.List<Node> visited)
        Recursively compute the set of nodes reachable from a given node that depend on more than one node or are scheduled to happen at a future time. Examples for the latter are nodes describing the writing of an output port
        Parameters:
        justExecuted - Node that was just executed.
        node - Node from which the reachable Nodes are computed.
        visited - Already visited nodes, used to avoid loops.
        Returns:
        Set of reachable nodes that depend on more than one input port or contain actions that should happen later than the given node.
      • getNode

        public Node getNode​(Time invocationTime,
                            java.lang.Object actor)
        Return the node that is used for the execution of an actor at a certain time.
        Parameters:
        invocationTime - Time the actor is being invoked.
        actor - Actor that is scheduled for that time.
        Returns:
        The node that is used for the execution of an actor at a certain time.
      • getNode

        public Node getNode​(TDLAction action)
        Get node for a given TDLAction.
        Parameters:
        action - Given TDLAction.
        Returns:
        Node for the given TDLAction.
      • getNode

        public Node getNode​(java.lang.Object actor,
                            Time lower,
                            Time upper)
        Get a node which executes a given actor. This output port is written in a certain time frame defined by the two parameters lower and upper.
        Parameters:
        actor - Actor that is executed.
        lower - Lower time bound.
        upper - Upper time bound.
        Returns:
        The node used to execute the actor.