Package sc2002.FCS1.grp2
Enum Class FlatType
- All Implemented Interfaces:
Serializable,Comparable<FlatType>,Constable
Enum that represents the type of the flats (The assignment assumes there are only 2-Room and 3-Room)
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionRepresents a 3-Room flat type.Represents a 2-Room flat type. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FlatTypefromInt(int number) Construct base on integer value that can represent a flat type.static FlatTypefromString(String value) Convert a string to the respective FlatType enum.toString()Get the string representation of the FlatType.static FlatTypeReturns the enum constant of this class with the specified name.static FlatType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
TWO_ROOM
Represents a 2-Room flat type. -
THREE_ROOM
Represents a 3-Room flat type.
-
-
Field Details
-
value
-
-
Constructor Details
-
FlatType
Constructor for FlatType enum.- Parameters:
value- The string representation of the FlatType.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
toString
Get the string representation of the FlatType. -
fromString
Convert a string to the respective FlatType enum.- Parameters:
value- The string to convert.- Returns:
- The FlatType enum that matches the string, or null if no match is found.
-
fromInt
Construct base on integer value that can represent a flat type. For example, provide number 2 gives youTWO_ROOMAny unsupported flat type value such as 4 or 5 will result innull
-