Skip to content

Commit

Permalink
Add TransportMethod def
Browse files Browse the repository at this point in the history
  • Loading branch information
BeksOmega committed Jul 28, 2020
1 parent 736fd0c commit 6d0075e
Showing 1 changed file with 41 additions and 0 deletions.
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);
}
}

0 comments on commit 6d0075e

Please sign in to comment.