edu.washington.cs.supple.rep.values
Class AsBooleanValue

java.lang.Object
  extended byedu.washington.cs.supple.rep.values.Variable
      extended byedu.washington.cs.supple.rep.values.AsBooleanValue
All Implemented Interfaces:
ValueBinding, ValueListener

public class AsBooleanValue
extends Variable
implements ValueBinding, ValueListener

AsBooleanValue converts a non-boolean value into a boolean according to a specified condition.

Author:
dbc1

Field Summary
 ValueBinding a
           
 int condition
           
static int TRUE_BY_DEFAULT
          True if the value is true, not null, or not empty.
static int TRUE_IF_EXACTLY_ONE_VALUE
          True if the value is a collection with only one element.
static int TRUE_IF_FALSE
          True if the value is a boolean and false.
static int TRUE_IF_MORE_THAN_ONE_VALUE
          True if the value is a collection with multiple elements.
static int TRUE_IF_NOT_EMPTY
          True if the value is an empty collection.
static int TRUE_IF_NULL
          True only if the value is null.
 java.lang.Boolean value
           
 
Constructor Summary
AsBooleanValue(ValueBinding a)
           
AsBooleanValue(ValueBinding a, int condition)
           
 
Method Summary
protected  boolean computeValue(java.lang.Object o)
          Determine if value of o is true according to the desired condition.
 java.lang.Object getValue()
          Get the bound value.
 java.lang.Class getValueClass()
          Get the class of this variable
protected  void postLastListener()
          Subclasses can use this to implement post-last-listener cleanup.
protected  void preFirstListener()
          Subclasses can use this to implement pre-first-listener setup.
 void setValue(java.lang.Object value)
          Set the value of this variable.
 void valueChanged(ValueBinding binding, java.lang.Object newValue)
          Signals variable change.
 
Methods inherited from class edu.washington.cs.supple.rep.values.Variable
addListener, processUpdate, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.washington.cs.supple.rep.values.ValueBinding
addListener, removeListener
 

Field Detail

TRUE_BY_DEFAULT

public static final int TRUE_BY_DEFAULT
True if the value is true, not null, or not empty.

See Also:
Constant Field Values

TRUE_IF_NULL

public static final int TRUE_IF_NULL
True only if the value is null.

See Also:
Constant Field Values

TRUE_IF_EXACTLY_ONE_VALUE

public static final int TRUE_IF_EXACTLY_ONE_VALUE
True if the value is a collection with only one element.

See Also:
Constant Field Values

TRUE_IF_MORE_THAN_ONE_VALUE

public static final int TRUE_IF_MORE_THAN_ONE_VALUE
True if the value is a collection with multiple elements.

See Also:
Constant Field Values

TRUE_IF_NOT_EMPTY

public static final int TRUE_IF_NOT_EMPTY
True if the value is an empty collection.

See Also:
Constant Field Values

TRUE_IF_FALSE

public static final int TRUE_IF_FALSE
True if the value is a boolean and false.

See Also:
Constant Field Values

condition

public final int condition

a

public final ValueBinding a

value

public java.lang.Boolean value
Constructor Detail

AsBooleanValue

public AsBooleanValue(ValueBinding a)

AsBooleanValue

public AsBooleanValue(ValueBinding a,
                      int condition)
Method Detail

computeValue

protected boolean computeValue(java.lang.Object o)
Determine if value of o is true according to the desired condition.


getValueClass

public final java.lang.Class getValueClass()
Description copied from interface: ValueBinding
Get the class of this variable

Specified by:
getValueClass in interface ValueBinding
Returns:

getValue

public final java.lang.Object getValue()
Description copied from interface: ValueBinding
Get the bound value.

Specified by:
getValue in interface ValueBinding
Returns:

setValue

public final void setValue(java.lang.Object value)
Description copied from interface: ValueBinding
Set the value of this variable.

Specified by:
setValue in interface ValueBinding
Parameters:
value -

preFirstListener

protected void preFirstListener()
Description copied from class: Variable
Subclasses can use this to implement pre-first-listener setup.

Overrides:
preFirstListener in class Variable

postLastListener

protected void postLastListener()
Description copied from class: Variable
Subclasses can use this to implement post-last-listener cleanup.

Overrides:
postLastListener in class Variable

valueChanged

public final void valueChanged(ValueBinding binding,
                               java.lang.Object newValue)
Description copied from interface: ValueListener
Signals variable change.

Specified by:
valueChanged in interface ValueListener
Parameters:
binding -
newValue -