|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.commons.validator.util.Flags
Represents a collection of 64 boolean (on/off) flags. Individual flags
are represented by powers of 2. For example,
Flag 1 = 1
Flag 2 = 2
Flag 3 = 4
Flag 4 = 8
or using shift operator to make numbering easier:
Flag 1 = 1 << 0
Flag 2 = 1 << 1
Flag 3 = 1 << 2
Flag 4 = 1 << 3
There cannot be a flag with a value of 3 because that represents Flag 1 and Flag 2 both being on/true.
| Constructor Summary | |
Flags()
Create a new Flags object. |
|
Flags(long flags)
Initialize a new Flags object with the given flags. |
|
| Method Summary | |
void |
clear()
Turn off all flags. |
Object |
clone()
Clone this Flags object. |
boolean |
equals(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. |
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. |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Flags()
public Flags(long flags)
| Method Detail |
public long getFlags()
public boolean isOn(long flag)
public boolean isOff(long flag)
public void turnOn(long flag)
public void turnOff(long flag)
public void turnOffAll()
public void clear()
turnOffAll().
public void turnOnAll()
public Object clone()
Object.clone()public boolean equals(Object obj)
obj - object being testedObject.equals(java.lang.Object)public int hashCode()
Object.hashCode()public String toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||