Bug 511330 - [core.genmodel.fsm] introduce simplified generator model
for state machines
* bug fix for position provider and initial points
Change-Id: I0fd1c33096b886827daae0883f0790d1a5e970d4
diff --git a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/util/FSMHelpers.java b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/util/FSMHelpers.java
index 38f91a5..c6c28b6 100644
--- a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/util/FSMHelpers.java
+++ b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/util/FSMHelpers.java
@@ -243,12 +243,21 @@
}
/**
+ * @param sg a {@link StateGraph}
+ * @return <code>true</code> if the state graph represents the top level (i.e.
+ * is the actor's state machine)
+ */
+ public boolean isTopLevel(StateGraph sg) {
+ return !(sg.eContainer() instanceof State);
+ }
+
+ /**
* @param s a {@link State}
* @return <code>true</code> if the state resides in the top level (i.e.
* directly in the actor's state machine)
*/
public boolean isTopLevel(StateGraphNode s) {
- return !(s.eContainer().eContainer() instanceof State);
+ return isTopLevel((StateGraph) s.eContainer());
}
/**
diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/.classpath b/plugins/org.eclipse.etrice.ui.behavior.fsm/.classpath
index 358df1b..87e8cd6 100644
--- a/plugins/org.eclipse.etrice.ui.behavior.fsm/.classpath
+++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/.classpath
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="xtend-gen"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.etrice.ui.behavior.fsm/.settings/org.eclipse.jdt.core.prefs
index c537b63..0c68a61 100644
--- a/plugins/org.eclipse.etrice.ui.behavior.fsm/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/.settings/org.eclipse.jdt.core.prefs
@@ -1,7 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.ui.behavior.fsm/META-INF/MANIFEST.MF
index 7b4338c..ef8d440 100644
--- a/plugins/org.eclipse.etrice.ui.behavior.fsm/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/META-INF/MANIFEST.MF
@@ -19,7 +19,7 @@
org.eclipse.xtext.ui;bundle-version="2.7.0",
org.eclipse.xtend.lib;bundle-version="2.7.0",
org.eclipse.xtext.ui.shared;bundle-version="2.7.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.etrice.ui.behavior.fsm.actioneditor,
org.eclipse.etrice.ui.behavior.fsm.actioneditor.preferences,
diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/provider/BaseDiagramProvider.xtend b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/provider/BaseDiagramProvider.xtend
index 3d3f288..33cab87 100644
--- a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/provider/BaseDiagramProvider.xtend
+++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/provider/BaseDiagramProvider.xtend
@@ -18,7 +18,9 @@
import org.eclipse.emf.ecore.EObject
import org.eclipse.emf.ecore.util.EcoreUtil
import org.eclipse.etrice.core.fsm.fSM.ModelComponent
+import org.eclipse.etrice.core.fsm.fSM.StateGraph
import org.eclipse.etrice.ui.behavior.fsm.editor.AbstractFSMDiagramTypeProvider
+import org.eclipse.etrice.ui.behavior.fsm.support.util.FSMSupportUtil
import org.eclipse.etrice.ui.common.base.support.DiagramAccessBase
import org.eclipse.graphiti.mm.pictograms.PictogramElement
import org.eclipse.graphiti.mm.pictograms.PictogramLink
@@ -33,6 +35,7 @@
class BaseDiagramProvider {
val Multimap<EObject, PictogramElement> baseDiagramBusinessObjs = ArrayListMultimap.create
+ val fsmHelpers = FSMSupportUtil.instance.FSMHelpers
new(AbstractFSMDiagramTypeProvider diagramTypeProvider) {
val diagramAccess = diagramTypeProvider.injector.getInstance(DiagramAccessBase)
@@ -53,14 +56,24 @@
// create mapping from business object to pictogram elements
EcoreUtil.ExternalCrossReferencer.find(baseDiagram).forEach [ targetEObj, eFeatureSetting |
eFeatureSetting.map[getEObject].filter(PictogramLink).map[pictogramElement].forEach [ pe |
- baseDiagramBusinessObjs.put(targetEObj, pe)
+ put(mc, targetEObj, pe)
]
]
// base diagram resource not needed anymore
rs.resources.remove(baseDiagram.eResource)
}
- ]
+ ]
+ }
+
+ private def put(ModelComponent mc, EObject obj, PictogramElement value) {
+ if (obj instanceof StateGraph) {
+ if (fsmHelpers.isTopLevel(obj)) {
+ // to find the initial point of the TOP level we need the ModelComponent's stateMachine as a key
+ baseDiagramBusinessObjs.put(mc.stateMachine, value)
+ }
+ }
+ baseDiagramBusinessObjs.put(obj, value)
}
def Collection<PictogramElement> getPictograms(EObject roomObj) {
diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/support/DefaultPositionProvider.java b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/support/DefaultPositionProvider.java
deleted file mode 100644
index 97b86b5..0000000
--- a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/support/DefaultPositionProvider.java
+++ /dev/null
@@ -1,350 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.ui.behavior.fsm.support;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.fsm.fSM.ChoicePoint;
-import org.eclipse.etrice.core.fsm.fSM.ModelComponent;
-import org.eclipse.etrice.core.fsm.fSM.State;
-import org.eclipse.etrice.core.fsm.fSM.StateGraph;
-import org.eclipse.etrice.core.fsm.fSM.StateGraphItem;
-import org.eclipse.etrice.core.fsm.fSM.StateGraphNode;
-import org.eclipse.etrice.core.fsm.fSM.TrPoint;
-import org.eclipse.etrice.core.fsm.fSM.Transition;
-import org.eclipse.etrice.core.fsm.naming.FSMNameProvider;
-import org.eclipse.etrice.ui.behavior.fsm.commands.StateGraphContext;
-import org.eclipse.etrice.ui.behavior.fsm.support.util.FSMSupportUtil;
-import org.eclipse.etrice.ui.common.base.support.DiagramAccessBase;
-import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
-import org.eclipse.graphiti.mm.algorithms.Text;
-import org.eclipse.graphiti.mm.algorithms.styles.Point;
-import org.eclipse.graphiti.mm.pictograms.Connection;
-import org.eclipse.graphiti.mm.pictograms.ConnectionDecorator;
-import org.eclipse.graphiti.mm.pictograms.ContainerShape;
-import org.eclipse.graphiti.mm.pictograms.Diagram;
-import org.eclipse.graphiti.mm.pictograms.FreeFormConnection;
-import org.eclipse.graphiti.mm.pictograms.Shape;
-import org.eclipse.graphiti.services.Graphiti;
-import org.eclipse.graphiti.services.ILinkService;
-
-import com.google.inject.Injector;
-
-/**
- * @author Henrik Rentz-Reichert (initial contribution)
- *
- */
-public class DefaultPositionProvider implements IPositionProvider {
- private static class Position {
- double x;
- double y;
- double sx;
- double sy;
- }
-
- private HashMap<String, Position> obj2pos = new HashMap<String, Position>();
- private HashMap<String, Position> subObj2pos = new HashMap<String, Position>();
- private HashMap<String, ArrayList<Position>> trans2points = new HashMap<String, ArrayList<Position>>();
- private HashMap<String, StateGraph> initialPointObj = new HashMap<String, StateGraph>();
- private HashMap<String, PosAndSize> sg2sz = new HashMap<String, PosAndSize>();
- private double scaleX;
- private double scaleY;
- private int posX, posY;
-
- public DefaultPositionProvider(ModelComponent mc, Injector injector) {
- mapPositions(mc.getBase(), injector);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.etrice.ui.behavior.support.IPositionProvider#setScale(double, double)
- */
- @Override
- public void setScale(double sx, double sy) {
- this.scaleX = sx;
- this.scaleY = sy;
- }
-
- @Override
- public void setPosition(int x, int y){
- this.posX = x;
- this.posY = y;
- }
-
- public PosAndSize getPosition(StateGraphNode node) {
- Position pos = obj2pos.get(FSMSupportUtil.getInstance().getFSMNameProvider().getFullPath(node));
- if (pos==null)
- return null;
-
- int margin = getMargin(node);
- PosAndSize pt = new PosAndSize(
- (int) (pos.x * scaleX) + margin,
- (int) (pos.y * scaleY) + margin,
- (int) (pos.sx * scaleX),
- (int) (pos.sy * scaleY)
- );
- return pt;
- }
-
- @Override
- public PosAndSize getPosition(StateGraph graph) {
- EObject container = graph.eContainer();
- String path = "#init";
- if(container instanceof StateGraphNode)
- path = FSMSupportUtil.getInstance().getFSMNameProvider().getFullPath((StateGraphNode)container) + path;
- Position pos = obj2pos.get(path);
-
- if (pos==null)
- return null;
-
- int margin = getMargin(graph);
- PosAndSize pt = new PosAndSize(
- (int) (pos.x * scaleX) + margin,
- (int) (pos.y * scaleY) + margin,
- (int) (pos.sx * scaleX),
- (int) (pos.sy * scaleY)
- );
- return pt;
- }
-
- public List<Pos> getPoints(Transition trans) {
- ArrayList<Pos> result = new ArrayList<Pos>();
-
- ArrayList<Position> list = trans2points.get(FSMSupportUtil.getInstance().getFSMNameProvider().getFullPath(trans));
- if (list!=null) {
- int i = 0;
- for (Position p : list) {
- Pos pos =
- new Pos(
- (int) (p.x * scaleX) + ((i==0)?0:posX),
- (int) (p.y * scaleY) + ((i==0)?0:posY)
- );
- result.add(pos);
- i++;
- }
- }
-
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.etrice.ui.behavior.support.IPositionProvider#getPositions(java.util.List)
- */
- @Override
- public <T extends StateGraphNode> List<PosAndSize> getPositions(List<T> nodes) {
- ArrayList<PosAndSize> result = new ArrayList<PosAndSize>(nodes.size());
-
- if (nodes.isEmpty())
- return result;
-
- int n = 0;
- for (T node : nodes) {
- PosAndSize pt = getPosition(node);
- result.add(pt);
- if (pt==null)
- n++;
- }
-
- int delta = (int) (scaleX/(n+1));
- int pos = delta;
-
- int h = StateGraphSupport.MARGIN;
- if (nodes.get(0) instanceof State)
- h = StateGraphSupport.MARGIN + StateGraphSupport.DEFAULT_SIZE_Y/4;
- else if (nodes.get(0) instanceof ChoicePoint)
- h = StateGraphSupport.MARGIN + StateGraphSupport.DEFAULT_SIZE_Y/2;
- else if (nodes.get(0) instanceof TrPoint)
- h = StateGraphSupport.MARGIN;
- else {
- assert(false): "unexpected sub type";
- }
-
- for (int i=0; i<nodes.size(); ++i) {
- if (result.get(i)==null) {
- PosAndSize pt = new PosAndSize(
- pos,
- h,
- 0,
- 0
- );
- result.set(i, pt);
-
- pos += delta;
- }
- }
-
- return result;
- }
-
- /**
- * Load base class diagrams recursively and put midpoint positions relative to boundary rectangle into map.
- *
- * Positions are relative to the invisible rectangle. They are transformed to the border rectangle and normalized.
- *
- * @param mc
- * @param obj2pos
- */
- private void mapPositions(ModelComponent mc, Injector injector) {
- if (mc==null)
- return;
-
- DiagramAccessBase diagramAccess = injector.getInstance(DiagramAccessBase.class);
- Diagram diagram = diagramAccess.getDiagram(mc);
- if (diagram==null)
- return;
-
- StateGraphContext tree = StateGraphContext.createContextTree(FSMSupportUtil.getInstance().getModelComponent(diagram), injector);
- FSMNameProvider fsmNameProvider = FSMSupportUtil.getInstance().getFSMNameProvider();
-
- ILinkService linkService = Graphiti.getLinkService();
- for (Shape sgShape : diagram.getChildren()) {
- // this is the level of StateGraphs
- if (sgShape instanceof ContainerShape) {
- EObject obj = linkService.getBusinessObjectForLinkedPictogramElement(sgShape);
- GraphicsAlgorithm borderRect = sgShape.getGraphicsAlgorithm().getGraphicsAlgorithmChildren().get(0);
- double width = borderRect.getWidth();
- double height = borderRect.getHeight();
- PosAndSize sz = new PosAndSize(
- sgShape.getGraphicsAlgorithm().getX(), sgShape.getGraphicsAlgorithm().getY(),
- borderRect.getWidth(), borderRect.getHeight());
- sg2sz.put(fsmNameProvider.getFullPath((StateGraph) obj), sz);
- for (Shape sgItemShape : ((ContainerShape)sgShape).getChildren()) {
- // this is the level of States, TrPoints and ChoicePoints
- obj = linkService.getBusinessObjectForLinkedPictogramElement(sgItemShape);
- GraphicsAlgorithm ga = sgItemShape.getGraphicsAlgorithm();
- if(ga==null)
- continue;
- int margin = 0;
- String path = null;
- if (obj instanceof StateGraphNode) {
- StateGraphNode node = (StateGraphNode)obj;
- margin = getMargin(node);
- path = fsmNameProvider.getFullPath((StateGraphItem) obj);
-
- if(sgItemShape instanceof ContainerShape){
- // sub items
- for(Shape childShape : ((ContainerShape)sgItemShape).getChildren()){
- EObject childObj = linkService.getBusinessObjectForLinkedPictogramElement(childShape);
- if(childObj instanceof StateGraphItem){
- GraphicsAlgorithm childGa = childShape.getGraphicsAlgorithm();
- String childPath = fsmNameProvider.getFullPath((StateGraphItem) childObj);
- if (childPath != null) {
- Position pos = new Position();
- pos.x = childGa.getX() / (double) (ga.getWidth() - 2 * margin);
- pos.y = childGa.getY() / (double) (ga.getHeight() - 2 * margin);
- pos.sx = -1;
- pos.sy = -1;
- subObj2pos.put(childPath, pos);
- }
- }
- }
- }
- } else if(obj instanceof StateGraph){
- StateGraph graph = (StateGraph)obj;
- margin = getMargin(graph);
- EObject container = graph.eContainer();
- path = "#init";
- if(container instanceof StateGraphNode)
- path = fsmNameProvider.getFullPath((StateGraphNode)container) + path;
- initialPointObj.put(path, graph);
- }
- if(path != null){
- Position pos = new Position();
- pos.x = ga.getX() / width;
- pos.y = ga.getY() / height;
- pos.sx = (ga.getWidth() - 2*margin) / width;
- pos.sy = (ga.getHeight()- 2*margin) / height;
- obj2pos.put(path, pos);
- }
-
- // Entry and Exit Points on State borders are treated by the insertion of the State
- }
- }
- }
-
- for (Connection conn : diagram.getConnections()) {
- EObject obj = linkService.getBusinessObjectForLinkedPictogramElement(conn);
- if (obj instanceof Transition) {
- ConnectionDecorator cd = conn.getConnectionDecorators().get(1);
- if (cd.getGraphicsAlgorithm() instanceof Text) {
- Transition trans = (Transition) obj;
- StateGraph sg = tree.getContext(trans).getStateGraph();
-
- // graph size
- PosAndSize sz = sg2sz.get(fsmNameProvider.getFullPath(sg));
- ArrayList<Position> points = new ArrayList<Position>();
- trans2points.put(fsmNameProvider.getFullPath((Transition) obj), points);
-
- // label position
- Position pos = new Position();
- pos.x = cd.getGraphicsAlgorithm().getX() / ((double)sz.getWidth());
- pos.y = cd.getGraphicsAlgorithm().getY() / ((double)sz.getHeight());
- points.add(pos);
-
- if (conn instanceof FreeFormConnection) {
- for (Point bp : ((FreeFormConnection) conn).getBendpoints()) {
- pos = new Position();
- pos.x = (bp.getX() - sz.getX()) / ((double)sz.getWidth());
- pos.y = (bp.getY() - sz.getY()) / ((double)sz.getHeight());
- points.add(pos);
- }
- }
- }
-
- }
- }
-
- // recursion
- mapPositions(mc.getBase(), injector);
- }
-
- private int getMargin(StateGraphNode node) {
- if (node instanceof State)
- return StateSupport.MARGIN;
- else if (node instanceof TrPoint)
- return TrPointSupport.MARGIN;
-
- return 0;
- }
-
- private int getMargin(StateGraph graph) {
- return 0;
- }
-
- public StateGraph getInitialPoint(StateGraph graph){
- EObject container = graph.eContainer();
- String path = "#init";
- if(container instanceof StateGraphNode)
- path = FSMSupportUtil.getInstance().getFSMNameProvider().getFullPath((StateGraphNode)container) + path;
- return initialPointObj.get(path);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.etrice.ui.behavior.support.IPositionProvider#getGraphSize(org.eclipse.etrice.core.room.StateGraph)
- */
- @Override
- public PosAndSize getGraphPosAndSize(StateGraph sg) {
- return sg2sz.get(FSMSupportUtil.getInstance().getFSMNameProvider().getFullPath(sg));
- }
-
- @Override
- public double[] getSubPosition(StateGraphNode subNode) {
- Position pos = subObj2pos.get(FSMSupportUtil.getInstance().getFSMNameProvider().getFullPath(subNode));
- if (pos==null)
- return null;
-
- return new double[]{pos.x, pos.y};
- }
-}
diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/xtend-gen/org/eclipse/etrice/ui/behavior/fsm/provider/BaseDiagramProvider.java b/plugins/org.eclipse.etrice.ui.behavior.fsm/xtend-gen/org/eclipse/etrice/ui/behavior/fsm/provider/BaseDiagramProvider.java
index b66cfeb..6aac43c 100644
--- a/plugins/org.eclipse.etrice.ui.behavior.fsm/xtend-gen/org/eclipse/etrice/ui/behavior/fsm/provider/BaseDiagramProvider.java
+++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/xtend-gen/org/eclipse/etrice/ui/behavior/fsm/provider/BaseDiagramProvider.java
@@ -19,6 +19,8 @@
import java.util.Collection;
import java.util.List;
import java.util.Map;
+import java.util.function.BiConsumer;
+import java.util.function.Consumer;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -26,7 +28,10 @@
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.etrice.core.fsm.fSM.ModelComponent;
+import org.eclipse.etrice.core.fsm.fSM.StateGraph;
+import org.eclipse.etrice.core.fsm.util.FSMHelpers;
import org.eclipse.etrice.ui.behavior.fsm.editor.AbstractFSMDiagramTypeProvider;
+import org.eclipse.etrice.ui.behavior.fsm.support.util.FSMSupportUtil;
import org.eclipse.etrice.ui.common.base.support.DiagramAccessBase;
import org.eclipse.graphiti.mm.pictograms.Diagram;
import org.eclipse.graphiti.mm.pictograms.PictogramElement;
@@ -37,10 +42,8 @@
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.ListExtensions;
-import org.eclipse.xtext.xbase.lib.MapExtensions;
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
-import org.eclipse.xtext.xbase.lib.Procedures.Procedure2;
/**
* Provides the {@linkplain PictogramElement} objects of the base class diagram.
@@ -52,6 +55,8 @@
public class BaseDiagramProvider {
private final Multimap<EObject, PictogramElement> baseDiagramBusinessObjs = ArrayListMultimap.<EObject, PictogramElement>create();
+ private final FSMHelpers fsmHelpers = FSMSupportUtil.getInstance().getFSMHelpers();
+
public BaseDiagramProvider(final AbstractFSMDiagramTypeProvider diagramTypeProvider) {
Injector _injector = diagramTypeProvider.getInjector();
final DiagramAccessBase diagramAccess = _injector.<DiagramAccessBase>getInstance(DiagramAccessBase.class);
@@ -63,60 +68,57 @@
Resource _eResource = _diagram_1.eResource();
final ResourceSet rs = _eResource.getResourceSet();
ArrayList<ModelComponent> _newArrayList = CollectionLiterals.<ModelComponent>newArrayList();
- final Procedure1<ArrayList<ModelComponent>> _function = new Procedure1<ArrayList<ModelComponent>>() {
- @Override
- public void apply(final ArrayList<ModelComponent> it) {
- ModelComponent base = mc.getBase();
- while (((base != null) && it.add(base))) {
- ModelComponent _base = base.getBase();
- base = _base;
- }
+ final Procedure1<ArrayList<ModelComponent>> _function = (ArrayList<ModelComponent> it) -> {
+ ModelComponent base = mc.getBase();
+ while (((base != null) && it.add(base))) {
+ ModelComponent _base = base.getBase();
+ base = _base;
}
};
final ArrayList<ModelComponent> baseClasses = ObjectExtensions.<ArrayList<ModelComponent>>operator_doubleArrow(_newArrayList, _function);
List<ModelComponent> _reverseView = ListExtensions.<ModelComponent>reverseView(baseClasses);
- final Procedure1<ModelComponent> _function_1 = new Procedure1<ModelComponent>() {
- @Override
- public void apply(final ModelComponent base) {
- final Diagram baseDiagram = diagramAccess.getDiagram(base, rs);
- boolean _notEquals = (!Objects.equal(baseDiagram, null));
- if (_notEquals) {
- Map<EObject, Collection<EStructuralFeature.Setting>> _find = EcoreUtil.ExternalCrossReferencer.find(baseDiagram);
- final Procedure2<EObject, Collection<EStructuralFeature.Setting>> _function = new Procedure2<EObject, Collection<EStructuralFeature.Setting>>() {
- @Override
- public void apply(final EObject targetEObj, final Collection<EStructuralFeature.Setting> eFeatureSetting) {
- final Function1<EStructuralFeature.Setting, EObject> _function = new Function1<EStructuralFeature.Setting, EObject>() {
- @Override
- public EObject apply(final EStructuralFeature.Setting it) {
- return it.getEObject();
- }
- };
- Iterable<EObject> _map = IterableExtensions.<EStructuralFeature.Setting, EObject>map(eFeatureSetting, _function);
- Iterable<PictogramLink> _filter = Iterables.<PictogramLink>filter(_map, PictogramLink.class);
- final Function1<PictogramLink, PictogramElement> _function_1 = new Function1<PictogramLink, PictogramElement>() {
- @Override
- public PictogramElement apply(final PictogramLink it) {
- return it.getPictogramElement();
- }
- };
- Iterable<PictogramElement> _map_1 = IterableExtensions.<PictogramLink, PictogramElement>map(_filter, _function_1);
- final Procedure1<PictogramElement> _function_2 = new Procedure1<PictogramElement>() {
- @Override
- public void apply(final PictogramElement pe) {
- BaseDiagramProvider.this.baseDiagramBusinessObjs.put(targetEObj, pe);
- }
- };
- IterableExtensions.<PictogramElement>forEach(_map_1, _function_2);
- }
+ final Consumer<ModelComponent> _function_1 = (ModelComponent base) -> {
+ final Diagram baseDiagram = diagramAccess.getDiagram(base, rs);
+ boolean _notEquals = (!Objects.equal(baseDiagram, null));
+ if (_notEquals) {
+ Map<EObject, Collection<EStructuralFeature.Setting>> _find = EcoreUtil.ExternalCrossReferencer.find(baseDiagram);
+ final BiConsumer<EObject, Collection<EStructuralFeature.Setting>> _function_2 = (EObject targetEObj, Collection<EStructuralFeature.Setting> eFeatureSetting) -> {
+ final Function1<EStructuralFeature.Setting, EObject> _function_3 = (EStructuralFeature.Setting it) -> {
+ return it.getEObject();
};
- MapExtensions.<EObject, Collection<EStructuralFeature.Setting>>forEach(_find, _function);
- EList<Resource> _resources = rs.getResources();
- Resource _eResource = baseDiagram.eResource();
- _resources.remove(_eResource);
- }
+ Iterable<EObject> _map = IterableExtensions.<EStructuralFeature.Setting, EObject>map(eFeatureSetting, _function_3);
+ Iterable<PictogramLink> _filter = Iterables.<PictogramLink>filter(_map, PictogramLink.class);
+ final Function1<PictogramLink, PictogramElement> _function_4 = (PictogramLink it) -> {
+ return it.getPictogramElement();
+ };
+ Iterable<PictogramElement> _map_1 = IterableExtensions.<PictogramLink, PictogramElement>map(_filter, _function_4);
+ final Consumer<PictogramElement> _function_5 = (PictogramElement pe) -> {
+ this.put(mc, targetEObj, pe);
+ };
+ _map_1.forEach(_function_5);
+ };
+ _find.forEach(_function_2);
+ EList<Resource> _resources = rs.getResources();
+ Resource _eResource_1 = baseDiagram.eResource();
+ _resources.remove(_eResource_1);
}
};
- IterableExtensions.<ModelComponent>forEach(_reverseView, _function_1);
+ _reverseView.forEach(_function_1);
+ }
+
+ private boolean put(final ModelComponent mc, final EObject obj, final PictogramElement value) {
+ boolean _xblockexpression = false;
+ {
+ if ((obj instanceof StateGraph)) {
+ boolean _isTopLevel = this.fsmHelpers.isTopLevel(((StateGraph)obj));
+ if (_isTopLevel) {
+ StateGraph _stateMachine = mc.getStateMachine();
+ this.baseDiagramBusinessObjs.put(_stateMachine, value);
+ }
+ }
+ _xblockexpression = this.baseDiagramBusinessObjs.put(obj, value);
+ }
+ return _xblockexpression;
}
public Collection<PictogramElement> getPictograms(final EObject roomObj) {
diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/xtend-gen/org/eclipse/etrice/ui/behavior/fsm/provider/GenModelProvider.java b/plugins/org.eclipse.etrice.ui.behavior.fsm/xtend-gen/org/eclipse/etrice/ui/behavior/fsm/provider/GenModelProvider.java
index a1364f6..7f15203 100644
--- a/plugins/org.eclipse.etrice.ui.behavior.fsm/xtend-gen/org/eclipse/etrice/ui/behavior/fsm/provider/GenModelProvider.java
+++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/xtend-gen/org/eclipse/etrice/ui/behavior/fsm/provider/GenModelProvider.java
@@ -56,45 +56,39 @@
ILinkService _linkService = Graphiti.getLinkService();
Diagram _diagram = this.fsmDiagramProvider.getDiagram();
EObject _businessObjectForLinkedPictogramElement = _linkService.getBusinessObjectForLinkedPictogramElement(_diagram);
- final Procedure1<EObject> _function = new Procedure1<EObject>() {
- @Override
- public void apply(final EObject it) {
- GraphContainer _xifexpression = null;
- if ((it instanceof ModelComponent)) {
- _xifexpression = GenModelProvider.this.builder.createTransformedModel(((ModelComponent)it));
- } else {
- _xifexpression = null;
- }
- GenModelProvider.this.modelInstance = _xifexpression;
+ final Procedure1<EObject> _function = (EObject it) -> {
+ GraphContainer _xifexpression = null;
+ if ((it instanceof ModelComponent)) {
+ _xifexpression = this.builder.createTransformedModel(((ModelComponent)it));
+ } else {
+ _xifexpression = null;
}
+ this.modelInstance = _xifexpression;
};
ObjectExtensions.<EObject>operator_doubleArrow(_businessObjectForLinkedPictogramElement, _function);
boolean _notEquals = (!Objects.equal(this.modelInstance, null));
if (_notEquals) {
this.graphMap.clear();
TreeIterator<EObject> _eAllContents = this.modelInstance.eAllContents();
- final Procedure1<EObject> _function_1 = new Procedure1<EObject>() {
- @Override
- public void apply(final EObject it) {
- boolean _matched = false;
- if (it instanceof Graph) {
+ final Procedure1<EObject> _function_1 = (EObject it) -> {
+ boolean _matched = false;
+ if (it instanceof Graph) {
+ _matched=true;
+ StateGraph _stateGraph = ((Graph)it).getStateGraph();
+ this.graphMap.put(_stateGraph, ((FSMGenElement)it));
+ }
+ if (!_matched) {
+ if (it instanceof Node) {
_matched=true;
- StateGraph _stateGraph = ((Graph)it).getStateGraph();
- GenModelProvider.this.graphMap.put(_stateGraph, ((FSMGenElement)it));
+ StateGraphNode _stateGraphNode = ((Node)it).getStateGraphNode();
+ this.graphMap.put(_stateGraphNode, ((FSMGenElement)it));
}
- if (!_matched) {
- if (it instanceof Node) {
- _matched=true;
- StateGraphNode _stateGraphNode = ((Node)it).getStateGraphNode();
- GenModelProvider.this.graphMap.put(_stateGraphNode, ((FSMGenElement)it));
- }
- }
- if (!_matched) {
- if (it instanceof Link) {
- _matched=true;
- TransitionBase _transition = ((Link)it).getTransition();
- GenModelProvider.this.graphMap.put(_transition, ((FSMGenElement)it));
- }
+ }
+ if (!_matched) {
+ if (it instanceof Link) {
+ _matched=true;
+ TransitionBase _transition = ((Link)it).getTransition();
+ this.graphMap.put(_transition, ((FSMGenElement)it));
}
}
};
diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/xtend-gen/org/eclipse/etrice/ui/behavior/fsm/support/BaseDiagramPositionProvider.java b/plugins/org.eclipse.etrice.ui.behavior.fsm/xtend-gen/org/eclipse/etrice/ui/behavior/fsm/support/BaseDiagramPositionProvider.java
index 35a44cf..6d4755f 100644
--- a/plugins/org.eclipse.etrice.ui.behavior.fsm/xtend-gen/org/eclipse/etrice/ui/behavior/fsm/support/BaseDiagramPositionProvider.java
+++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/xtend-gen/org/eclipse/etrice/ui/behavior/fsm/support/BaseDiagramPositionProvider.java
@@ -118,12 +118,9 @@
IPositionProvider.PosAndSize _xblockexpression = null;
{
Collection<PictogramElement> _pictograms = this.baseDiagram.getPictograms(sg);
- final Function1<PictogramElement, Boolean> _function = new Function1<PictogramElement, Boolean>() {
- @Override
- public Boolean apply(final PictogramElement it) {
- EObject _parentBo = BaseDiagramPositionProvider.this.getParentBo(it);
- return Boolean.valueOf((_parentBo instanceof ModelComponent));
- }
+ final Function1<PictogramElement, Boolean> _function = (PictogramElement it) -> {
+ EObject _parentBo = this.getParentBo(it);
+ return Boolean.valueOf((_parentBo instanceof ModelComponent));
};
final PictogramElement pe = IterableExtensions.<PictogramElement>findFirst(_pictograms, _function);
IPositionProvider.PosAndSize _xifexpression = null;
@@ -164,59 +161,50 @@
}
final PictogramElement pe = _xifexpression;
ArrayList<IPositionProvider.Pos> _newArrayList = CollectionLiterals.<IPositionProvider.Pos>newArrayList();
- final Procedure1<ArrayList<IPositionProvider.Pos>> _function = new Procedure1<ArrayList<IPositionProvider.Pos>>() {
- @Override
- public void apply(final ArrayList<IPositionProvider.Pos> pointList) {
- if ((pe instanceof Connection)) {
- EObject _eContainer = trans.eContainer();
- final IPositionProvider.PosAndSize graphPosAndSize = BaseDiagramPositionProvider.this.getGraphPosAndSize(((StateGraph) _eContainer));
- EList<ConnectionDecorator> _connectionDecorators = ((Connection)pe).getConnectionDecorators();
- final Function1<ConnectionDecorator, GraphicsAlgorithm> _function = new Function1<ConnectionDecorator, GraphicsAlgorithm>() {
- @Override
- public GraphicsAlgorithm apply(final ConnectionDecorator it) {
- return it.getGraphicsAlgorithm();
- }
- };
- List<GraphicsAlgorithm> _map = ListExtensions.<ConnectionDecorator, GraphicsAlgorithm>map(_connectionDecorators, _function);
- Iterable<Text> _filter = Iterables.<Text>filter(_map, Text.class);
- final Text text = IterableExtensions.<Text>head(_filter);
- boolean _notEquals = (!Objects.equal(text, null));
- if (_notEquals) {
- int _x = text.getX();
- int _width = graphPosAndSize.getWidth();
- double _divide = (_x / ((double) _width));
- double _multiply = (_divide * BaseDiagramPositionProvider.this.sx);
- int _y = text.getY();
- int _height = graphPosAndSize.getHeight();
- double _divide_1 = (_y / ((double) _height));
- double _multiply_1 = (_divide_1 * BaseDiagramPositionProvider.this.sy);
- IPositionProvider.Pos _pos = new IPositionProvider.Pos(
- ((int) _multiply),
- ((int) _multiply_1));
- pointList.add(_pos);
- if ((pe instanceof FreeFormConnection)) {
- EList<Point> _bendpoints = ((FreeFormConnection)pe).getBendpoints();
- final Function1<Point, IPositionProvider.Pos> _function_1 = new Function1<Point, IPositionProvider.Pos>() {
- @Override
- public IPositionProvider.Pos apply(final Point it) {
- int _x = text.getX();
- int _width = graphPosAndSize.getWidth();
- double _divide = (_x / ((double) _width));
- double _multiply = (_divide * BaseDiagramPositionProvider.this.sx);
- double _plus = (_multiply + BaseDiagramPositionProvider.this.x);
- int _y = text.getY();
- int _height = graphPosAndSize.getHeight();
- double _divide_1 = (_y / ((double) _height));
- double _multiply_1 = (_divide_1 * BaseDiagramPositionProvider.this.sy);
- double _plus_1 = (_multiply_1 + BaseDiagramPositionProvider.this.y);
- return new IPositionProvider.Pos(
- ((int) _plus),
- ((int) _plus_1));
- }
- };
- List<IPositionProvider.Pos> _map_1 = ListExtensions.<Point, IPositionProvider.Pos>map(_bendpoints, _function_1);
- Iterables.<IPositionProvider.Pos>addAll(pointList, _map_1);
- }
+ final Procedure1<ArrayList<IPositionProvider.Pos>> _function = (ArrayList<IPositionProvider.Pos> pointList) -> {
+ if ((pe instanceof Connection)) {
+ EObject _eContainer = trans.eContainer();
+ final IPositionProvider.PosAndSize graphPosAndSize = this.getGraphPosAndSize(((StateGraph) _eContainer));
+ EList<ConnectionDecorator> _connectionDecorators = ((Connection)pe).getConnectionDecorators();
+ final Function1<ConnectionDecorator, GraphicsAlgorithm> _function_1 = (ConnectionDecorator it) -> {
+ return it.getGraphicsAlgorithm();
+ };
+ List<GraphicsAlgorithm> _map = ListExtensions.<ConnectionDecorator, GraphicsAlgorithm>map(_connectionDecorators, _function_1);
+ Iterable<Text> _filter = Iterables.<Text>filter(_map, Text.class);
+ final Text text = IterableExtensions.<Text>head(_filter);
+ boolean _notEquals = (!Objects.equal(text, null));
+ if (_notEquals) {
+ int _x = text.getX();
+ int _width = graphPosAndSize.getWidth();
+ double _divide = (_x / ((double) _width));
+ double _multiply = (_divide * this.sx);
+ int _y = text.getY();
+ int _height = graphPosAndSize.getHeight();
+ double _divide_1 = (_y / ((double) _height));
+ double _multiply_1 = (_divide_1 * this.sy);
+ IPositionProvider.Pos _pos = new IPositionProvider.Pos(
+ ((int) _multiply),
+ ((int) _multiply_1));
+ pointList.add(_pos);
+ if ((pe instanceof FreeFormConnection)) {
+ EList<Point> _bendpoints = ((FreeFormConnection)pe).getBendpoints();
+ final Function1<Point, IPositionProvider.Pos> _function_2 = (Point it) -> {
+ int _x_1 = text.getX();
+ int _width_1 = graphPosAndSize.getWidth();
+ double _divide_2 = (_x_1 / ((double) _width_1));
+ double _multiply_2 = (_divide_2 * this.sx);
+ double _plus = (_multiply_2 + this.x);
+ int _y_1 = text.getY();
+ int _height_1 = graphPosAndSize.getHeight();
+ double _divide_3 = (_y_1 / ((double) _height_1));
+ double _multiply_3 = (_divide_3 * this.sy);
+ double _plus_1 = (_multiply_3 + this.y);
+ return new IPositionProvider.Pos(
+ ((int) _plus),
+ ((int) _plus_1));
+ };
+ List<IPositionProvider.Pos> _map_1 = ListExtensions.<Point, IPositionProvider.Pos>map(_bendpoints, _function_2);
+ Iterables.<IPositionProvider.Pos>addAll(pointList, _map_1);
}
}
}
@@ -228,25 +216,19 @@
@Override
public IPositionProvider.PosAndSize getPosition(final StateGraphNode node) {
- final Function1<EObject, IPositionProvider.PosAndSize> _function = new Function1<EObject, IPositionProvider.PosAndSize>() {
- @Override
- public IPositionProvider.PosAndSize apply(final EObject it) {
- Collection<PictogramElement> _pictograms = BaseDiagramPositionProvider.this.baseDiagram.getPictograms(it);
- final Function1<PictogramElement, Boolean> _function = new Function1<PictogramElement, Boolean>() {
- @Override
- public Boolean apply(final PictogramElement it) {
- EObject _parentBo = BaseDiagramPositionProvider.this.getParentBo(it);
- return Boolean.valueOf((_parentBo instanceof StateGraph));
- }
- };
- PictogramElement _findFirst = IterableExtensions.<PictogramElement>findFirst(_pictograms, _function);
- IPositionProvider.PosAndSize _posAndSize = null;
- if (_findFirst!=null) {
- int _margin = BaseDiagramPositionProvider.this.getMargin(node);
- _posAndSize=BaseDiagramPositionProvider.this.toPosAndSize(_findFirst, _margin);
- }
- return _posAndSize;
+ final Function1<EObject, IPositionProvider.PosAndSize> _function = (EObject it) -> {
+ Collection<PictogramElement> _pictograms = this.baseDiagram.getPictograms(it);
+ final Function1<PictogramElement, Boolean> _function_1 = (PictogramElement it_1) -> {
+ EObject _parentBo = this.getParentBo(it_1);
+ return Boolean.valueOf((_parentBo instanceof StateGraph));
+ };
+ PictogramElement _findFirst = IterableExtensions.<PictogramElement>findFirst(_pictograms, _function_1);
+ IPositionProvider.PosAndSize _posAndSize = null;
+ if (_findFirst!=null) {
+ int _margin = this.getMargin(node);
+ _posAndSize=this.toPosAndSize(_findFirst, _margin);
}
+ return _posAndSize;
};
final Function1<EObject, IPositionProvider.PosAndSize> getBasePos = _function;
IPositionProvider.PosAndSize _xifexpression = null;
@@ -288,12 +270,9 @@
@Override
public IPositionProvider.PosAndSize getPosition(final StateGraph graph) {
Collection<PictogramElement> _pictograms = this.baseDiagram.getPictograms(graph);
- final Function1<PictogramElement, Boolean> _function = new Function1<PictogramElement, Boolean>() {
- @Override
- public Boolean apply(final PictogramElement it) {
- EObject _parentBo = BaseDiagramPositionProvider.this.getParentBo(it);
- return Boolean.valueOf((_parentBo instanceof StateGraph));
- }
+ final Function1<PictogramElement, Boolean> _function = (PictogramElement it) -> {
+ EObject _parentBo = this.getParentBo(it);
+ return Boolean.valueOf((_parentBo instanceof StateGraph));
};
PictogramElement _findFirst = IterableExtensions.<PictogramElement>findFirst(_pictograms, _function);
IPositionProvider.PosAndSize _posAndSize = null;
@@ -306,18 +285,15 @@
@Override
public <T extends StateGraphNode> List<IPositionProvider.PosAndSize> getPositions(final List<T> items) {
- final Function1<T, IPositionProvider.PosAndSize> _function = new Function1<T, IPositionProvider.PosAndSize>() {
- @Override
- public IPositionProvider.PosAndSize apply(final T it) {
- Collection<PictogramElement> _pictograms = BaseDiagramPositionProvider.this.baseDiagram.getPictograms(it);
- PictogramElement _head = IterableExtensions.<PictogramElement>head(_pictograms);
- IPositionProvider.PosAndSize _posAndSize = null;
- if (_head!=null) {
- int _margin = BaseDiagramPositionProvider.this.getMargin(it);
- _posAndSize=BaseDiagramPositionProvider.this.toPosAndSize(_head, _margin);
- }
- return _posAndSize;
+ final Function1<T, IPositionProvider.PosAndSize> _function = (T it) -> {
+ Collection<PictogramElement> _pictograms = this.baseDiagram.getPictograms(it);
+ PictogramElement _head = IterableExtensions.<PictogramElement>head(_pictograms);
+ IPositionProvider.PosAndSize _posAndSize = null;
+ if (_head!=null) {
+ int _margin = this.getMargin(it);
+ _posAndSize=this.toPosAndSize(_head, _margin);
}
+ return _posAndSize;
};
return ListExtensions.<T, IPositionProvider.PosAndSize>map(items, _function);
}
@@ -325,12 +301,9 @@
@Override
public double[] getSubPosition(final StateGraphNode subNode) {
Collection<PictogramElement> _pictograms = this.baseDiagram.getPictograms(subNode);
- final Function1<PictogramElement, Boolean> _function = new Function1<PictogramElement, Boolean>() {
- @Override
- public Boolean apply(final PictogramElement it) {
- EObject _parentBo = BaseDiagramPositionProvider.this.getParentBo(it);
- return Boolean.valueOf((_parentBo instanceof State));
- }
+ final Function1<PictogramElement, Boolean> _function = (PictogramElement it) -> {
+ EObject _parentBo = this.getParentBo(it);
+ return Boolean.valueOf((_parentBo instanceof State));
};
final PictogramElement pe = IterableExtensions.<PictogramElement>findFirst(_pictograms, _function);
boolean _notEquals = (!Objects.equal(pe, null));
diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/xtend-gen/org/eclipse/etrice/ui/behavior/fsm/support/GenModelStateGraphContext.java b/plugins/org.eclipse.etrice.ui.behavior.fsm/xtend-gen/org/eclipse/etrice/ui/behavior/fsm/support/GenModelStateGraphContext.java
index c79d40e..f59b4a6 100644
--- a/plugins/org.eclipse.etrice.ui.behavior.fsm/xtend-gen/org/eclipse/etrice/ui/behavior/fsm/support/GenModelStateGraphContext.java
+++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/xtend-gen/org/eclipse/etrice/ui/behavior/fsm/support/GenModelStateGraphContext.java
@@ -67,11 +67,8 @@
@Override
public List<ChoicePoint> getChPoints() {
EList<Node> _nodes = this.graph.getNodes();
- final Function1<Node, StateGraphNode> _function = new Function1<Node, StateGraphNode>() {
- @Override
- public StateGraphNode apply(final Node it) {
- return it.getStateGraphNode();
- }
+ final Function1<Node, StateGraphNode> _function = (Node it) -> {
+ return it.getStateGraphNode();
};
List<StateGraphNode> _map = ListExtensions.<Node, StateGraphNode>map(_nodes, _function);
Iterable<ChoicePoint> _filter = Iterables.<ChoicePoint>filter(_map, ChoicePoint.class);
@@ -81,21 +78,15 @@
@Override
public List<IStateGraphContext> getChildren() {
EList<Node> _nodes = this.graph.getNodes();
- final Function1<Node, Boolean> _function = new Function1<Node, Boolean>() {
- @Override
- public Boolean apply(final Node it) {
- Graph _subgraph = it.getSubgraph();
- return Boolean.valueOf((!Objects.equal(_subgraph, null)));
- }
+ final Function1<Node, Boolean> _function = (Node it) -> {
+ Graph _subgraph = it.getSubgraph();
+ return Boolean.valueOf((!Objects.equal(_subgraph, null)));
};
Iterable<Node> _filter = IterableExtensions.<Node>filter(_nodes, _function);
- final Function1<Node, IStateGraphContext> _function_1 = new Function1<Node, IStateGraphContext>() {
- @Override
- public IStateGraphContext apply(final Node it) {
- Graph _subgraph = it.getSubgraph();
- GenModelStateGraphContext _genModelStateGraphContext = new GenModelStateGraphContext(_subgraph, GenModelStateGraphContext.this);
- return ((IStateGraphContext) _genModelStateGraphContext);
- }
+ final Function1<Node, IStateGraphContext> _function_1 = (Node it) -> {
+ Graph _subgraph = it.getSubgraph();
+ GenModelStateGraphContext _genModelStateGraphContext = new GenModelStateGraphContext(_subgraph, this);
+ return ((IStateGraphContext) _genModelStateGraphContext);
};
Iterable<IStateGraphContext> _map = IterableExtensions.<Node, IStateGraphContext>map(_filter, _function_1);
return IterableExtensions.<IStateGraphContext>toList(_map);
@@ -105,11 +96,8 @@
public StateGraph getInitialPoint() {
StateGraph _xifexpression = null;
EList<Link> _links = this.graph.getLinks();
- final Function1<Link, TransitionBase> _function = new Function1<Link, TransitionBase>() {
- @Override
- public TransitionBase apply(final Link it) {
- return it.getTransition();
- }
+ final Function1<Link, TransitionBase> _function = (Link it) -> {
+ return it.getTransition();
};
List<TransitionBase> _map = ListExtensions.<Link, TransitionBase>map(_links, _function);
Iterable<InitialTransition> _filter = Iterables.<InitialTransition>filter(_map, InitialTransition.class);
@@ -141,11 +129,8 @@
@Override
public List<State> getStates() {
EList<Node> _nodes = this.graph.getNodes();
- final Function1<Node, StateGraphNode> _function = new Function1<Node, StateGraphNode>() {
- @Override
- public StateGraphNode apply(final Node it) {
- return it.getStateGraphNode();
- }
+ final Function1<Node, StateGraphNode> _function = (Node it) -> {
+ return it.getStateGraphNode();
};
List<StateGraphNode> _map = ListExtensions.<Node, StateGraphNode>map(_nodes, _function);
Iterable<State> _filter = Iterables.<State>filter(_map, State.class);
@@ -155,11 +140,8 @@
@Override
public List<TrPoint> getTrPoints() {
EList<Node> _nodes = this.graph.getNodes();
- final Function1<Node, StateGraphNode> _function = new Function1<Node, StateGraphNode>() {
- @Override
- public StateGraphNode apply(final Node it) {
- return it.getStateGraphNode();
- }
+ final Function1<Node, StateGraphNode> _function = (Node it) -> {
+ return it.getStateGraphNode();
};
List<StateGraphNode> _map = ListExtensions.<Node, StateGraphNode>map(_nodes, _function);
Iterable<TrPoint> _filter = Iterables.<TrPoint>filter(_map, TrPoint.class);
@@ -169,11 +151,8 @@
@Override
public List<Transition> getTransitions() {
EList<Link> _links = this.graph.getLinks();
- final Function1<Link, TransitionBase> _function = new Function1<Link, TransitionBase>() {
- @Override
- public TransitionBase apply(final Link it) {
- return it.getTransition();
- }
+ final Function1<Link, TransitionBase> _function = (Link it) -> {
+ return it.getTransition();
};
List<TransitionBase> _map = ListExtensions.<Link, TransitionBase>map(_links, _function);
Iterable<Transition> _filter = Iterables.<Transition>filter(_map, Transition.class);