View Javadoc

1   /* ===================================================================
2    * Copyright 2002-05 SRI International.
3    * Released under the MOZILLA PUBLIC LICENSE Version 1.1
4    * which can be obtained at http://www.mozilla.org/MPL/MPL-1.1.html
5    * This software is distributed on an "AS IS"
6    * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
7    * See the License for the specific language governing rights and
8    * limitations under the License.
9    * =================================================================== */
10  package com.sri.emo.wizard.creation.model;
11  
12  /***
13   * Enumeration type for field completion.
14   *
15   * @author Michael Rimov
16   * @version 1.0
17   */
18  final public class FieldCompletion {
19  
20      /***
21       * Field completion for 'fixed' completion type.
22       */
23      public static final FieldCompletion NOT_INCLUDED = new FieldCompletion("Fixed");
24  
25      /***
26       * Field completion for 'wizard' completion type.
27       */
28      public static final FieldCompletion WIZARD = new FieldCompletion("Wizard");
29  
30      /***
31       * Description.
32       */
33      private final String value;
34  
35      /***
36       * Constructor that takes the description.
37       *
38       * @param description String
39       */
40      protected FieldCompletion(String description) {
41          super();
42          value = description;
43      }
44  
45      /***
46       * Indicates whether some other object is "equal to" this one.
47       *
48       * @param obj the reference object with which to compare.
49       * @return <code>true</code> if this object is the same as the obj
50       *         argument; <code>false</code> otherwise.
51       */
52      public boolean equals(Object obj) {
53          if (obj == null) {
54              return false;
55          }
56  
57          if (obj.getClass().equals(this.getClass())) {
58              return this.value.equals(((FieldCompletion) obj).value);
59          } else {
60              return false;
61          }
62      }
63  
64      /***
65       * Returns a hash code value for the object.
66       *
67       * @return a hash code value for this object.
68       */
69      public int hashCode() {
70          return value.hashCode();
71      }
72  
73      /***
74       * Returns a string representation of the object.
75       *
76       * @return a string representation of the object.
77       */
78      public String toString() {
79          return value;
80      }
81  
82  
83  }