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