lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.diagram.synthesis.util.LayoutPostProcessing Class Reference

Set layout configuration options for the Lingua Franca diagram synthesis. More...

Inherits org.lflang.diagram.synthesis.AbstractSynthesisExtensions.

Public Member Functions

void configureAction (KNode node)
 Configures layout options for an action.
void configureDummy (KNode node)
 Configures layout options for a dummy node.
void configureMainReactor (KNode node)
 Configures layout options for main reactor.
void configureReaction (KNode node)
 Configures layout options for a reaction.
void configureReactor (KNode node)
 Configures layout options for a reactor.
void configureShutDown (KNode node)
 Configures layout options for a shutdown action.
void configureStartUp (KNode node)
 Configures layout options for a startup action.
void configureTimer (KNode node)
 Configures layout options for a timer.
boolean getBooleanValue (SynthesisOption option)
float getFloatValue (SynthesisOption option)
Object getObjectValue (final SynthesisOption option)
void orderChildren (List< KNode > nodes)
 Orders a list of nodes by their corresponding linked instance if synthesis option for full control is enabled.

Static Public Attributes

static final String FULL_CONTROL = "Full Control"
 No crossing minimization is done at all.
static final String LEGACY = "Legacy"
 Uses semi-automatic layout.
static final SynthesisOption MODEL_ORDER
static final String MODEL_ORDER_OPTION = "Model Order"
 Synthesis option to control the order of nodes and edges by model order.
static final String STRICT = "Reactions and Reactors"
 Reactions and reactor are strictly ordered by their model order.
static final String STRICT_REACTION_ONLY = "Reactions Only"
 Only reactions are strictly ordered by their model order.
static final Comparator< KNode > TEXTUAL_ORDER
 Comparator to sort KNodes based on the textual order of their linked instances.
static final String TIE_BREAKER = "Optimize Crossings"
 Reactions and reactors are ordered by their model order if no additional crossing are created.

Package Functions

public< T extends EObject > T associateWith (T derived, Object source)
public< T extends AbstractDiagramSynthesis<?> > T getRootSynthesis ()

Detailed Description

Set layout configuration options for the Lingua Franca diagram synthesis.

Author
Sören Domrös

Member Function Documentation

◆ associateWith()

public< T extends EObject > T org.lflang.diagram.synthesis.AbstractSynthesisExtensions.associateWith ( T derived,
Object source )
packageinherited

◆ configureAction()

void org.lflang.diagram.synthesis.util.LayoutPostProcessing.configureAction ( KNode node)

Configures layout options for an action.

Parameters
nodeThe KNode of an action.

◆ configureDummy()

void org.lflang.diagram.synthesis.util.LayoutPostProcessing.configureDummy ( KNode node)

Configures layout options for a dummy node.

Parameters
nodeThe KNode of a dummy node.

◆ configureMainReactor()

void org.lflang.diagram.synthesis.util.LayoutPostProcessing.configureMainReactor ( KNode node)

Configures layout options for main reactor.

Parameters
nodeThe KNode of the main reactor.

◆ configureReaction()

void org.lflang.diagram.synthesis.util.LayoutPostProcessing.configureReaction ( KNode node)

Configures layout options for a reaction.

Currently a reaction does not have internal behavior that is visualized and its order is always considered, therefore, nothing needs to be done.

Parameters
nodeThe KNode of a reaction.

◆ configureReactor()

void org.lflang.diagram.synthesis.util.LayoutPostProcessing.configureReactor ( KNode node)

Configures layout options for a reactor.

Parameters
nodeThe KNode of a reactor.

◆ configureShutDown()

void org.lflang.diagram.synthesis.util.LayoutPostProcessing.configureShutDown ( KNode node)

Configures layout options for a shutdown action.

Parameters
nodeThe KNode of a shutdown action.

◆ configureStartUp()

void org.lflang.diagram.synthesis.util.LayoutPostProcessing.configureStartUp ( KNode node)

Configures layout options for a startup action.

Parameters
nodeThe KNode of a startup action.

◆ configureTimer()

void org.lflang.diagram.synthesis.util.LayoutPostProcessing.configureTimer ( KNode node)

Configures layout options for a timer.

Parameters
nodeThe KNode of a timer.

◆ getBooleanValue()

boolean org.lflang.diagram.synthesis.AbstractSynthesisExtensions.getBooleanValue ( SynthesisOption option)
inherited

◆ getFloatValue()

float org.lflang.diagram.synthesis.AbstractSynthesisExtensions.getFloatValue ( SynthesisOption option)
inherited

◆ getObjectValue()

Object org.lflang.diagram.synthesis.AbstractSynthesisExtensions.getObjectValue ( final SynthesisOption option)
inherited

◆ getRootSynthesis()

public< T extends AbstractDiagramSynthesis<?> > T org.lflang.diagram.synthesis.AbstractSynthesisExtensions.getRootSynthesis ( )
packageinherited

◆ orderChildren()

void org.lflang.diagram.synthesis.util.LayoutPostProcessing.orderChildren ( List< KNode > nodes)

Orders a list of nodes by their corresponding linked instance if synthesis option for full control is enabled.

Ordering is done by the TEXTUAL_ORDER comparator.

Parameters
nodesList of KNodes to be ordered.

Member Data Documentation

◆ FULL_CONTROL

final String org.lflang.diagram.synthesis.util.LayoutPostProcessing.FULL_CONTROL = "Full Control"
static

No crossing minimization is done at all.

This requires that actions and timers are sorted based on their model order.

◆ LEGACY

final String org.lflang.diagram.synthesis.util.LayoutPostProcessing.LEGACY = "Legacy"
static

Uses semi-automatic layout.

◆ MODEL_ORDER

final SynthesisOption org.lflang.diagram.synthesis.util.LayoutPostProcessing.MODEL_ORDER
static
Initial value:
=
SynthesisOption.createChoiceOption(
Diagram synthesis for Lingua Franca programs.
Definition LinguaFrancaSynthesis.java:124
static final SynthesisOption LAYOUT
Definition LinguaFrancaSynthesis.java:192
static final String FULL_CONTROL
No crossing minimization is done at all.
Definition LayoutPostProcessing.java:53
static final String STRICT_REACTION_ONLY
Only reactions are strictly ordered by their model order.
Definition LayoutPostProcessing.java:39
static final String MODEL_ORDER_OPTION
Synthesis option to control the order of nodes and edges by model order.
Definition LayoutPostProcessing.java:33
static final String STRICT
Reactions and reactor are strictly ordered by their model order.
Definition LayoutPostProcessing.java:42
static final String TIE_BREAKER
Reactions and reactors are ordered by their model order if no additional crossing are created.
Definition LayoutPostProcessing.java:47

◆ MODEL_ORDER_OPTION

final String org.lflang.diagram.synthesis.util.LayoutPostProcessing.MODEL_ORDER_OPTION = "Model Order"
static

Synthesis option to control the order of nodes and edges by model order.

◆ STRICT

final String org.lflang.diagram.synthesis.util.LayoutPostProcessing.STRICT = "Reactions and Reactors"
static

Reactions and reactor are strictly ordered by their model order.

◆ STRICT_REACTION_ONLY

final String org.lflang.diagram.synthesis.util.LayoutPostProcessing.STRICT_REACTION_ONLY = "Reactions Only"
static

Only reactions are strictly ordered by their model order.

◆ TEXTUAL_ORDER

final Comparator<KNode> org.lflang.diagram.synthesis.util.LayoutPostProcessing.TEXTUAL_ORDER
static
Initial value:
=
new Comparator<KNode>() {
@Override
public int compare(KNode node1, KNode node2) {
var pos1 = getTextPosition(node1);
var pos2 = getTextPosition(node2);
if (pos1 >= 0 && pos1 >= 0) {
return Integer.compare(pos1, pos2);
} else if (pos1 >= 0) {
return -1;
} else if (pos2 >= 0) {
return 1;
}
return Integer.compare(
node1.hashCode(), node2.hashCode());
}
private int getTextPosition(KNode node) {
var instance = NamedInstanceUtil.getLinkedInstance(node);
if (instance != null) {
var definition = instance.getDefinition();
if (definition instanceof BuiltinTriggerVariable) {
switch (((BuiltinTriggerVariable) definition).type) {
case STARTUP:
return 0;
case RESET:
return 1;
case SHUTDOWN:
return Integer.MAX_VALUE;
}
} else if (definition instanceof EObject) {
var ast = NodeModelUtils.getNode((EObject) definition);
if (ast != null) {
return ast.getOffset();
}
}
}
return -1;
}
}

Comparator to sort KNodes based on the textual order of their linked instances.

Startup, reset and shutdown actions are not in the model and are handled separately: Startup actions will always be first. Reset actions follow after the startup action. Shutdown is always sorted last. However, shutdown actions will not have a model order set and are, therefore, implicitly ordered by their connection.

◆ TIE_BREAKER

final String org.lflang.diagram.synthesis.util.LayoutPostProcessing.TIE_BREAKER = "Optimize Crossings"
static

Reactions and reactors are ordered by their model order if no additional crossing are created.


The documentation for this class was generated from the following file:
  • /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/diagram/synthesis/util/LayoutPostProcessing.java