View Javadoc

1   package cz.cuni.amis.pogamut.sposh.elements;
2   
3   /**
4    * This class is one of possible values of variable in the Yaposh plan. When you
5    * specify the value
6    */
7   public final class EnumValue {
8   
9       private final String name;
10  
11      public EnumValue(String name) {
12          this.name = name;
13      }
14  
15      public String getName() {
16          return name;
17      }
18  
19      @Override
20      public boolean equals(Object obj) {
21          if (obj == null) {
22              return false;
23          }
24          if (getClass() != obj.getClass()) {
25              return false;
26          }
27          final EnumValue other = (EnumValue) obj;
28          if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
29              return false;
30          }
31          return true;
32      }
33  
34      @Override
35      public int hashCode() {
36          int hash = 7;
37          hash = 59 * hash + (this.name != null ? this.name.hashCode() : 0);
38          return hash;
39      }
40  
41      /**
42       * Get fully qualified name of the enum.
43       */
44      public String getEnumFQN() {
45          int lastSeparatorIndex = name.lastIndexOf('.');
46          assert lastSeparatorIndex != -1;
47          return name.substring(0, lastSeparatorIndex);
48      }
49  
50      /**
51       * Get name of the enum value, e.g. java.EnumTest.VALUE has simple name
52       * VALUE.
53       */
54      public String getSimpleName() {
55          return name.substring(name.lastIndexOf('.') + 1);
56      }
57  }