java.io.Serializable, java.lang.Cloneablepublic class Flags
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
There cannot be a flag with a value of 3 because that represents Flag 1 and Flag 2 both being on/true.
| Constructor | Description |
|---|---|
Flags() |
Create a new Flags object.
|
Flags(long flags) |
Initialize a new Flags object with the given flags.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
clear() |
Turn off all flags.
|
java.lang.Object |
clone() |
Clone this Flags object.
|
boolean |
equals(java.lang.Object obj) |
Tests if two Flags objects are in the same state.
|
long |
getFlags() |
Returns the current flags.
|
int |
hashCode() |
The hash code is based on the current state of the flags.
|
boolean |
isOff(long flag) |
Tests whether the given flag is off.
|
boolean |
isOn(long flag) |
Tests whether the given flag is on.
|
java.lang.String |
toString() |
Returns a 64 length String with the first flag on the right and the
64th flag on the left.
|
void |
turnOff(long flag) |
Turns off the given flag.
|
void |
turnOffAll() |
Turn off all flags.
|
void |
turnOn(long flag) |
Turns on the given flag.
|
void |
turnOnAll() |
Turn on all 64 flags.
|
public Flags()
public Flags(long flags)
flags - collection of boolean flags to represent.public long getFlags()
public boolean isOn(long flag)
flag - Flag value to check.public boolean isOff(long flag)
flag - Flag value to check.public void turnOn(long flag)
flag - Flag value to turn on.public void turnOff(long flag)
flag - Flag value to turn off.public void turnOffAll()
public void clear()
turnOffAll().public void turnOnAll()
public java.lang.Object clone()
clone in class java.lang.ObjectObject.clone()public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - object being testedObject.equals(java.lang.Object)public int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2002–2018. All rights reserved.