public class TriStateBoolean
extends java.lang.Object
boolean flag. Support
for basic Boolean operations (NOT, AND, and OR) are provided.| Modifier and Type | Field and Description |
|---|---|
static TriStateBoolean |
FALSE
FALSE corresponds to a typical Boolean FALSE. |
static TriStateBoolean |
TRI_STATE
TRI_STATE represents the tri-state. |
static TriStateBoolean |
TRUE
TRUE corresponds to a typical Boolean true. |
static TriStateBoolean |
UNDEF
Special
TriStateBoolean object representing an
uninitialized value. |
| Modifier and Type | Method and Description |
|---|---|
TriStateBoolean |
aggregate(TriStateBoolean b)
This method is used to help determine if a set of
TriStateBoolean values are all the same or have some
difference. |
TriStateBoolean |
and(TriStateBoolean b)
|
boolean |
booleanValue()
Returns
true if this instance represents
TRUE. |
static TriStateBoolean |
getState(boolean state) |
static TriStateBoolean |
getState(java.lang.Boolean state) |
boolean |
isFalse()
Returns
true if this instance represents
FALSE; returns false otherwise. |
boolean |
isTriState()
Returns
true if this instance represents
TRI_STATE; returns false otherwise. |
boolean |
isTrue()
Returns
true if this instance represents
TRUE; returns false otherwise. |
boolean |
isUndef()
Returns
true if this instance represents
UNDEF; returns false otherwise. |
TriStateBoolean |
not()
NOT true => false.
NOT false => true. NOT tri => tri. |
TriStateBoolean |
or(TriStateBoolean b)
|
TriStateBoolean |
toggle()
This method defines the "toggle" operation as follows:
Toggling
TRUE returns FALSE. |
java.lang.String |
toString() |
public static final TriStateBoolean TRUE
TRUE corresponds to a typical Boolean true.public static final TriStateBoolean TRI_STATE
TRI_STATE represents the tri-state.public static final TriStateBoolean FALSE
FALSE corresponds to a typical Boolean FALSE.public static final TriStateBoolean UNDEF
TriStateBoolean object representing an
uninitialized value. This is needed to support the
aggregate() operation. Using the UNDEF value
is analogous to saying "no value". When UNDEF is used
in a TriStateBoolean operation, it is essentially ignored,
the result of the operation is determined by the other operand. If
both operands are UNDEF then UNDEF is
returned.public static TriStateBoolean getState(boolean state)
public static TriStateBoolean getState(java.lang.Boolean state)
public boolean isTrue()
true if this instance represents
TRUE; returns false otherwise.public boolean isTriState()
true if this instance represents
TRI_STATE; returns false otherwise.public boolean isFalse()
true if this instance represents
FALSE; returns false otherwise.public boolean isUndef()
true if this instance represents
UNDEF; returns false otherwise.public boolean booleanValue()
true if this instance represents
TRUE. Returns false if this instance
represents false. Throws an
IllegalStateException if this instance represents
TRI_STATE.public TriStateBoolean toggle()
TRUE returns FALSE.
TRI_STATE returns FALSE.
FALSE returns TRUE.
public TriStateBoolean aggregate(TriStateBoolean b)
TriStateBoolean values are all the same or have some
difference. It implements the following unusual truth table:
| AGG | true | false | tri |
| true | true | tri | tri |
| false | tri | false | tri |
| tri | tri | tri | tri |
public TriStateBoolean and(TriStateBoolean b)
| AND | true | false | tri |
| true | true | false | tri |
| false | false | false | tri |
| tri | tri | tri | tri |
public TriStateBoolean or(TriStateBoolean b)
| OR | true | false | tri |
| true | true | true | tri |
| false | true | false | tri |
| tri | tri | tri | tri |
public TriStateBoolean not()
public java.lang.String toString()
toString in class java.lang.Object