sophware.home.logic
Class Condition

java.lang.Object
  extended by sophware.home.lang.StateObject
      extended by sophware.home.lang.BinaryObject
          extended by sophware.home.logic.Condition
All Implemented Interfaces:
java.io.Serializable, StateChangeListener

public class Condition
extends BinaryObject
implements StateChangeListener, java.io.Serializable

A condition becomes true when the given object matches the given value.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class sophware.home.lang.BinaryObject
OFF, ON
 
Constructor Summary
Condition(BinaryObject obj)
          Constructs a Condition
Condition(StateObject obj, java.lang.Object value)
          Constructs a Condition
 
Method Summary
 StateObject getObject()
          Gets the object associated with this condition
 java.lang.Object getValue()
          Gets the value
 boolean isTrue()
          Gets the current state of the condition
 void stateChanged(StateObject obj)
          Monitors object for state changes
 
Methods inherited from class sophware.home.lang.BinaryObject
isOn, setOn, stateEquals
 
Methods inherited from class sophware.home.lang.StateObject
addStateChangeListener, fireStateChange, removeStateChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Condition

public Condition(BinaryObject obj)
Constructs a Condition

This constructor is the same as Condition(obj,BinaryObject.ON)

Parameters:
obj - the binary object

Condition

public Condition(StateObject obj,
                 java.lang.Object value)
Constructs a Condition

Parameters:
obj - the object
value - the value of the object that will makes this condition true
Method Detail

getObject

public StateObject getObject()
Gets the object associated with this condition

Returns:
the object associated with this condition

getValue

public java.lang.Object getValue()
Gets the value

Returns:
the value that will make this condition true

isTrue

public boolean isTrue()
Gets the current state of the condition

Returns:
the state of the condition

stateChanged

public void stateChanged(StateObject obj)
Monitors object for state changes

Specified by:
stateChanged in interface StateChangeListener
Parameters:
obj - the object that has changed
See Also:
StateChangeListener