View Javadoc

1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 0.9.4.3</a>, using an XML
4    * Schema.
5    * $Id: If.java,v 1.13 2007/01/04 16:26:26 clq2 Exp $
6    */
7   
8   package org.astrogrid.workflow.beans.v1;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
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   * An if statement
26   * 
27   * @version $Revision: 1.13 $ $Date: 2007/01/04 16:26:26 $
28   */
29  public class If extends org.astrogrid.workflow.beans.v1.AbstractActivity 
30  implements java.io.Serializable
31  {
32  
33  
34        //--------------------------/
35       //- Class/Member Variables -/
36      //--------------------------/
37  
38      /***
39       * the condition for the if: an expression (in ${..}) that
40       * evaluates to a boolean
41       */
42      private java.lang.String _test;
43  
44      /***
45       * Branch to take when if condition evaluates to true
46       */
47      private org.astrogrid.workflow.beans.v1.Then _then;
48  
49      /***
50       * Branch to take when if condition evaluates to false
51       */
52      private org.astrogrid.workflow.beans.v1.Else _else;
53  
54  
55        //----------------/
56       //- Constructors -/
57      //----------------/
58  
59      public If() {
60          super();
61      } //-- org.astrogrid.workflow.beans.v1.If()
62  
63  
64        //-----------/
65       //- Methods -/
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 If) {
82          
83              If temp = (If)obj;
84              if (this._test != null) {
85                  if (temp._test == null) return false;
86                  else if (!(this._test.equals(temp._test))) 
87                      return false;
88              }
89              else if (temp._test != null)
90                  return false;
91              if (this._then != null) {
92                  if (temp._then == null) return false;
93                  else if (!(this._then.equals(temp._then))) 
94                      return false;
95              }
96              else if (temp._then != null)
97                  return false;
98              if (this._else != null) {
99                  if (temp._else == null) return false;
100                 else if (!(this._else.equals(temp._else))) 
101                     return false;
102             }
103             else if (temp._else != null)
104                 return false;
105             return true;
106         }
107         return false;
108     } //-- boolean equals(java.lang.Object) 
109 
110     /***
111      * Returns the value of field 'else'. The field 'else' has the
112      * following description: Branch to take when if condition
113      * evaluates to false
114      * 
115      * @return the value of field 'else'.
116      */
117     public org.astrogrid.workflow.beans.v1.Else getElse()
118     {
119         return this._else;
120     } //-- org.astrogrid.workflow.beans.v1.Else getElse() 
121 
122     /***
123      * Returns the value of field 'test'. The field 'test' has the
124      * following description: the condition for the if: an
125      * expression (in ${..}) that evaluates to a boolean
126      * 
127      * @return the value of field 'test'.
128      */
129     public java.lang.String getTest()
130     {
131         return this._test;
132     } //-- java.lang.String getTest() 
133 
134     /***
135      * Returns the value of field 'then'. The field 'then' has the
136      * following description: Branch to take when if condition
137      * evaluates to true
138      * 
139      * @return the value of field 'then'.
140      */
141     public org.astrogrid.workflow.beans.v1.Then getThen()
142     {
143         return this._then;
144     } //-- org.astrogrid.workflow.beans.v1.Then getThen() 
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     } //-- boolean isValid() 
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     } //-- void marshal(java.io.Writer) 
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     } //-- void marshal(org.xml.sax.ContentHandler) 
183 
184     /***
185      * Sets the value of field 'else'. The field 'else' has the
186      * following description: Branch to take when if condition
187      * evaluates to false
188      * 
189      * @param _else
190      * @param else the value of field 'else'.
191      */
192     public void setElse(org.astrogrid.workflow.beans.v1.Else _else)
193     {
194         this._else = _else;
195     } //-- void setElse(org.astrogrid.workflow.beans.v1.Else) 
196 
197     /***
198      * Sets the value of field 'test'. The field 'test' has the
199      * following description: the condition for the if: an
200      * expression (in ${..}) that evaluates to a boolean
201      * 
202      * @param test the value of field 'test'.
203      */
204     public void setTest(java.lang.String test)
205     {
206         this._test = test;
207     } //-- void setTest(java.lang.String) 
208 
209     /***
210      * Sets the value of field 'then'. The field 'then' has the
211      * following description: Branch to take when if condition
212      * evaluates to true
213      * 
214      * @param then the value of field 'then'.
215      */
216     public void setThen(org.astrogrid.workflow.beans.v1.Then then)
217     {
218         this._then = then;
219     } //-- void setThen(org.astrogrid.workflow.beans.v1.Then) 
220 
221     /***
222      * Method unmarshalIf
223      * 
224      * @param reader
225      */
226     public static org.astrogrid.workflow.beans.v1.If unmarshalIf(java.io.Reader reader)
227         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
228     {
229         return (org.astrogrid.workflow.beans.v1.If) Unmarshaller.unmarshal(org.astrogrid.workflow.beans.v1.If.class, reader);
230     } //-- org.astrogrid.workflow.beans.v1.If unmarshalIf(java.io.Reader) 
231 
232     /***
233      * Method validate
234      */
235     public void validate()
236         throws org.exolab.castor.xml.ValidationException
237     {
238         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
239         validator.validate(this);
240     } //-- void validate() 
241 
242 }