![]() |
lingua-franca 0.10.1
Lingua Franca code generator
|
Base class for compile-time instances with names in Lingua Franca. More...
Public Member Functions | |
| 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. | |
| abstract String | getName () |
| Return the name of this instance as given in its definition. | |
| ReactorInstance | getParent () |
| Return the parent or null if this is a top-level reactor. | |
| ReactorInstance | getParent (int d) |
| Return the parent at the given depth or null if there is no parent at the given depth. | |
| 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). | |
| List< ReactorInstance > | parents () |
| Return a list of all the parents starting with the root(). | |
| ReactorInstance | root () |
| Return the root reactor, which is the top-level parent. | |
| void | setWidth (int width) |
| Set the width. | |
| 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. | |
Static Public Attributes | |
| static int | identifierLengthLimit = 40 |
| A limit on the number of characters returned by uniqueID. | |
Protected Member Functions | |
| NamedInstance (T definition, ReactorInstance parent) | |
| Construct a new instance with the specified definition and parent. | |
Protected Attributes | |
| int | depth = 0 |
| The depth in the hierarchy of this instance. | |
Package Attributes | |
| 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 = 1 |
| The width of this instance. | |
Base class for compile-time instances with names in Lingua Franca.
An instance of concrete subclasses of this class represents one or more runtime instances of a reactor, port, reaction, etc. There will be more than one runtime instance if the object or any of its parents is a bank of reactors.
|
protected |
Construct a new instance with the specified definition and parent.
E.g., for a reactor instance, the definition is Instantiation, and for a port instance, it is Port. These are nodes in the AST. This is protected because only subclasses should be constructed.
| definition | The definition in the AST for this instance. |
| parent | The reactor instance that creates this instance. |
| T org.lflang.generator.NamedInstance< T extends EObject >.getDefinition | ( | ) |
Return the definition, which is the AST node for this object.
| int org.lflang.generator.NamedInstance< T extends EObject >.getDepth | ( | ) |
Get the depth of the reactor instance.
This is 0 for the main reactor, 1 for reactors immediately contained therein, etc.
| String org.lflang.generator.NamedInstance< T extends EObject >.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].
| String org.lflang.generator.NamedInstance< T extends EObject >.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 org.lflang.generator.NamedInstance< T extends EObject >.getMode | ( | boolean | direct | ) |
Returns the directly/indirectly enclosing mode.
| direct | flag whether to check only for direct enclosing mode or also consider modes of parent reactor instances. |
|
abstract |
Return the name of this instance as given in its definition.
Note that this is unique only relative to other instances with the same parent.
| ReactorInstance org.lflang.generator.NamedInstance< T extends EObject >.getParent | ( | ) |
Return the parent or null if this is a top-level reactor.
| ReactorInstance org.lflang.generator.NamedInstance< T extends EObject >.getParent | ( | int | d | ) |
Return the parent at the given depth or null if there is no parent at the given depth.
| d | The depth. |
| int org.lflang.generator.NamedInstance< T extends EObject >.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.
| boolean org.lflang.generator.NamedInstance< T extends EObject >.hasParent | ( | ReactorInstance | container | ) |
Return true if this instance has the specified parent (possibly indirectly, anywhere up the hierarchy).
| List< ReactorInstance > org.lflang.generator.NamedInstance< T extends EObject >.parents | ( | ) |
Return a list of all the parents starting with the root().
| ReactorInstance org.lflang.generator.NamedInstance< T extends EObject >.root | ( | ) |
Return the root reactor, which is the top-level parent.
| void org.lflang.generator.NamedInstance< T extends EObject >.setWidth | ( | int | width | ) |
Set the width.
This method is here for testing only and should not be used for any other purpose.
| width | The new width. |
| String org.lflang.generator.NamedInstance< T extends EObject >.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 ''.
|
package |
The Instantiation AST object from which this was created.
|
protected |
The depth in the hierarchy of this instance.
This is 0 for main or federated, 1 for the reactors immediately contained, etc.
|
static |
A limit on the number of characters returned by uniqueID.
|
package |
The reactor instance that creates this instance.
|
package |
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).
|
package |
The width of this instance.
This is 1 for everything except a PortInstance representing a multiport and a ReactorInstance representing a bank.