|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Object java.lang.Enum<StreetClassification> ps4.StreetClassification
public enum StreetClassification
A StreetClassification describes a street category. It is an enumeration type, which you can tell by the class declaration public enum StreetClassification. There are a handful of values the type may hold, and the set of options is fixed at compile time.
Example uses:
StreetClassification myType = StreetClassification.LOCAL_ROAD; // ... if (myType == StreetClassification.UNKNOWN) { // ... }
Notice that you may reference the constant values as you would with any other
static variable, e.g. ClassName.STATIC_FIELD_NAME. Also, you may use the
==
operator to check for equality, since there is only one copy
of each object.
The ordering given by the compareTo
method of this class is
consistent with equals, and gives the following ordering: PRIM_HWY, SEC_HWY,
LOCAL_ROAD, UNKNOWN.
Enum Constant Summary | |
---|---|
LOCAL_ROAD
Classification indicating a local road. |
|
PRIM_HWY
Classification indicating a primary highway. |
|
SEC_HWY
Classification indicating a secondary highway. |
|
UNKNOWN
Classification indicating an unknown type of street. |
Method Summary | |
---|---|
static StreetClassification |
parse(String in)
|
String |
toString()
|
String |
unparse()
Returns a concise, parseable string representation. |
static StreetClassification |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static StreetClassification[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final StreetClassification PRIM_HWY
public static final StreetClassification SEC_HWY
public static final StreetClassification LOCAL_ROAD
public static final StreetClassification UNKNOWN
Method Detail |
---|
public static StreetClassification[] values()
for (StreetClassification c : StreetClassification.values()) System.out.println(c);
public static StreetClassification valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is nullpublic String toString()
toString
in class Enum<StreetClassification>
public static StreetClassification parse(String in)
in
- the enum constant name or human-friendly namepublic String unparse()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |