1
2
3
4
5
6
7
8 package org.astrogrid.workflow.beans.v1;
9
10
11
12
13
14 import java.io.IOException;
15 import java.io.Reader;
16 import java.io.Serializable;
17 import java.io.Writer;
18 import org.exolab.castor.xml.MarshalException;
19 import org.exolab.castor.xml.Marshaller;
20 import org.exolab.castor.xml.Unmarshaller;
21 import org.exolab.castor.xml.ValidationException;
22 import org.xml.sax.ContentHandler;
23
24 /***
25 * A for loop construct - iterated over a sequence of items
26 *
27 * @version $Revision: 1.13 $ $Date: 2007/01/04 16:26:26 $
28 */
29 public class For extends org.astrogrid.workflow.beans.v1.AbstractActivity
30 implements java.io.Serializable
31 {
32
33
34
35
36
37
38 /***
39 * the name of the loop variable
40 */
41 private java.lang.String _var;
42
43 /***
44 * A sequence or iterator of items- the loop variable will be
45 * assigned to each in turn, and then loop body executed
46 */
47 private java.lang.String _items;
48
49 /***
50 * Head of the substitution group
51 */
52 private org.astrogrid.workflow.beans.v1.AbstractActivity _activity;
53
54
55
56
57
58
59 public For() {
60 super();
61 }
62
63
64
65
66
67
68 /***
69 * Note: hashCode() has not been overriden
70 *
71 * @param obj
72 */
73 public boolean equals(java.lang.Object obj)
74 {
75 if ( this == obj )
76 return true;
77
78 if (super.equals(obj)==false)
79 return false;
80
81 if (obj instanceof For) {
82
83 For temp = (For)obj;
84 if (this._var != null) {
85 if (temp._var == null) return false;
86 else if (!(this._var.equals(temp._var)))
87 return false;
88 }
89 else if (temp._var != null)
90 return false;
91 if (this._items != null) {
92 if (temp._items == null) return false;
93 else if (!(this._items.equals(temp._items)))
94 return false;
95 }
96 else if (temp._items != null)
97 return false;
98 if (this._activity != null) {
99 if (temp._activity == null) return false;
100 else if (!(this._activity.equals(temp._activity)))
101 return false;
102 }
103 else if (temp._activity != null)
104 return false;
105 return true;
106 }
107 return false;
108 }
109
110 /***
111 * Returns the value of field 'activity'. The field 'activity'
112 * has the following description: Head of the substitution
113 * group
114 *
115 * @return the value of field 'activity'.
116 */
117 public org.astrogrid.workflow.beans.v1.AbstractActivity getActivity()
118 {
119 return this._activity;
120 }
121
122 /***
123 * Returns the value of field 'items'. The field 'items' has
124 * the following description: A sequence or iterator of items-
125 * the loop variable will be assigned to each in turn, and then
126 * loop body executed
127 *
128 * @return the value of field 'items'.
129 */
130 public java.lang.String getItems()
131 {
132 return this._items;
133 }
134
135 /***
136 * Returns the value of field 'var'. The field 'var' has the
137 * following description: the name of the loop variable
138 *
139 * @return the value of field 'var'.
140 */
141 public java.lang.String getVar()
142 {
143 return this._var;
144 }
145
146 /***
147 * Method isValid
148 */
149 public boolean isValid()
150 {
151 try {
152 validate();
153 }
154 catch (org.exolab.castor.xml.ValidationException vex) {
155 return false;
156 }
157 return true;
158 }
159
160 /***
161 * Method marshal
162 *
163 * @param out
164 */
165 public void marshal(java.io.Writer out)
166 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
167 {
168
169 Marshaller.marshal(this, out);
170 }
171
172 /***
173 * Method marshal
174 *
175 * @param handler
176 */
177 public void marshal(org.xml.sax.ContentHandler handler)
178 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
179 {
180
181 Marshaller.marshal(this, handler);
182 }
183
184 /***
185 * Sets the value of field 'activity'. The field 'activity' has
186 * the following description: Head of the substitution group
187 *
188 * @param activity the value of field 'activity'.
189 */
190 public void setActivity(org.astrogrid.workflow.beans.v1.AbstractActivity activity)
191 {
192 this._activity = activity;
193 }
194
195 /***
196 * Sets the value of field 'items'. The field 'items' has the
197 * following description: A sequence or iterator of items- the
198 * loop variable will be assigned to each in turn, and then
199 * loop body executed
200 *
201 * @param items the value of field 'items'.
202 */
203 public void setItems(java.lang.String items)
204 {
205 this._items = items;
206 }
207
208 /***
209 * Sets the value of field 'var'. The field 'var' has the
210 * following description: the name of the loop variable
211 *
212 * @param var the value of field 'var'.
213 */
214 public void setVar(java.lang.String var)
215 {
216 this._var = var;
217 }
218
219 /***
220 * Method unmarshalFor
221 *
222 * @param reader
223 */
224 public static org.astrogrid.workflow.beans.v1.For unmarshalFor(java.io.Reader reader)
225 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
226 {
227 return (org.astrogrid.workflow.beans.v1.For) Unmarshaller.unmarshal(org.astrogrid.workflow.beans.v1.For.class, reader);
228 }
229
230 /***
231 * Method validate
232 */
233 public void validate()
234 throws org.exolab.castor.xml.ValidationException
235 {
236 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
237 validator.validate(this);
238 }
239
240 }