Representation of a runtime instance of a mode.
More...
Inherits org.lflang.generator.NamedInstance< Mode >.
|
| boolean | contains (NamedInstance<?> instance) |
| | Returns true iff this mode contains the given instance.
|
| T | getDefinition () |
| | Return the definition, which is the AST node for this object.
|
| int | getDepth () |
| | Get the depth of the reactor instance.
|
| String | getFullName () |
| | Return the full name of this instance, which has the form "a.b.c", where "c" is the name of this instance, "b" is the name of its container, and "a" is the name of its container, stopping at the container in main.
|
| String | getFullNameWithJoiner (String joiner) |
| | Return a string of the form "a.b.c", where "." is replaced by the specified joiner, "c" is the name of this instance, "b" is the name of its container, and "a" is the name of its container, stopping at the container in main.
|
| ModeInstance | getMode (boolean direct) |
| | Returns the directly/indirectly enclosing mode.
|
| String | getName () |
| | Return the name of this mode.
|
| ReactorInstance | getParent () |
| | Return the parent or null if this is a top-level reactor.
|
| int | getWidth () |
| | Return the width of this instance, which in this base class is 1.
|
| boolean | hasParent (ReactorInstance container) |
| | Return true if this instance has the specified parent (possibly indirectly, anywhere up the hierarchy).
|
| boolean | isInitial () |
| | Returns true iff this mode is the initial mode of this reactor instance.
|
| List< ReactorInstance > | parents () |
| | Return a list of all the parents starting with the root().
|
| ReactorInstance | root () |
| void | setupTranstions () |
| | Sets up all transitions that leave this mode.
|
| void | setWidth (int width) |
| | Set the width.
|
| String | toString () |
| | Return a descriptive string.
|
| String | uniqueID () |
| | Return an identifier for this instance, which has the form "a_b_c" or "a_b_c_n", where "c" is the name of this instance, "b" is the name of its container, and "a" is the name of its container, stopping at the container in main.
|
|
| int | depth |
| | The depth in the hierarchy of this instance.
|
|
| T | definition |
| | The Instantiation AST object from which this was created.
|
| ReactorInstance | parent |
| | The reactor instance that creates this instance.
|
| HashMap< String, Integer > | uniqueIDCount |
| | Map from a name of the form a_b_c to the number of unique IDs with that prefix that have been already assigned.
|
| int | width |
| | The width of this instance.
|
Representation of a runtime instance of a mode.
- Author
- Alexander Schulz-Rosengarten
◆ ModeInstance()
Create a new reaction instance from the specified definition within the specified parent.
This constructor should be called only by the ReactorInstance class after all other contents (reactions, etc.) are registered because this constructor call will look them up.
- Parameters
-
| definition | A mode definition. |
| parent | The parent reactor instance, which cannot be null. |
◆ contains()
| boolean org.lflang.generator.ModeInstance.contains |
( |
NamedInstance<?> | instance | ) |
|
Returns true iff this mode contains the given instance.
◆ getDefinition()
Return the definition, which is the AST node for this object.
◆ getDepth()
Get the depth of the reactor instance.
This is 0 for the main reactor, 1 for reactors immediately contained therein, etc.
◆ getFullName()
Return the full name of this instance, which has the form "a.b.c", where "c" is the name of this instance, "b" is the name of its container, and "a" is the name of its container, stopping at the container in main.
If any reactor in the hierarchy is in a bank of reactors then, it will appear as a[index]. Similarly, if c is a port in a multiport, it will appear as c[index].
- Returns
- The full name of this instance.
◆ getFullNameWithJoiner()
Return a string of the form "a.b.c", where "." is replaced by the specified joiner, "c" is the name of this instance, "b" is the name of its container, and "a" is the name of its container, stopping at the container in main.
- Returns
- A string representing this instance.
◆ getMode()
Returns the directly/indirectly enclosing mode.
- Parameters
-
| direct | flag whether to check only for direct enclosing mode or also consider modes of parent reactor instances. |
- Returns
- The mode, if any, null otherwise.
◆ getName()
| String org.lflang.generator.ModeInstance.getName |
( |
| ) |
|
Return the name of this mode.
- Returns
- The name of this mode.
◆ getParent()
Return the parent or null if this is a top-level reactor.
◆ getWidth()
Return the width of this instance, which in this base class is 1.
Subclasses PortInstance and ReactorInstance change this to the multiport and bank widths respectively.
◆ hasParent()
Return true if this instance has the specified parent (possibly indirectly, anywhere up the hierarchy).
◆ isInitial()
| boolean org.lflang.generator.ModeInstance.isInitial |
( |
| ) |
|
Returns true iff this mode is the initial mode of this reactor instance.
◆ parents()
Return a list of all the parents starting with the root().
◆ root()
◆ setupTranstions()
| void org.lflang.generator.ModeInstance.setupTranstions |
( |
| ) |
|
Sets up all transitions that leave this mode.
Requires that all mode instances and other contents (reactions, etc.) of the parent reactor are created.
◆ setWidth()
Set the width.
This method is here for testing only and should not be used for any other purpose.
- Parameters
-
◆ toString()
| String org.lflang.generator.ModeInstance.toString |
( |
| ) |
|
Return a descriptive string.
◆ uniqueID()
Return an identifier for this instance, which has the form "a_b_c" or "a_b_c_n", where "c" is the name of this instance, "b" is the name of its container, and "a" is the name of its container, stopping at the container in main.
All names are converted to lower case. The suffix n is usually omitted, but it is possible to get name collisions using the above scheme, in which case _n will be an increasing integer until there is no collision. If the length of the root of the name as calculated above (the root is without the _n suffix) is longer than the static variable identifierLengthLimit, then the name will be truncated. The returned name will be the tail of the name calculated above with the prefix ''.
- Returns
- An identifier for this instance that is guaranteed to be unique within the top-level parent.
◆ actions
The action instances belonging to this mode instance.
◆ definition
The Instantiation AST object from which this was created.
◆ depth
The depth in the hierarchy of this instance.
This is 0 for main or federated, 1 for the reactors immediately contained, etc.
◆ identifierLengthLimit
A limit on the number of characters returned by uniqueID.
◆ instantiations
The reactor instances belonging to this mode instance, in order of declaration.
◆ parent
The reactor instance that creates this instance.
◆ reactions
List of reaction instances for this reactor instance.
◆ timers
The timer instances belonging to this reactor instance.
◆ transitions
The outgoing transitions of this mode.
◆ uniqueIDCount
Map from a name of the form a_b_c to the number of unique IDs with that prefix that have been already assigned.
If none have been assigned, then there is no entry in this map. This map should be non-null only for the main reactor (the top level).
◆ width
The width of this instance.
This is 1 for everything except a PortInstance representing a multiport and a ReactorInstance representing a bank.
The documentation for this class was generated from the following file:
- /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/generator/ModeInstance.java