コード例 #1
0
 private static Direction getDirection(Direction direction, Rotation rotation) {
   Direction result;
   final int value = direction.getValue() + rotation.getValue();
   if (value < NORTH.getValue()) {
     result = WEST;
   } else if (value > WEST.getValue()) {
     result = NORTH;
   } else {
     result = lookup.get(value);
   }
   return result;
 }
コード例 #2
0
 static {
   for (Direction direction : Direction.values()) {
     lookup.put(direction.getValue(), direction);
   }
 }