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.completion.model;
11  
12  import java.io.Serializable;
13  
14  /***
15   * Enumeration type for field completion.
16   *
17   * @author Michael Rimov
18   * @version 1.0
19   */
20  final public class FieldCompletion implements Serializable {
21  
22      /***
23  	 * Serialization UUID.
24  	 */
25  	private static final long serialVersionUID = -3232481880443528643L;
26  
27  	/***
28       * Field completion for 'fixed' completion type.
29       */
30      public static final FieldCompletion FIXED = new FieldCompletion("Fixed");
31  
32      /***
33       * Field completion for 'wizard' completion type.
34       */
35      public static final FieldCompletion WIZARD = new FieldCompletion("Wizard");
36  
37      /***
38       * Description.
39       */
40      private final String value;
41  
42      /***
43       * Constructor that takes the description.
44       *
45       * @param description String
46       */
47      protected FieldCompletion(String description) {
48          super();
49          value = description;
50      }
51  
52      /***
53       * Indicates whether some other object is "equal to" this one.
54       *
55       * @param obj the reference object with which to compare.
56       * @return <code>true</code> if this object is the same as the obj
57       *         argument; <code>false</code> otherwise.
58       */
59      public boolean equals(Object obj) {
60          if (obj == null) {
61              return false;
62          }
63  
64          if (obj.getClass().equals(this.getClass())) {
65              return this.value.equals(((FieldCompletion) obj).value);
66          } else {
67              return false;
68          }
69      }
70  
71      /***
72       * Returns a hash code value for the object.
73       *
74       * @return a hash code value for this object.
75       */
76      public int hashCode() {
77          return value.hashCode();
78      }
79  
80      /***
81       * Returns a string representation of the object.
82       *
83       * @return a string representation of the object.
84       */
85      public String toString() {
86          return value;
87      }
88  
89  
90  }