Exemplo n.º 1
0
 public static Orientation fromIndex(int index) {
   Orientation[] values = Orientation.values();
   if (index < 0 || index >= values.length) {
     throw new IndexOutOfBoundsException();
   }
   return values[index];
 }
Exemplo n.º 2
0
 /** @param name The new name of the units. Defaults to DEFAULT is there is no match. */
 public void setOrientation(String name) {
   for (Orientation orientation : Orientation.values()) {
     if (orientation.getName().equals(name)) {
       this.orientation = orientation;
       return;
     }
   }
   this.orientation = Orientation.DEFAULT;
 }