1
2
3
4
5
6
7
8 package net.kwfgrid.gworkflowdl.structure;
9
10
11 /***
12 * interface for Java intern representation of Place.
13 */
14 public interface Place extends Owls{
15
16 /***
17 * default initial parameters.
18 */
19 int INFINITY = Integer.MAX_VALUE;
20 int DEFAULT_CAPACITY = Place.INFINITY;
21 String DEFAULT_ID = null;
22 int DEFAULT_TOKEN_NUMBER = 0;
23 String DEFAULT_DESCRIPTION = null;
24 String DEFAULT_TOKENCLASS_TYPE = null;
25
26
27 /***
28 * set Place ID.
29 * Format according to xs:ID (derived from xs:String, form XML NCName).
30 * Has to start with a letter or "_", may contain letters, digits, ".", "-", or "_", must not contain "/", ":", " ".
31 * @param id identifier to be set.
32 */
33 void setID(String id);
34
35 /***
36 * get Place ID.
37 * before setID(...) getID returns null
38 * Format according to xs:ID (derived from xs:String, form XML NCName).
39 * Has to start with a letter or "_", may contain letters, digits, ".", "-", or "_", must not contain "/", ":", " ".
40 * @return place ID
41 */
42 String getID();
43
44 /***
45 * set token's type
46 * @param type
47 */
48 void setTokenType(String type);
49
50 /***
51 *
52 * @return token's type
53 */
54 String getTokenType();
55
56 /***
57 * test for emptyness.
58 *
59 * @return true in case place is empty
60 */
61 boolean isEmpty();
62
63 /***
64 * add a token to place.
65 * in case the capacity would be exceeded an exception is thrown
66 *
67 * @param token to be added
68 */
69 void addToken(Token token) throws CapacityException;
70
71
72 /***
73 * Set all tokens.
74 * Old tokens will be removed.
75 * @param tokens Tokens as token array.
76 * @throws CapacityException If number of tokens is exceedes the capacity.
77 */
78 void setTokens(Token[] tokens) throws CapacityException;
79
80 /***
81 * get tokens as array.
82 * the order of tokens in the returned array is the order
83 * the tokens are inserted
84 *
85 * @return array of tokens
86 */
87 Token[] getTokens();
88
89 /***
90 * remove a token.
91 * in case token is not in the place container nothing happens
92 *
93 * @param token to be removed
94 */
95 void removeToken(Token token);
96
97 /***
98 * Remove the i-th token.
99 * @param i the index of the token to remove.
100 */
101 void removeToken(int i);
102
103 /***
104 * Remove all tokens.
105 */
106 void removeAllTokens();
107
108 /***
109 * Set token capacity of place.
110 * an exception is thrown in case there are more tokens
111 * in the Place container than the new capacity
112 *
113 * @param capacity maximum number of tokens
114 * @throws CapacityException
115 */
116 void setCapacity(int capacity) throws CapacityException;
117
118 /***
119 * Get token capacity of place.
120 *
121 * @return capacity maximum number of tokens
122 */
123 int getCapacity();
124
125 /***
126 * Get number of tokens on this place.
127 * @return token number
128 */
129 int getTokenNumber();
130
131
132
133 /***
134 *
135 * @return place's description
136 */
137 String getDescription();
138
139 /***
140 *
141 * @param d place's description
142 */
143 void setDescription(String d);
144
145 /***
146 *
147 * @return place's properties
148 */
149 GenericProperties getProperties();
150
151 /***
152 *
153 * @param props place's new properties
154 */
155 void setProperties(GenericProperties props);
156
157 }