BowlerKernel
DrivingType.java
Go to the documentation of this file.
1 package com.neuronrobotics.sdk.addons.kinematics;
2 
3 import java.util.HashMap;
4 import java.util.Map;
5 import java.util.NoSuchElementException;
6 
7 // TODO: Auto-generated Javadoc
11 public enum DrivingType {
12 
14  NONE("none"),
15 
17  WALKING("walking"),
18 
20  DRIVING("driving");
21 
23  private final String name;
24 
26  private static final Map<String, DrivingType> map =
27  new HashMap<String, DrivingType>();
28 
29  static {
30  for (DrivingType type : DrivingType.values()) {
31  map.put(type.name, type);
32  }
33  }
34 
40  private DrivingType(String name) {
41  this.name = name;
42  }
43 
49  public String getName() {
50  return name;
51  }
52 
59  public static DrivingType fromString(String name) {
60  if (map.containsKey(name)) {
61  return map.get(name);
62  }
63  return NONE;
64  }
65 
66 
67  /* (non-Javadoc)
68  * @see java.lang.Enum#toString()
69  */
70  @Override
71  public String toString(){
72  return name;
73  }
74 }