Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Specifies how many screens are visible.
- */
- public enum ScreenSplit {
- SCREENS_1("1 Screen", 0, 1),
- SCREENS_2("2 Screens", 1, 2),
- SCREENS_4("4 Screens", 2, 4),
- SCREENS_9("9 Screens", 3, 9);
- public static final ScreenSplit DEFAULT_SPLIT = ScreenSplit.SCREENS_4;
- public static final ScreenSplit MAX_SPLIT = ScreenSplit.SCREENS_9;
- private String stringValue;
- /**
- * Ordinal number.
- */
- private int intValue;
- /**
- * Number of visible screens.
- */
- private int screens;
- ScreenSplit(String stringValue, int intValue, int screens) {
- this.stringValue = stringValue;
- this.intValue = intValue;
- this.screens = screens;
- }
- /**
- * Returns the enum constant of the specified enum type with the specified int value.
- * @param intValue
- * @return Enum constant
- * @throws IllegalArgumentException if this enum type has no constant with the specified numeric value.
- */
- public static ScreenSplit valueOf(int intValue) throws IllegalArgumentException {
- for (ScreenSplit enumerator : ScreenSplit.values()) {
- if (enumerator.intValue == intValue) {
- return enumerator;
- }
- }
- throw new IllegalArgumentException("No constant with the specified numeric value.");
- }
- /**
- * Returns an array filled with specified enum type enumerators represented as their {@link ScreenSplit#toString()} value.
- * @return Array of enum values.
- */
- public static String[] strings() {
- ScreenSplit[] enumerators = ScreenSplit.values();
- String[] strings = new String[enumerators.length];
- for (int index = 0; index < enumerators.length; index++) {
- strings[index] = enumerators[index].toString();
- }
- return strings;
- }
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return this.stringValue;
- }
- /**
- * Returns specified enum type enumerator ordinal number.
- * @return Ordinal number.
- */
- public int getIntValue() {
- return this.intValue;
- }
- /**
- * Returns specified enum type enumerator number of visible screens.
- * @return Number of visible screens.
- */
- public int getScreens() {
- return this.screens;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement