Skip to content

Commit

Permalink
remove state.country as unused and always null
Browse files Browse the repository at this point in the history
  • Loading branch information
karussell committed Jan 6, 2024
1 parent 43079c4 commit e7dacb8
Showing 1 changed file with 78 additions and 84 deletions.
162 changes: 78 additions & 84 deletions core/src/main/java/com/graphhopper/routing/ev/State.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,43 @@
* The country subdivision is stored in this EncodedValue. E.g. US-CA is the enum US_CA.
*/
public enum State {
MISSING("-", Country.MISSING),
MISSING("-"),

// Australia
AU_ACT("AU-ACT", AUS),
AU_NSW("AU-NSW", AUS),
AU_NT("AU-NT", AUS),
AU_QLD("AU-QLD", AUS),
AU_SA("AU-SA", AUS),
AU_TAS("AU-TAS", AUS),
AU_VIC("AU-VIC", AUS),
AU_WA("AU-WA", AUS),
AU_ACT("AU-ACT"),
AU_NSW("AU-NSW"),
AU_NT("AU-NT"),
AU_QLD("AU-QLD"),
AU_SA("AU-SA"),
AU_TAS("AU-TAS"),
AU_VIC("AU-VIC"),
AU_WA("AU-WA"),

// the sub regions of Belgium have no data in countries.geojson
// BE_BRU("BE-BRU", BEL),
// BE_VLG("BE-VLG", BEL),
// BE_WAL("BE-WAL", BEL),

// Canada
CA_AB("CA-AB", CAN),
CA_BC("CA-BC", CAN),
CA_MB("CA-MB", CAN),
CA_NB("CA-NB", CAN),
CA_NL("CA-NL", CAN),
CA_NS("CA-NS", CAN),
CA_NT("CA-NT", CAN),
CA_NU("CA-NU", CAN),
CA_ON("CA-ON", CAN),
CA_PE("CA-PE", CAN),
CA_QC("CA-QC", CAN),
CA_SK("CA-SK", CAN),
CA_YT("CA-YT", CAN),
CA_AB("CA-AB"),
CA_BC("CA-BC"),
CA_MB("CA-MB"),
CA_NB("CA-NB"),
CA_NL("CA-NL"),
CA_NS("CA-NS"),
CA_NT("CA-NT"),
CA_NU("CA-NU"),
CA_ON("CA-ON"),
CA_PE("CA-PE"),
CA_QC("CA-QC"),
CA_SK("CA-SK"),
CA_YT("CA-YT"),

// Federated States of Micronesia
FM_KSA("FM-KSA", FSM),
FM_PNI("FM-PNI", FSM),
FM_TRK("FM-TRK", FSM),
FM_YAP("FM-YAP", FSM),
FM_KSA("FM-KSA"),
FM_PNI("FM-PNI"),
FM_TRK("FM-TRK"),
FM_YAP("FM-YAP"),

// United Kingdom
// TODO currently it isn't supported when the states list does not cover the entire country
Expand All @@ -56,69 +56,67 @@ public enum State {
// NL_BQ3("NL-BQ3", NLD),

// United States
US_AL("US-AL", USA),
US_AK("US-AK", USA),
US_AZ("US-AZ", USA),
US_AR("US-AR", USA),
US_CA("US-CA", USA),
US_CO("US-CO", USA),
US_CT("US-CT", USA),
US_DE("US-DE", USA),
US_DC("US-DC", USA), // is a federal district not a state
US_FL("US-FL", USA),
US_GA("US-GA", USA),
US_HI("US-HI", USA),
US_ID("US-ID", USA),
US_IL("US-IL", USA),
US_IN("US-IN", USA),
US_IA("US-IA", USA),
US_KS("US-KS", USA),
US_KY("US-KY", USA),
US_LA("US-LA", USA),
US_ME("US-ME", USA),
US_MD("US-MD", USA),
US_MA("US-MA", USA),
US_MI("US-MI", USA),
US_MN("US-MN", USA),
US_MS("US-MS", USA),
US_MO("US-MO", USA),
US_MT("US-MT", USA),
US_NE("US-NE", USA),
US_NV("US-NV", USA),
US_NH("US-NH", USA),
US_NJ("US-NJ", USA),
US_NM("US-NM", USA),
US_NY("US-NY", USA),
US_NC("US-NC", USA),
US_ND("US-ND", USA),
US_OH("US-OH", USA),
US_OK("US-OK", USA),
US_OR("US-OR", USA),
US_PA("US-PA", USA),
US_RI("US-RI", USA),
US_SC("US-SC", USA),
US_SD("US-SD", USA),
US_TN("US-TN", USA),
US_TX("US-TX", USA),
US_UT("US-UT", USA),
US_VT("US-VT", USA),
US_VA("US-VA", USA),
US_WA("US-WA", USA),
US_WV("US-WV", USA),
US_WI("US-WI", USA),
US_WY("US-WY", USA);
US_AL("US-AL"),
US_AK("US-AK"),
US_AZ("US-AZ"),
US_AR("US-AR"),
US_CA("US-CA"),
US_CO("US-CO"),
US_CT("US-CT"),
US_DE("US-DE"),
US_DC("US-DC"), // is a federal district not a state
US_FL("US-FL"),
US_GA("US-GA"),
US_HI("US-HI"),
US_ID("US-ID"),
US_IL("US-IL"),
US_IN("US-IN"),
US_IA("US-IA"),
US_KS("US-KS"),
US_KY("US-KY"),
US_LA("US-LA"),
US_ME("US-ME"),
US_MD("US-MD"),
US_MA("US-MA"),
US_MI("US-MI"),
US_MN("US-MN"),
US_MS("US-MS"),
US_MO("US-MO"),
US_MT("US-MT"),
US_NE("US-NE"),
US_NV("US-NV"),
US_NH("US-NH"),
US_NJ("US-NJ"),
US_NM("US-NM"),
US_NY("US-NY"),
US_NC("US-NC"),
US_ND("US-ND"),
US_OH("US-OH"),
US_OK("US-OK"),
US_OR("US-OR"),
US_PA("US-PA"),
US_RI("US-RI"),
US_SC("US-SC"),
US_SD("US-SD"),
US_TN("US-TN"),
US_TX("US-TX"),
US_UT("US-UT"),
US_VT("US-VT"),
US_VA("US-VA"),
US_WA("US-WA"),
US_WV("US-WV"),
US_WI("US-WI"),
US_WY("US-WY");

public static final String KEY = "state", ISO_3166_2 = "ISO3166-2";

private final Country country;
private final String stateCode;

/**
* @param isoCodeOfSubdivision should be ISO 3166-2 but with hyphen like US-CA
*/
State(String isoCodeOfSubdivision, Country country) {
State(String isoCodeOfSubdivision) {
this.stateCode = isoCodeOfSubdivision;
this.country = country;
}

/**
Expand All @@ -139,10 +137,6 @@ public String getStateCode() {
return stateCode;
}

public Country getCountry() {
return country;
}

@Override
public String toString() {
return stateCode;
Expand Down

0 comments on commit e7dacb8

Please sign in to comment.