Repository navigation
Expand file tree
/
Copy pathPetriNetNode.java
More file actions
264 lines (227 loc) · 7.58 KB
/
Copy pathPetriNetNode.java
File metadata and controls
264 lines (227 loc) · 7.58 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
import java.util.*;
public class PetriNetNode{
private ArrayList<String> incomingNodes ;
private ArrayList<String> outgoingNodes ;
private ArrayList<String> outgoingEdgesNames ;
private ArrayList<Integer> incomingEdges;
private ArrayList<Integer> outgoingEdges;
private String name , id , kind;
private boolean isPlace, isTransition , isEPlace , isETransition , isMessageFlow;
private int taskType , cardinality;
private boolean isTimer , isSpecialNode;
private int currentTime;
PetriNetNode(){
incomingNodes = new ArrayList<>();
outgoingNodes = new ArrayList<>();
incomingEdges = new ArrayList<>();
outgoingEdges = new ArrayList<>();
outgoingEdgesNames = new ArrayList<>();
name = "";
isPlace = isEPlace = isTransition = isETransition = isMessageFlow= isTimer = false;
taskType = -1;
cardinality = 0;
isSpecialNode = false;
kind = "";
currentTime = -1;
}
public void setTime(int val){
this.currentTime = val;
}
public int getTime(){
return currentTime;
}
public void setKind(String val){
this.kind = val;
}
public String getKind(){
return kind;
}
public ArrayList<String> getOutgoingEdgesName(){
return outgoingEdgesNames;
}
public void setOutgoingEdgesName(String str){
this.outgoingEdgesNames.add(str);
}
/**
* Returns the list of incoming nodes. This is used to determine if we are talking to a node, all previous nodes
*/
public ArrayList<String> getIncomingNodes(){
return incomingNodes;
}
/**
* Returns the outgoing nodes. This is a list of node IDs that are reachable from this node in the order they were added
*/
public ArrayList<String> getOutgoingNodes(){
return outgoingNodes;
}
/**
* Sets the incoming node. This is used to determine if a node is the same as another node or not
*
* @param incoming - The name of the node
*/
public void setIncomingNode(String incoming){
this.incomingNodes.add(incoming);
}
/**
* Sets the outgoing nodes. This is used to determine if a node is in the graph or not.
*
* @param outgoing - The outgoing node to add to the graph
*/
public void setOutgoingNodes(String outgoing){
this.outgoingNodes.add(outgoing);
}
// adding list for edges direct 1 and messageflow -1
/**
* Returns the incoming edges of this edge - weighted digraph. This is a copy of getIncomingEdges but stores integer values so that we can avoid message and normal transition
*/
public ArrayList<Integer> getIncomingEdges(){
return incomingEdges;
}
/**
* Returns the outgoing edges of this edge - weighted digraph. This is a copy of the outgoingEdges array but stores integer values so that we can avoid message and normal transition
*/
public ArrayList<Integer> getOutgoingEdges(){
return outgoingEdges;
}
/**
* Sets the number of incoming edges. This is used to determine whether or not a node is connected to another node by an edge in the graph.
*
* @param incoming - The number of incoming edges to be connected to the
*/
public void setIncomingEdges(int incoming){
this.incomingEdges.add(incoming);
}
/**
* Sets the number of outgoing edges. This is used to determine whether or not a node is connected to another node by an edge in the graph.
*
* @param outgoing - the number of outgoing edges to be connected to this
*/
public void setOutgoingEdges(int outgoing){
this.outgoingEdges.add(outgoing);
}
/**
* Set the name of the entity. This is used to distinguish entities from other entities that are in the same entity group
*
* @param n - The name of the
*/
public void setName(String n){
this.name = n;
}
/**
* Returns the name of this entity. This is the entity's name in the form of a java. lang. String object.
*
*
* @return the entity's name in the form of a java. lang. String object or null if there is no
*/
public String getName(){
return name;
}
/**
* Sets isPlace to true. This is used so that a node is identified and ambiguity about transiton and transition is removed.
*/
public void setisPlace(){
this.isPlace = true;
}
/**
* Returns true if this is a place. This is used to determine if the user is placing a place
*/
public boolean getisPlace(){
return isPlace;
}
/**
* Sets isEPlace to true. This is used to ensure that the place is Eplace so we dont add duplicate place and avoid transition to transition edges.
*/
public void setisEPlace(){
this.isEPlace = true;
}
/**
* Returns true if e - place is used false otherwise. This is used to determine if we are using eplace as a place
*/
public boolean getisEPlace(){
return isEPlace;
}
/**
* Sets the isTransition flag to true. This is used to prevent an infinite loop in transition processing and the effect of a call to #getTransition ()
*/
public void setisTransition(){
this.isTransition = true;
}
/**
* Returns true if this node is a transition node. This is used to determine if the state of an edge should be updated
*/
public boolean getisTransition(){
return isTransition;
}
/**
* Sets the isETransition flag to true. This is used by transition methods to determine if the transition is an epsilon transition
*/
public void setisETransition(){
this.isETransition = true;
}
/**
* Returns true if this is an e transition. This is used to determine if the transition is a divergent
*/
public boolean getisETransition(){
return isETransition;
}
/**
* Sets message flow to true. This is used to set message values (basically for arcs)
*/
public void setMessageFlow(){
this.isMessageFlow = true;
}
/**
* Returns true if this packet is message flowing. This is used to determine if an error or an empty packet should be sent
*/
public boolean getMessageFLow(){
return isMessageFlow;
}
/*
* task type means weather its looping task, multiinstance sequenctial or multiinstance parallel or default task
* value assigned are as follows
* default = 0;
* loop =1
* multinstance parallel = 2 (here issequential in not present)
* multinstance sequential = 3 ( here issequential is set to true)
*/
public void setTaskType(int type){
this.taskType = type;
}
/**
* return task type for identification
*/
public int getTaskType(){
return taskType;
}
/**
* Set cardinatlity of given task type by default we assume it to be 1 but for cases where node is not
* transition itself then we take tasktype parameter into consideration.
*/
public void setCardinality(int cardinality){
this.cardinality = cardinality;
}
/**
* return the cardinality of task
*/
public int getCardinality(){
return cardinality;
}
public void setId(String str){
this.id = str;
}
public String getId(){
return id;
}
public void setIsTimerEvent(boolean val){
this.isTimer = val;
}
public boolean getIsTimerEvent(){
return isTimer;
}
public boolean getIsSpecialNode(){
return isSpecialNode;
}
public void setIsSpecialNode(){
this.isSpecialNode = true;
}
}