View Javadoc

1   /*
2    * Copyright 2010 Fraunhofer Gesellschaft, Munich, Germany,
3    * for its Fraunhofer Institute for Computer Architecture and Software
4    * Technology (FIRST), Berlin, Germany. All rights reserved.
5    * http://www.first.fraunhofer.de/
6    */
7   
8   package net.kwfgrid.gworkflowdl.structure;
9   
10  /***
11   * interface of Transitions.
12   */
13  public interface Transition {
14      /*
15       * status constants of AnalysisTransition.
16       */
17      /*
18      int STATUS_IDLE = 1;
19      int STATUS_ENABLED = 2;
20      int STATUS_TRIGGERED = 4;
21      int STATUS_FIRING = 8;
22      */
23  
24      int DEFAULT_STATUS = 0;
25      String DEFAULT_ID = null;
26      String DEFAULT_DESCRIPTION = null;
27      int DEFAULT_EDGE_NUMBER = 0;
28      Object DEFAULT_CONDITIONS = null;
29      Operation DEFAULT_OPERATION = null;
30  
31      /***
32       * set transition ID.
33       * Format according to xs:ID (derived from xs:String, form XML NCName).
34       * Has to start with a letter or "_", may contain letters, digits, ".", "-", or "_", must not contain "/", ":", " ".
35       * @param id transition ID
36       */
37      void setID(String id);
38  
39      /***
40       * get transition ID.
41       * before set get returns DEFAULT_ID
42       * Format according to xs:ID (derived from xs:String, form XML NCName).
43       * Has to start with a letter or "_", may contain letters, digits, ".", "-", or "_", must not contain "/", ":", " ".
44       *
45       * @return transition ID
46       */
47      String getID();
48  
49      /***
50       * set transition description.
51       *
52       * @param description AnalysisTransition Description
53       */
54      void setDescription(String description);
55  
56      /***
57       * get transition description.
58       * before setDescription getDescription returns DEFAULT_DESCRIPTION
59       *
60       * @return description
61       */
62      String getDescription();
63  
64      GenericProperties getProperties();
65  
66      void setProperties(GenericProperties props);
67  
68  
69      /***
70       * add an read Edge.
71       *
72       * @param edge read Edge to be added
73       */
74      void addReadEdge(Edge edge);
75  
76      void removeReadEdge(int i);
77  
78      /***
79       * add an input Edge.
80       *
81       * @param edge input Edge to be added
82       */
83      void addInEdge(Edge edge);
84  
85      void removeInEdge(int i);
86  
87      /***
88       * add an write Edge.
89       *
90       * @param edge write Edge to be added
91       */
92      void addWriteEdge(Edge edge);
93  
94      void removeWriteEdge(int i);
95  
96      /***
97       * add an output Edge.
98       *
99       * @param edge output Edge to be added
100      */
101     void addOutEdge(Edge edge);
102 
103     void removeOutEdge(int i);
104 
105     /***
106      * clear read Edges and add array's Edges to read Edges.
107      *
108      * @param edges array of Edges to set
109      */
110     void setReadEdges(Edge[] edges);
111 
112     /***
113      * get array of read Edges.
114      *
115      * @return read Edges
116      */
117     Edge[] getReadEdges();
118 
119     /***
120      * clear input Edges and add array's Edges to input Edges.
121      *
122      * @param edges array of Edges to set
123      */
124     void setInEdges(Edge[] edges);
125 
126     /***
127      * get array of input Edges.
128      *
129      * @return input Edges
130      */
131     Edge[] getInEdges();
132 
133     /***
134      * clear write Edges and add array's Edges to write Edges.
135      *
136      * @param edges array of Edges to set
137      */
138     void setWriteEdges(Edge[] edges);
139 
140     /***
141      * get array of write Edges.
142      *
143      * @return write Edges
144      */
145     Edge[] getWriteEdges();
146 
147     /***
148      * clear output Edges and add array's Edges to output Edges.
149      *
150      * @param edges array of output Edges to be set
151      */
152     void setOutEdges(Edge[] edges);
153 
154     /***
155      * get array of output Edges.
156      *
157      * @return output edges
158      */
159     Edge[] getOutEdges();
160 
161     /***
162      * set AnalysisTransition's Operation.
163      *
164      * @param operation Operation to be set
165      */
166     void setOperation(Operation operation);
167 
168     /***
169      * get Transitions Operation.
170      * before setOperation getOperation returns DEFAULT_OPERATION
171      *
172      * @return operation Operation of the AnalysisTransition
173      */
174     Operation getOperation();
175 
176     /***
177      * set AnalysisTransition's condition.
178      *
179      * @param conditions condition to be set
180      */
181     void setConditions(String[] conditions);
182 
183     void addCondition(String condition);
184 
185     void removeCondition(int i);
186 
187     /***
188      * get AnalysisTransition's condition.
189      * before setCondition getCondition returnd DEFAULT_CONDITION
190      *
191      * @return condition condition of the AnalysisTransition
192      */
193     String[] getConditions();
194 
195 
196     // advanced methods that make life easier
197 
198     /***
199      * set AnalysisTransition's status.
200      *
201      * @param status Status can be STATUS_IDLE, STATUS_ENABLED,
202      *               STATUS_TRIGGERED, STATUS_FIRING
203      */
204     void setStatus(int status);
205 
206     /***
207      * get status of the AnalysisTransition.
208      * before setStatus getStatus returns DEFAULT_STATUS
209      *
210      * @return status status of AnalysisTransition
211      */
212     int getStatus();
213 
214     /***
215      * remove read edge by place ID.
216      *
217      * @param placeID Place ID of Edge to remove
218      */
219     void removeReadEdge(String placeID);
220 
221     /***
222      * remove input edge by place ID.
223      *
224      * @param placeID Place ID of Edge to remove
225      */
226     void removeInEdge(String placeID);
227 
228     /***
229      * remove write edge by place ID.
230      *
231      * @param placeID Place ID of Edge to remove
232      */
233     void removeWriteEdge(String placeID);
234 
235     /***
236      * remove output edge by place ID.
237      *
238      * @param placeID Place ID of Edge to remove
239      */
240     void removeOutEdge(String placeID);
241 
242     /***
243      * get read edge by place ID.
244      * if no read Edge has a Place with ID then return null
245      *
246      * @param placeID of Edge to get
247      * @return read edge
248      */
249     Edge getReadEdge(String placeID);
250 
251     /***
252      * get input edge by place ID.
253      * if no input Edge has a Place with ID then return null
254      *
255      * @param placeID of Edge to get
256      * @return input edge
257      */
258     Edge getInEdge(String placeID);
259 
260     /***
261      * get write edge by place ID.
262      * if no write Edge has a Place with ID then return null
263      *
264      * @param placeID of Edge to get
265      * @return write edge
266      */
267     Edge getWriteEdge(String placeID);
268 
269     /***
270      * get output edge by place ID.
271      * if no output Edge has a Place with ID then return null
272      *
273      * @param placeID Place identifier
274      * @return output edge
275      */
276     Edge getOutEdge(String placeID);
277 
278     int getAbstractionLevel();
279 
280     /***
281      * tests wheather transition is isEnabled
282      * @return   true if transition is isEnabled, false else
283      */
284     boolean isEnabled();
285 
286    
287 }