lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.generator.TriggerInstance< T extends Variable > Class Template Reference

Instance of a trigger (port, action, or timer). More...

Inherits org.lflang.generator.NamedInstance< T >.

Classes

class  BuiltinTriggerVariable
 This class allows to have BuiltinTriggers represented by a Variable type. More...

Public Member Functions

getDefinition ()
 Return the definition, which is the AST node for this object.
Set< ReactionInstancegetDependentReactions ()
 Return the reaction instances that are triggered or read by this trigger.
Set< ReactionInstancegetDependsOnReactions ()
 Return the reaction instances that may send data via this port or action.
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 trigger.
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 isReset ()
 Return true if this trigger is "startup".
boolean isShutdown ()
 Return true if this trigger is "shutdown".
boolean isStartup ()
 Return true if this trigger is "startup".
List< ReactorInstanceparents ()
 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
 A limit on the number of characters returned by uniqueID.

Protected Member Functions

 TriggerInstance (T definition, ReactorInstance parent)
 Construct a new instance with the specified definition and parent.

Protected Attributes

int depth
 The depth in the hierarchy of this instance.

Static Package Functions

static TriggerInstance< BuiltinTriggerVariablebuiltinTrigger (BuiltinTriggerRef trigger, ReactorInstance parent)
 Construct a new instance for a special builtin trigger.

Package Attributes

definition
 The Instantiation AST object from which this was created.
Set< ReactionInstancedependentReactions = new LinkedHashSet<>()
 Reaction instances that are triggered or read by this trigger.
Set< ReactionInstancedependsOnReactions = new LinkedHashSet<>()
 Reaction instances that may send data via this port or action.
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.

Detailed Description

Instance of a trigger (port, action, or timer).

Author
Marten Lohstroh
Edward A. Lee
Alexander Schulz-Rosengarten

Constructor & Destructor Documentation

◆ TriggerInstance()

org.lflang.generator.TriggerInstance< T extends Variable >.TriggerInstance ( T definition,
ReactorInstance parent )
protected

Construct a new instance with the specified definition and parent.

E.g., for a action instance, the definition is Action, and for a port instance, it is Port. These are nodes in the AST. This is protected because only subclasses should be constructed.

Parameters
definitionThe definition in the AST for this instance.
parentThe reactor instance that creates this instance.

Member Function Documentation

◆ builtinTrigger()

TriggerInstance< BuiltinTriggerVariable > org.lflang.generator.TriggerInstance< T extends Variable >.builtinTrigger ( BuiltinTriggerRef trigger,
ReactorInstance parent )
staticpackage

Construct a new instance for a special builtin trigger.

Parameters
triggerThe actual trigger definition.
parentThe reactor instance that creates this instance.

◆ getDefinition()

T org.lflang.generator.NamedInstance< T extends EObject >.getDefinition ( )
inherited

Return the definition, which is the AST node for this object.

◆ getDependentReactions()

Set< ReactionInstance > org.lflang.generator.TriggerInstance< T extends Variable >.getDependentReactions ( )

Return the reaction instances that are triggered or read by this trigger.

If this port is an output, then the reaction instances belong to the parent of the port's parent. If the port is an input, then the reaction instances belong to the port's parent.

◆ getDependsOnReactions()

Set< ReactionInstance > org.lflang.generator.TriggerInstance< T extends Variable >.getDependsOnReactions ( )

Return the reaction instances that may send data via this port or action.

If this is an input port, then the reaction instance belongs to parent of the port's parent. If it is an output port, the reaction instance belongs to the port's parent. If it is an action, then the reaction belongs to the same parent as that of this action.

◆ getDepth()

int org.lflang.generator.NamedInstance< T extends EObject >.getDepth ( )
inherited

Get the depth of the reactor instance.

This is 0 for the main reactor, 1 for reactors immediately contained therein, etc.

◆ getFullName()

String org.lflang.generator.NamedInstance< T extends EObject >.getFullName ( )
inherited

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()

String org.lflang.generator.NamedInstance< T extends EObject >.getFullNameWithJoiner ( String joiner)
inherited

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()

ModeInstance org.lflang.generator.NamedInstance< T extends EObject >.getMode ( boolean direct)
inherited

Returns the directly/indirectly enclosing mode.

Parameters
directflag 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.TriggerInstance< T extends Variable >.getName ( )

Return the name of this trigger.

Returns
The name of this trigger.

◆ getParent()

ReactorInstance org.lflang.generator.NamedInstance< T extends EObject >.getParent ( )
inherited

Return the parent or null if this is a top-level reactor.

◆ getWidth()

int org.lflang.generator.NamedInstance< T extends EObject >.getWidth ( )
inherited

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()

boolean org.lflang.generator.NamedInstance< T extends EObject >.hasParent ( ReactorInstance container)
inherited

Return true if this instance has the specified parent (possibly indirectly, anywhere up the hierarchy).

◆ isReset()

boolean org.lflang.generator.TriggerInstance< T extends Variable >.isReset ( )

Return true if this trigger is "startup".

/

◆ isShutdown()

boolean org.lflang.generator.TriggerInstance< T extends Variable >.isShutdown ( )

Return true if this trigger is "shutdown".

◆ isStartup()

boolean org.lflang.generator.TriggerInstance< T extends Variable >.isStartup ( )

Return true if this trigger is "startup".

/

◆ parents()

List< ReactorInstance > org.lflang.generator.NamedInstance< T extends EObject >.parents ( )
inherited

Return a list of all the parents starting with the root().

◆ root()

ReactorInstance org.lflang.generator.NamedInstance< T extends EObject >.root ( )
inherited

Return the root reactor, which is the top-level parent.

Returns
The top-level parent.

◆ setWidth()

void org.lflang.generator.NamedInstance< T extends EObject >.setWidth ( int width)
inherited

Set the width.

This method is here for testing only and should not be used for any other purpose.

Parameters
widthThe new width.

◆ uniqueID()

String org.lflang.generator.NamedInstance< T extends EObject >.uniqueID ( )
inherited

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.

Member Data Documentation

◆ definition

T org.lflang.generator.NamedInstance< T extends EObject >.definition
packageinherited

The Instantiation AST object from which this was created.

◆ dependentReactions

Set<ReactionInstance> org.lflang.generator.TriggerInstance< T extends Variable >.dependentReactions = new LinkedHashSet<>()
package

Reaction instances that are triggered or read by this trigger.

If this port is an output, then the reaction instances belong to the parent of the port's parent. If the port is an input, then the reaction instances belong to the port's parent.

◆ dependsOnReactions

Set<ReactionInstance> org.lflang.generator.TriggerInstance< T extends Variable >.dependsOnReactions = new LinkedHashSet<>()
package

Reaction instances that may send data via this port or action.

If this is an input port, then the reaction instance belongs to parent of the port's parent. If it is an output port, the reaction instance belongs to the port's parent. If it is an action, then the reaction belongs belongs to the same parent as this action.

◆ depth

int org.lflang.generator.NamedInstance< T extends EObject >.depth
protectedinherited

The depth in the hierarchy of this instance.

This is 0 for main or federated, 1 for the reactors immediately contained, etc.

◆ identifierLengthLimit

int org.lflang.generator.NamedInstance< T extends EObject >.identifierLengthLimit
staticinherited

A limit on the number of characters returned by uniqueID.

◆ parent

ReactorInstance org.lflang.generator.NamedInstance< T extends EObject >.parent
packageinherited

The reactor instance that creates this instance.

◆ uniqueIDCount

HashMap<String, Integer> org.lflang.generator.NamedInstance< T extends EObject >.uniqueIDCount
packageinherited

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

int org.lflang.generator.NamedInstance< T extends EObject >.width
packageinherited

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/TriggerInstance.java