View Javadoc
1   package eu.simuline.relana.model;
2   
3   /**
4    * Represents a Deficiency. 
5    *
6    *
7    * Created: Thu Apr 14 19:38:02 2005
8    *
9    * @author <a href="mailto:ernst.reissner@simuline.eu">Ernst Reissner</a>
10   * @version 1.0
11   */
12  public final class Deficiency {
13  
14      public static final Deficiency UNDET = new Deficiency("UNDET");
15  
16      /* -------------------------------------------------------------------- *
17       * attributes.                                                          *
18       * -------------------------------------------------------------------- */
19  
20      // must be final to guarantee a valid {@link #hashCode()}. 
21      private final String name;
22  
23      /* -------------------------------------------------------------------- *
24       * constructors.                                                        *
25       * -------------------------------------------------------------------- */
26  
27      public Deficiency(String name) {
28  	this.name = name;
29      }
30  
31      /* -------------------------------------------------------------------- *
32       * methods.                                                             *
33       * -------------------------------------------------------------------- */
34  
35      public String getName() {
36  	return this.name;
37      }
38  
39      public String toString() {
40  	return this.name;
41  	//return "\n<Deficiency>" + this.name + "</Deficiency>";
42      }
43  
44      public boolean equals(Object obj) {
45  	if (!(obj instanceof Deficiency)) {
46  	    return false;
47  	}
48  	return getName().equals(((Deficiency) obj).getName());
49      }
50  
51      // HashCode is immutable. 
52      public int hashCode() {
53  	return getName().hashCode();
54      }
55  } // Deficiency