csli.util
Class FuzzyBoolean

java.lang.Object
  extended by csli.util.FuzzyBoolean

public class FuzzyBoolean
extends Object

Contains a probability. Can still function in place of a Boolean, based on a threshold.

Author:
Danilo Mirkovic

Field Summary
static FuzzyBoolean FALSE
           
static double THRESHOLD
           
static FuzzyBoolean TRUE
           
 
Constructor Summary
FuzzyBoolean(boolean value)
          Allocates a FuzzyBoolean based on the boolean flag
FuzzyBoolean(double probability)
          Allocates a FuzzyBoolean with the specified probability
FuzzyBoolean(String s)
          Allocates a FuzzyBoolean representing a value argument
 
Method Summary
 boolean booleanValue()
           
 boolean equals(Object o)
          True if the object is a FuzzyBoolean with the same probability
 double getProbability()
          Returns the probability of this boolean.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THRESHOLD

public static final double THRESHOLD
See Also:
Constant Field Values

TRUE

public static final FuzzyBoolean TRUE

FALSE

public static final FuzzyBoolean FALSE
Constructor Detail

FuzzyBoolean

public FuzzyBoolean(String s)
Allocates a FuzzyBoolean representing a value argument

Parameters:
s - string "true", "false" or a double value between 0 and 1, e.g. 0.50

FuzzyBoolean

public FuzzyBoolean(boolean value)
Allocates a FuzzyBoolean based on the boolean flag

Parameters:
value - if true, probability is 1, if false, 0

FuzzyBoolean

public FuzzyBoolean(double probability)
Allocates a FuzzyBoolean with the specified probability

Parameters:
probability - should be in [0,1], set to either 0 of 1 if outside
Method Detail

getProbability

public double getProbability()
Returns the probability of this boolean. Guaranteed to be in [0,1]

Returns:

booleanValue

public boolean booleanValue()

equals

public boolean equals(Object o)
True if the object is a FuzzyBoolean with the same probability

Overrides:
equals in class Object