lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.analyses.statespace.StateSpaceDiagram Class Reference

A directed graph representing the state space of an LF program. More...

Inherits org.lflang.graph.DirectedGraph< T >.

Public Member Functions

void addEdge (T sink, T source)
 Add a new directed edge to the graph.
void addEdges (T sink, List< T > sources)
 Add new directed edges to the graph.
void addNode (StateSpaceNode node)
 Before adding the node, assign it an index.
void addNode (T node)
 Add the given node to the graph.
void clear ()
DirectedGraph< T > copy ()
 Obtain a copy of this graph by creating an new instance and copying the adjacency maps.
void display ()
 Pretty print the diagram.
int edgeCount ()
 Return the number of directed edges in this graph.
CodeBuilder generateDot ()
 Generate a dot file from the state space diagram.
Set< T > getDownstreamAdjacentNodes (T node)
 Return all immediate downstream neighbors of a given node.
StateSpaceNode getDownstreamNode (StateSpaceNode node)
 Get the immediately downstream node.
Set< T > getUpstreamAdjacentNodes (T node)
 Return all immediate upstream neighbors of a given node.
boolean hasNode (T node)
 Return true if this graph has the given node in it.
Set< T > leafNodes ()
 Return the leaf nodes of this graph.
void merge (DirectedGraph< T > another)
 Merge another directed graph into this one.
int nodeCount ()
 Return the number of nodes in this graph.
Set< T > nodes ()
 Return an unmodifiable set of nodes in this graph.
void removeEdge (T sink, T source)
 Remove a directed edge from the graph.
void removeNode (T node)
 Remove the given node from the graph.
Set< T > rootNodes ()
 Return the root nodes of this graph.
String toDOT ()
 Return the DOT (GraphViz) representation of the graph.
String toString ()
 Return a textual list of the nodes.

Public Attributes

StateSpaceNode head
 The first node of the state space diagram.
StateSpaceNode loopNode
 The previously encountered node which the tail node goes back to, i.e.
StateSpaceNode loopNodeNext
 Store the state when the loop node is reached for the 2nd time.
long loopPeriod
 The logical time elapsed for each loop iteration.
StateSpaceNode tail
 The last node of the state space diagram.

Protected Member Functions

void graphChanged ()
 Mark the graph to have changed so that any cached analysis is refreshed accordingly.

Detailed Description

A directed graph representing the state space of an LF program.

Member Function Documentation

◆ addEdge()

void org.lflang.graph.DirectedGraph< T >.addEdge ( T sink,
T source )
inherited

Add a new directed edge to the graph.

The first argument is the downstream node, the second argument the upstream node. If either argument is null, do nothing.

Parameters
sinkThe downstream immediate neighbor.
sourceThe upstream immediate neighbor.

Implements org.lflang.graph.Graph< T >.

◆ addEdges()

void org.lflang.graph.DirectedGraph< T >.addEdges ( T sink,
List< T > sources )
inherited

Add new directed edges to the graph.

The first argument is the downstream node, the second argument a set of upstream nodes.

Parameters
sinkThe downstream immediate neighbor.
sourcesThe upstream immediate neighbors.

Implements org.lflang.graph.Graph< T >.

◆ addNode() [1/2]

void org.lflang.analyses.statespace.StateSpaceDiagram.addNode ( StateSpaceNode node)

Before adding the node, assign it an index.

◆ addNode() [2/2]

void org.lflang.graph.DirectedGraph< T >.addNode ( T node)
inherited

Add the given node to the graph.

Implements org.lflang.graph.Graph< T >.

◆ clear()

void org.lflang.graph.DirectedGraph< T >.clear ( )
inherited

◆ copy()

DirectedGraph< T > org.lflang.graph.DirectedGraph< T >.copy ( )
inherited

Obtain a copy of this graph by creating an new instance and copying the adjacency maps.

◆ display()

void org.lflang.analyses.statespace.StateSpaceDiagram.display ( )

Pretty print the diagram.

◆ edgeCount()

int org.lflang.graph.DirectedGraph< T >.edgeCount ( )
inherited

Return the number of directed edges in this graph.

Implements org.lflang.graph.Graph< T >.

◆ generateDot()

CodeBuilder org.lflang.analyses.statespace.StateSpaceDiagram.generateDot ( )

Generate a dot file from the state space diagram.

Returns
a CodeBuilder with the generated code

◆ getDownstreamAdjacentNodes()

Set< T > org.lflang.graph.DirectedGraph< T >.getDownstreamAdjacentNodes ( T node)
inherited

Return all immediate downstream neighbors of a given node.

Parameters
nodeThe node to report the immediate downstream neighbors of.

◆ getDownstreamNode()

StateSpaceNode org.lflang.analyses.statespace.StateSpaceDiagram.getDownstreamNode ( StateSpaceNode node)

Get the immediately downstream node.

◆ getUpstreamAdjacentNodes()

Set< T > org.lflang.graph.DirectedGraph< T >.getUpstreamAdjacentNodes ( T node)
inherited

Return all immediate upstream neighbors of a given node.

Parameters
nodeThe node to report the immediate upstream neighbors of.

◆ graphChanged()

void org.lflang.graph.DirectedGraph< T >.graphChanged ( )
protectedinherited

Mark the graph to have changed so that any cached analysis is refreshed accordingly.

Reimplemented in org.lflang.graph.PrecedenceGraph< T extends Object >.

◆ hasNode()

boolean org.lflang.graph.DirectedGraph< T >.hasNode ( T node)
inherited

Return true if this graph has the given node in it.

Parameters
nodeThe node to look for.

Implements org.lflang.graph.Graph< T >.

◆ leafNodes()

Set< T > org.lflang.graph.DirectedGraph< T >.leafNodes ( )
inherited

Return the leaf nodes of this graph.

Leaf nodes have no downstream neighbors.

◆ merge()

void org.lflang.graph.DirectedGraph< T >.merge ( DirectedGraph< T > another)
inherited

Merge another directed graph into this one.

Parameters
anotherThe graph to merge into this one.

◆ nodeCount()

int org.lflang.graph.DirectedGraph< T >.nodeCount ( )
inherited

Return the number of nodes in this graph.

Implements org.lflang.graph.Graph< T >.

◆ nodes()

Set< T > org.lflang.graph.DirectedGraph< T >.nodes ( )
inherited

Return an unmodifiable set of nodes in this graph.

Implements org.lflang.graph.Graph< T >.

◆ removeEdge()

void org.lflang.graph.DirectedGraph< T >.removeEdge ( T sink,
T source )
inherited

Remove a directed edge from the graph.

Parameters
sinkThe downstream immediate neighbor.
sourceThe upstream immediate neighbor.

Implements org.lflang.graph.Graph< T >.

◆ removeNode()

void org.lflang.graph.DirectedGraph< T >.removeNode ( T node)
inherited

Remove the given node from the graph.

This also eliminates any edges from upstream and to downstream neighbors of this node.

Parameters
nodeThe node to remove.

Implements org.lflang.graph.Graph< T >.

◆ rootNodes()

Set< T > org.lflang.graph.DirectedGraph< T >.rootNodes ( )
inherited

Return the root nodes of this graph.

Root nodes have no upstream neighbors.

◆ toDOT()

String org.lflang.graph.DirectedGraph< T >.toDOT ( )
inherited

Return the DOT (GraphViz) representation of the graph.

Implements org.lflang.graph.Graph< T >.

Reimplemented in org.lflang.generator.ReactionInstanceGraph.

◆ toString()

String org.lflang.graph.DirectedGraph< T >.toString ( )
inherited

Return a textual list of the nodes.

Member Data Documentation

◆ head

StateSpaceNode org.lflang.analyses.statespace.StateSpaceDiagram.head

The first node of the state space diagram.

◆ loopNode

StateSpaceNode org.lflang.analyses.statespace.StateSpaceDiagram.loopNode

The previously encountered node which the tail node goes back to, i.e.

the location where the back loop happens.

◆ loopNodeNext

StateSpaceNode org.lflang.analyses.statespace.StateSpaceDiagram.loopNodeNext

Store the state when the loop node is reached for the 2nd time.

This is used to calculate the elapsed logical time on the back loop edge.

◆ loopPeriod

long org.lflang.analyses.statespace.StateSpaceDiagram.loopPeriod

The logical time elapsed for each loop iteration.

◆ tail

StateSpaceNode org.lflang.analyses.statespace.StateSpaceDiagram.tail

The last node of the state space diagram.


The documentation for this class was generated from the following file:
  • /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/analyses/statespace/StateSpaceDiagram.java