99 lines
2.4 KiB
Java
99 lines
2.4 KiB
Java
package com.safemobile.enums;
|
|
|
|
public enum MapType {
|
|
NONE(0),
|
|
STYLE_NORMAL(1),
|
|
SATELLITE(2),
|
|
TERRAIN(3),
|
|
HYBRID(4),
|
|
|
|
STYLE_RETRO(10),
|
|
STYLE_GRAYSCALE(11),
|
|
STYLE_NIGHT(12),
|
|
STYLE_DARK(13),
|
|
STYLE_AUBERGINE(14);
|
|
|
|
|
|
private int value;
|
|
|
|
|
|
MapType(int value) {
|
|
this.value = value;
|
|
}
|
|
|
|
|
|
/**
|
|
* Convert an integer value to the corresponding Map Type enum value
|
|
* @param x Desired value to be converted
|
|
* @return Map Type enum value that corresponds to the int value
|
|
*/
|
|
public static MapType fromInteger(int x) {
|
|
switch (x) {
|
|
case 0:
|
|
return NONE;
|
|
case 1:
|
|
return STYLE_NORMAL;
|
|
case 2:
|
|
return SATELLITE;
|
|
case 3:
|
|
return TERRAIN;
|
|
case 4:
|
|
return HYBRID;
|
|
case 10:
|
|
return STYLE_RETRO;
|
|
case 11:
|
|
return STYLE_GRAYSCALE;
|
|
case 12:
|
|
return STYLE_NIGHT;
|
|
case 13:
|
|
return STYLE_DARK;
|
|
case 14:
|
|
return STYLE_AUBERGINE;
|
|
default:
|
|
return STYLE_NORMAL;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* Convert a string value to the corresponding GPS Provider enum value
|
|
* @param mapType Desired value to be converted
|
|
* @return Map Type enum value that corresponds to the string value
|
|
*/
|
|
public static MapType fromString(String mapType) {
|
|
switch (mapType) {
|
|
case "NONE":
|
|
return NONE;
|
|
case "STYLE_NORMAL":
|
|
return STYLE_NORMAL;
|
|
case "SATELLITE":
|
|
return SATELLITE;
|
|
case "TERRAIN":
|
|
return TERRAIN;
|
|
case "HYBRID":
|
|
return HYBRID;
|
|
case "STYLE_RETRO":
|
|
return STYLE_RETRO;
|
|
case "STYLE_GRAYSCALE":
|
|
return STYLE_GRAYSCALE;
|
|
case "STYLE_NIGHT":
|
|
return STYLE_NIGHT;
|
|
case "STYLE_DARK":
|
|
return STYLE_DARK;
|
|
case "STYLE_AUBERGINE":
|
|
return STYLE_AUBERGINE;
|
|
default:
|
|
return STYLE_NORMAL;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* Get the int value of current Map Type enum instance
|
|
* @return Corresponding int value of the enum instance
|
|
*/
|
|
public int getValue() {
|
|
return this.value;
|
|
}
|
|
|
|
} |