lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.generator.RuntimeRange< T >.Port Class Reference

Special case of RuntimeRange for PortInstance. More...

Inherits org.lflang.generator.RuntimeRange< PortInstance >.

Inherited by org.lflang.generator.SendRange.

Public Member Functions

int compareTo (RuntimeRange<?> o)
 Compare ranges by first comparing their start offset, and then, if these are equal, comparing their widths.
RuntimeRange< T > head (int newWidth)
 Return a new RuntimeRange that is identical to this range but with width reduced to the specified width.
List< Integer > instances ()
 Return the list of natural identifiers for the runtime instances in this range.
List< NamedInstance<?> > iterationOrder ()
 Return a list containing the instance for this range and all of its parents, not including the top level reactor, in the order in which their banks and multiport channels should be iterated.
RuntimeRange<?> overlap (RuntimeRange<?> range)
 Return a range that is the subset of this range that overlaps with the specified range or null if there is no overlap.
boolean overlaps (RuntimeRange<?> range)
 Return true if the specified range has the same instance as this range and the ranges overlap.
Set< Integer > parentInstances (int n)
 Return a set of identifiers for runtime instances of a parent of this RuntimeRange's instance n levels above this RuntimeRange's instance.
ReactorInstance parentReactor ()
 Return the nearest containing ReactorInstance for this instance.
List< Integer > permutation ()
 Return the permutation vector that indicates the order in which the digits of the permuted mixed-radix representations of indices in this range should be incremented.
 Port (PortInstance instance)
 Port (PortInstance instance, int start, int width, Set< ReactorInstance > interleaved)
 Port (PortInstance instance, Set< ReactorInstance > interleaved)
List< Integer > radixes ()
 Return the radixes vector containing the width of this instance followed by the widths of its containers, not including the top level, which always has radix 1 and value 0.
MixedRadixInt startMR ()
 Return the start as a new permuted mixed-radix number.
RuntimeRange< T > tail (int offset)
 Return a new range that represents the leftover elements starting at the specified offset relative to start.
RuntimeRange< T > toggleInterleaved (ReactorInstance reactor)
 Toggle the interleaved status of the specified reactor, which is assumed to be a parent of the instance of this range.
String toString ()

Public Attributes

final T instance
 The instance that this is a range of.
final int maxWidth
 The maximum width of any range with this instance.
final int start
 The start offset of this range.
final int width
 The width of this range.

Package Attributes

Set< ReactorInstance_interleaved
 Record of which levels are interleaved.

Detailed Description

Special case of RuntimeRange for PortInstance.

Constructor & Destructor Documentation

◆ Port() [1/3]

org.lflang.generator.RuntimeRange< T >.Port.Port ( PortInstance instance)

◆ Port() [2/3]

org.lflang.generator.RuntimeRange< T >.Port.Port ( PortInstance instance,
Set< ReactorInstance > interleaved )

◆ Port() [3/3]

org.lflang.generator.RuntimeRange< T >.Port.Port ( PortInstance instance,
int start,
int width,
Set< ReactorInstance > interleaved )

Member Function Documentation

◆ compareTo()

int org.lflang.generator.RuntimeRange< T >.compareTo ( RuntimeRange<?> o)
inherited

Compare ranges by first comparing their start offset, and then, if these are equal, comparing their widths.

This comparison is meaningful only for ranges that have the same instances. Note that this can return 0 even if equals() does not return true.

Parameters
oThe range to compare to.

◆ head()

RuntimeRange< T > org.lflang.generator.RuntimeRange< T >.head ( int newWidth)
inherited

Return a new RuntimeRange that is identical to this range but with width reduced to the specified width.

If the new width is greater than or equal to the width of this range, then return this range. If the newWidth is 0 or negative, return null.

Parameters
newWidthThe new width.

◆ instances()

List< Integer > org.lflang.generator.RuntimeRange< T >.instances ( )
inherited

Return the list of natural identifiers for the runtime instances in this range.

Each returned identifier is an integer representation of the mixed-radix number [d0, ... , dn] with radices [w0, ... , wn], where d0 is the bank or channel index of this RuntimeRange's instance, which has width w0, and dn is the bank index of its topmost parent below the top-level (main) reactor, which has width wn. The depth of this RuntimeRange's instance, therefore, is n - 1. The order of the returned list is the order in which the runtime instances should be iterated.

◆ iterationOrder()

List< NamedInstance<?> > org.lflang.generator.RuntimeRange< T >.iterationOrder ( )
inherited

Return a list containing the instance for this range and all of its parents, not including the top level reactor, in the order in which their banks and multiport channels should be iterated.

For each depth at which the connection is interleaved, that parent will appear before this instance in depth order (shallower to deeper). For each depth at which the connection is not interleaved, that parent will appear after this instance in reverse depth order (deeper to shallower).

◆ overlap()

RuntimeRange<?> org.lflang.generator.RuntimeRange< T >.overlap ( RuntimeRange<?> range)
inherited

Return a range that is the subset of this range that overlaps with the specified range or null if there is no overlap.

◆ overlaps()

boolean org.lflang.generator.RuntimeRange< T >.overlaps ( RuntimeRange<?> range)
inherited

Return true if the specified range has the same instance as this range and the ranges overlap.

Parameters
rangeThe range to check for overlap.

◆ parentInstances()

Set< Integer > org.lflang.generator.RuntimeRange< T >.parentInstances ( int n)
inherited

Return a set of identifiers for runtime instances of a parent of this RuntimeRange's instance n levels above this RuntimeRange's instance.

If n == 1, for example, then this return the identifiers for the parent ReactorInstance.

This returns a list of natural identifiers, as defined below, for the instances within the range.

The resulting list can be used to count the number of distinct runtime instances of this RuntimeRange's instance (using n == 0) or any of its parents that lie within the range and to provide an index into an array of runtime instances.

Each natural identifier is the integer value of a mixed-radix number defined as follows:

  • The low-order digit is the index of the runtime instance of i within its container. If the NamedInstance is a PortInstance, this will be the multiport channel or 0 if it is not a multiport. If the NamedInstance is a ReactorInstance, then it will be the bank index or 0 if the reactor is not a bank. The radix for this digit will be the multiport width or bank width or 1 if the NamedInstance is neither a multiport nor a bank.
  • The next digit will be the bank index of the container of the specified NamedInstance or 0 if it is not a bank.
  • The remaining digits will be bank indices of containers up to but not including the top-level reactor (there is no point in including the top-level reactor because it is never a bank).
  • Each index that is returned can be used as an index into an array of runtime instances that is assumed to be in a natural order.
Parameters
nThe number of levels up of the parent. This is required to be less than the depth of this RuntimeRange's instance or an exception will be thrown.

◆ parentReactor()

ReactorInstance org.lflang.generator.RuntimeRange< T >.parentReactor ( )
inherited

Return the nearest containing ReactorInstance for this instance.

If this instance is a ReactorInstance, then return it. Otherwise, return its parent.

◆ permutation()

List< Integer > org.lflang.generator.RuntimeRange< T >.permutation ( )
inherited

Return the permutation vector that indicates the order in which the digits of the permuted mixed-radix representations of indices in this range should be incremented.

◆ radixes()

List< Integer > org.lflang.generator.RuntimeRange< T >.radixes ( )
inherited

Return the radixes vector containing the width of this instance followed by the widths of its containers, not including the top level, which always has radix 1 and value 0.

◆ startMR()

Return the start as a new permuted mixed-radix number.

For any instance that is neither a multiport nor a bank, the corresponding digit will be 0.

◆ tail()

RuntimeRange< T > org.lflang.generator.RuntimeRange< T >.tail ( int offset)
inherited

Return a new range that represents the leftover elements starting at the specified offset relative to start.

If start + offset is greater than or equal to the width, then this returns null. If this offset is 0 then this returns this range unmodified.

Parameters
offsetThe number of elements to consume.

◆ toggleInterleaved()

RuntimeRange< T > org.lflang.generator.RuntimeRange< T >.toggleInterleaved ( ReactorInstance reactor)
inherited

Toggle the interleaved status of the specified reactor, which is assumed to be a parent of the instance of this range.

If it was previously interleaved, make it not interleaved and vice versa. This returns a new RuntimeRange.

Parameters
reactorThe parent reactor at which to toggle interleaving.

◆ toString()

String org.lflang.generator.RuntimeRange< T >.toString ( )
inherited

Member Data Documentation

◆ _interleaved

Set<ReactorInstance> org.lflang.generator.RuntimeRange< T >._interleaved
packageinherited

Record of which levels are interleaved.

◆ instance

final T org.lflang.generator.RuntimeRange< T >.instance
inherited

The instance that this is a range of.

◆ maxWidth

final int org.lflang.generator.RuntimeRange< T >.maxWidth
inherited

The maximum width of any range with this instance.

◆ start

final int org.lflang.generator.RuntimeRange< T >.start
inherited

The start offset of this range.

◆ width

final int org.lflang.generator.RuntimeRange< T >.width
inherited

The width of this range.


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