forked from mit-cml/appinventor-sources
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
appinventor/components/src/com/google/appinventor/components/common/TransportMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// -*- mode: java; c-basic-offset: 2; -*- | ||
// Copyright 2020 MIT, All rights reserved | ||
// Released under the Apache License, Version 2.0 | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
package com.google.appinventor.components.common; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* Defines a TransportMethod type used by the Navigation component. | ||
*/ | ||
public enum TransportMethod implements OptionList<String> { | ||
Foot("foot-walking"), | ||
Car("driving-car"), | ||
Bicycle("cycling-regular"), | ||
Wheelchair("wheelchair"); | ||
|
||
private String value; | ||
|
||
TransportMethod(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String toUnderlyingValue() { | ||
return value; | ||
} | ||
|
||
private static final Map<String, TransportMethod> lookup = new HashMap<>(); | ||
|
||
static { | ||
for(TransportMethod method : TransportMethod.values()) { | ||
lookup.put(method.toUnderlyingValue(), method); | ||
} | ||
} | ||
|
||
public static TransportMethod fromUnderlyingValue(String method) { | ||
return lookup.get(method); | ||
} | ||
} |