Extension SDK 10.1.2

oracle.ide.util
Class TriStateBoolean

java.lang.Object
  extended byoracle.ide.util.TriStateBoolean

public class TriStateBoolean
extends java.lang.Object

This class represents a flag that has three states, as opposed to the two states of a regular boolean flag. Support for basic Boolean operations (NOT, AND, and OR) are provided.


Field Summary
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.
 
Method Summary
 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)
           AND true false tri true true false tri false false false tri tri tri tri tri
Truth table for tri-state AND operator
 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)
           OR true false tri true true true tri false true false tri tri tri tri tri
Truth table for tri-state OR operator
 TriStateBoolean toggle()
          This method defines the "toggle" operation as follows: Toggling TRUE returns FALSE.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE

public static final TriStateBoolean TRUE
TRUE corresponds to a typical Boolean true.


TRI_STATE

public static final TriStateBoolean TRI_STATE
TRI_STATE represents the tri-state.


FALSE

public static final TriStateBoolean FALSE
FALSE corresponds to a typical Boolean FALSE.


UNDEF

public static final TriStateBoolean UNDEF
Special 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.

Method Detail

getState

public static TriStateBoolean getState(boolean state)

getState

public static TriStateBoolean getState(java.lang.Boolean state)

isTrue

public boolean isTrue()
Returns true if this instance represents TRUE; returns false otherwise.


isTriState

public boolean isTriState()
Returns true if this instance represents TRI_STATE; returns false otherwise.


isFalse

public boolean isFalse()
Returns true if this instance represents FALSE; returns false otherwise.


isUndef

public boolean isUndef()
Returns true if this instance represents UNDEF; returns false otherwise.


booleanValue

public boolean booleanValue()
Returns true if this instance represents TRUE. Returns false if this instance represents false. Throws an IllegalStateException if this instance represents TRI_STATE.


toggle

public TriStateBoolean toggle()
This method defines the "toggle" operation as follows:
  • Toggling TRUE returns FALSE.
  • Toggling TRI_STATE returns FALSE.
  • Toggling FALSE returns TRUE.


aggregate

public 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. It implements the following unusual truth table:
Truth table for tri-state AND operator
AGG true false tri
true true tri tri
false tri false tri
tri tri tri tri


and

public TriStateBoolean and(TriStateBoolean b)
Truth table for tri-state AND operator
AND true false tri
true true false tri
false false false tri
tri tri tri tri


or

public TriStateBoolean or(TriStateBoolean b)
Truth table for tri-state OR operator
OR true false tri
true true true tri
false true false tri
tri tri tri tri


not

public TriStateBoolean not()
NOT true => false.
NOT false => true.
NOT tri => tri.


Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.