KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mdarad > framework > expr > OperatorType


1 /*
2     Mdarad-Toolobox is a collection of tools for Architected RAD
3     (Rapid Application Development) based on an MDA approach.
4     The toolbox contains frameworks and generators for many environments
5     (JAVA, J2EE, Hibernate, .NET, C++, etc.) which allow to generate
6     applications from a design Model
7     Copyright (C) 2004-2005 Elapse Technologies Inc.
8
9     This library is free software; you can redistribute it and/or
10     modify it under the terms of the GNU General Public
11     License as published by the Free Software Foundation; either
12     version 2.1 of the License, or (at your option) any later version.
13
14     This library is distributed in the hope that it will be useful,
15     but WITHOUT ANY WARRANTY; without even the implied warranty of
16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17     General Public License for more details.
18
19     You should have received a copy of the GNU General Public
20     License along with this library; if not, write to the Free Software
21     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */

23 package org.mdarad.framework.expr;
24
25 import org.mdarad.framework.enumeration.AllowableValue;
26
27 /**
28  * This class is an enumeration value class that represents an
29  * operator type. To get more informations about the
30  * operator types, see the {@link OperatorTypes OperatorTypes}
31  * @author Philippe Brouillette
32  * @version 1.0
33  */

34 public class OperatorType extends AllowableValue {
35
36     /**
37      * Constructor that takes the value and the label of the
38      * operator type.
39      * @param value value associated to the operator type
40      * @param label label of the opeator type
41      */

42     public OperatorType(String JavaDoc value, String JavaDoc label) {
43         super(value, label);
44     }
45     
46     /**
47      * Indicates whether some AllowableValue object is equals to this one
48      * @param obj Object that must be an instance of AllowableValue
49      * @return true if this object is the same as the obj argument; false otherwise.
50      * @exception IllegalArgumentException Thown if the object is not of type AllowableValue
51      * @see java.lang.Object#equals(java.lang.Object)
52      */

53     public boolean equals(Object JavaDoc obj) {
54         if (!(obj instanceof OperatorType)) {
55             throw new IllegalArgumentException JavaDoc("The object to be compared " +
56                 "is of the wrong type");
57         }
58         
59         OperatorType operObj = (OperatorType) obj;
60         return this.getValue().equals(operObj.getValue());
61     }
62 }
Popular Tags