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 while loop construct
26 *
27 * @version $Revision: 1.13 $ $Date: 2007/01/04 16:26:26 $
28 */
29 public class While extends org.astrogrid.workflow.beans.v1.AbstractActivity
30 implements java.io.Serializable
31 {
32
33
34
35
36
37
38 /***
39 * the condition for the loop: an expression (in ${..}) that
40 * evaluates to a boolean
41 */
42 private java.lang.String _test;
43
44 /***
45 * Head of the substitution group
46 */
47 private org.astrogrid.workflow.beans.v1.AbstractActivity _activity;
48
49
50
51
52
53
54 public While() {
55 super();
56 }
57
58
59
60
61
62
63 /***
64 * Note: hashCode() has not been overriden
65 *
66 * @param obj
67 */
68 public boolean equals(java.lang.Object obj)
69 {
70 if ( this == obj )
71 return true;
72
73 if (super.equals(obj)==false)
74 return false;
75
76 if (obj instanceof While) {
77
78 While temp = (While)obj;
79 if (this._test != null) {
80 if (temp._test == null) return false;
81 else if (!(this._test.equals(temp._test)))
82 return false;
83 }
84 else if (temp._test != null)
85 return false;
86 if (this._activity != null) {
87 if (temp._activity == null) return false;
88 else if (!(this._activity.equals(temp._activity)))
89 return false;
90 }
91 else if (temp._activity != null)
92 return false;
93 return true;
94 }
95 return false;
96 }
97
98 /***
99 * Returns the value of field 'activity'. The field 'activity'
100 * has the following description: Head of the substitution
101 * group
102 *
103 * @return the value of field 'activity'.
104 */
105 public org.astrogrid.workflow.beans.v1.AbstractActivity getActivity()
106 {
107 return this._activity;
108 }
109
110 /***
111 * Returns the value of field 'test'. The field 'test' has the
112 * following description: the condition for the loop: an
113 * expression (in ${..}) that evaluates to a boolean
114 *
115 * @return the value of field 'test'.
116 */
117 public java.lang.String getTest()
118 {
119 return this._test;
120 }
121
122 /***
123 * Method isValid
124 */
125 public boolean isValid()
126 {
127 try {
128 validate();
129 }
130 catch (org.exolab.castor.xml.ValidationException vex) {
131 return false;
132 }
133 return true;
134 }
135
136 /***
137 * Method marshal
138 *
139 * @param out
140 */
141 public void marshal(java.io.Writer out)
142 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
143 {
144
145 Marshaller.marshal(this, out);
146 }
147
148 /***
149 * Method marshal
150 *
151 * @param handler
152 */
153 public void marshal(org.xml.sax.ContentHandler handler)
154 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
155 {
156
157 Marshaller.marshal(this, handler);
158 }
159
160 /***
161 * Sets the value of field 'activity'. The field 'activity' has
162 * the following description: Head of the substitution group
163 *
164 * @param activity the value of field 'activity'.
165 */
166 public void setActivity(org.astrogrid.workflow.beans.v1.AbstractActivity activity)
167 {
168 this._activity = activity;
169 }
170
171 /***
172 * Sets the value of field 'test'. The field 'test' has the
173 * following description: the condition for the loop: an
174 * expression (in ${..}) that evaluates to a boolean
175 *
176 * @param test the value of field 'test'.
177 */
178 public void setTest(java.lang.String test)
179 {
180 this._test = test;
181 }
182
183 /***
184 * Method unmarshalWhile
185 *
186 * @param reader
187 */
188 public static org.astrogrid.workflow.beans.v1.While unmarshalWhile(java.io.Reader reader)
189 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
190 {
191 return (org.astrogrid.workflow.beans.v1.While) Unmarshaller.unmarshal(org.astrogrid.workflow.beans.v1.While.class, reader);
192 }
193
194 /***
195 * Method validate
196 */
197 public void validate()
198 throws org.exolab.castor.xml.ValidationException
199 {
200 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
201 validator.validate(this);
202 }
203
204 }