blob: ab120ddd4977bb2bfd1119e5ce94004b08269b3e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/*******************************************************************************
* Copyright (c) 2017 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 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* CONTRIBUTORS:
* Henrik Rentz-Reichert (initial contribution)
*
*******************************************************************************/
package org.eclipse.etrice.core.genmodel.fsm
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.Node
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.Graph
import org.eclipse.etrice.core.fsm.fSM.State
import org.eclipse.etrice.core.fsm.fSM.ChoicePoint
import org.eclipse.etrice.core.fsm.fSM.TrPoint
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.Link
class FsmGenExtensions {
public static def getName(Node nd) {
nd.stateGraphNode.name
}
public static def getStateNodes(Graph g) {
g.nodes.filter[stateGraphNode instanceof State]
}
public static def getAllNodes(Graph g) {
g.eAllContents.filter(typeof(Node))
}
public static def getAllStateNodes(Graph g) {
g.allNodes.filter[stateGraphNode instanceof State]
}
public static def getChoicePointNodes(Graph g) {
g.nodes.filter[stateGraphNode instanceof ChoicePoint]
}
public static def getAllChoicePointNodes(Graph g) {
g.allNodes.filter[stateGraphNode instanceof ChoicePoint]
}
public static def getTrPointNodes(Graph g) {
g.nodes.filter[stateGraphNode instanceof TrPoint]
}
public static def getAllTrPointNodes(Graph g) {
g.allNodes.filter[stateGraphNode instanceof TrPoint]
}
public static def getStates(Graph g) {
g.stateNodes.map[stateGraphNode].filter(typeof(State))
}
public static def getChoicePoints(Graph g) {
g.choicePointNodes.map[stateGraphNode].filter(typeof(ChoicePoint))
}
public static def getTransitionPoints(Graph g) {
g.trPointNodes.map[stateGraphNode].filter(typeof(TrPoint))
}
public static def getAllLinks(Graph g) {
g.eAllContents.filter(typeof(Link))
}
}
|