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.


Variable Index

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

Constructor Index

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

Method Index

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

Variables

 o TRI_FALSE
 public static final int TRI_FALSE
Int value defined to indicate the state false.

 o TRI_TRUE
 public static final int TRI_TRUE
Int value defined to indicate the state true.

 o TRI_UNKNOWN
 public static final int TRI_UNKNOWN
Int value defined to indicate the state unknown.

Constructors

 o 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.

 o 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.

 o 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.

Methods

 o 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.

 o 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.

 o 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.

 o 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.

 o 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.

 o isTrue
 public boolean isTrue()
Return the boolean true if this trivalue is true.

 o isFalse
 public boolean isFalse()
Return the boolean true if this trivalue is false.

 o isUnknown
 public boolean isUnknown()
Return the boolean true if this trivalue is unknown.

 o 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.

 o 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.

 o 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.

 o 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.

 o 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.

 o 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
 o 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
 o 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