    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class w3c.www.dsig.Trivalue

    java.lang.Object
       |
       +----w3c.www.dsig.Trivalue

public final class Trivalue
extends Object

A class implementing tri-valued logic. Tri-valued logic is boolean logic extended by a third state called 'unknown.' More information about trivalued logic TBD. Objects of this class are inmutable, once generated they cannot be modified.

##

TRI_FALSE
  Int value defined to indicate the state false.
TRI_TRUE
  Int value defined to indicate the state true.
TRI_UNKNOWN
  Int value defined to indicate the state unknown.

##

Trivalue(boolean)
  Construct a trivalue from the given int.
Trivalue(int)
  Construct a trivalue from the given int.
Trivalue(String)
  Construct a trivalue from the given string.

##

and(Trivalue)
  Return the logic and of this trivalue and the given trivalue in trivalued logic.
equals(Object)
  Test this trivalue and the given object for equality.
getValue()
  Return the trivalue as an int.
hashCode()
  Return a hash code for this trivalue.
isFalse()
  Return the boolean true if this trivalue is false.
isTrue()
  Return the boolean true if this trivalue is true.
isUnknown()
  Return the boolean true if this trivalue is unknown.
newFalse()
  Return a trivalue with the state true.
newTrue()
  Return a trivalue with the state true.
newUnknown()
  Return a trivalue with the state true.
not()
  Return the logic not of this trivalue in trivalued logic.
or(Trivalue)
  Return the logic and of this trivalue and the given trivalue in trivalued logic.
toString()
  Return a string representation of this trivalue.
toTrivalue(String)
  Return a trivalue encoded in an int for the string value.
UnknownToFalse()
  'Convert' the Trivalue to boolean treating unknown as false.
UnknownToTrue()
  'Convert' the Trivalue to boolean treating unknown as true.

##

TRI_FALSE

     public static final int TRI_FALSE

  Int value defined to indicate the state false.

TRI_TRUE

     public static final int TRI_TRUE

  Int value defined to indicate the state true.

TRI_UNKNOWN

     public static final int TRI_UNKNOWN

  Int value defined to indicate the state unknown.

##

Trivalue

     public Trivalue(int value)

  Construct a trivalue from the given int. The constants defined in this class for the int are TRI_FALSE, TRI_TRUE, and TRI_UNKNOWN. TRI_UNKNOWN and any other value will a trivalue with the state unknown.

Trivalue

     public Trivalue(boolean value)

  Construct a trivalue from the given int. Of course, this will never lead to a trivalue with the value unknown.

Trivalue

     public Trivalue(String value)

  Construct a trivalue from the given string. The string "true" is mapped to true, "false" to false, all else to unknown.

##

newTrue

     public static Trivalue newTrue()

  Return a trivalue with the state true. This method can be used as a short hand for 'new Trivalue(Trivalue.TRI_TRUE).' Additionally, it is more efficient as no new object needs to be generated.

newFalse

     public static Trivalue newFalse()

  Return a trivalue with the state true. This method can be used as a short hand for 'new Trivalue(Trivalue.TRI_FALSE).' Additionally, it is more efficient as no new object needs to be generated.

newUnknown

     public static Trivalue newUnknown()

  Return a trivalue with the state true. This method can be used as a short hand for 'new Trivalue(Trivalue.TRI_UNKNOWN).' Additionally, it is more efficient as no new object needs to be generated.

toTrivalue

     public int toTrivalue(String value)

  Return a trivalue encoded in an int for the string value. The string "true" maps to true, "false" to false, all else to unknown.

getValue

     public int getValue()

  Return the trivalue as an int. Possible values for the int are the final variables TRI_TRUE, TRI_FALSE, and TRI_UNKNOWN defined in this class.

isTrue

     public boolean isTrue()

  Return the boolean true if this trivalue is true.

isFalse

     public boolean isFalse()

  Return the boolean true if this trivalue is false.

isUnknown

     public boolean isUnknown()

  Return the boolean true if this trivalue is unknown.

UnknownToTrue

     public boolean UnknownToTrue()

  'Convert' the Trivalue to boolean treating unknown as true. That is, return true if this trivalue is true or unknown, and false if it is false.

UnknownToFalse

     public boolean UnknownToFalse()

  'Convert' the Trivalue to boolean treating unknown as false. That is, return true is this trivalue is true, and false if it is unknown or false.

not

     public Trivalue not()

  Return the logic not of this trivalue in trivalued logic. true maps to false, false to true, and unknown to unknown.

and

     public Trivalue and(Trivalue tvalue)

  Return the logic and of this trivalue and the given trivalue in trivalued logic. That is, return false if any of the two is false, true if both are true, and unknown otherwise.

or

     public Trivalue or(Trivalue tvalue)

  Return the logic and of this trivalue and the given trivalue in trivalued logic. That is, return true if any of the two are true, false if both are false, and unknown otherwise.

equals

     public boolean equals(Object obj)

  Test this trivalue and the given object for equality. If the given object is not null, an instance of the trivalue class and it represents the same logic state, return true. Otherwise return false.

  Overrides:
    equals in class Object

hashCode

     public int hashCode()

  Return a hash code for this trivalue. Using trivalues as keys in a hashtable does not make much sense as there are only three distinct ones, but this method is included anyway just in case someone needs it.

  Overrides:
    hashCode in class Object

toString

     public String toString()

  Return a string representation of this trivalue. The state true is represented by the string "true", false by "false," and unknown by "unknown."

  Overrides:
    toString in class Object

    All Packages  Class Hierarchy  This Package  Previous  Next  Index