sophware.home.logic
Class BinaryGroup

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

public class BinaryGroup
extends BinaryObject
implements Named, StateChangeListener, java.io.Serializable

BinaryGroup is a collection of BinaryObject with a policy that governs the conditions under which the group is considered to be "on" or "off".

Version:
1.0, 02/17/06
Author:
Russell Soph
See Also:
Serialized Form

Field Summary
static int AND
           
static int OR
          state change policy
 
Fields inherited from class sophware.home.lang.BinaryObject
OFF, ON
 
Constructor Summary
BinaryGroup(int policy)
          Creates a BinaryGroup with the name and policy.
BinaryGroup(java.lang.String name, int policy)
          Creates a BinaryGroup with the name and policy.
 
Method Summary
 void add(BinaryObject obj)
          Adds a object to this group
 java.lang.String getName()
          Gets the group's name
 int getPolicy()
          Gets the group policy
 boolean isMember(BinaryObject obj)
          Checks to see if object is in group
 void remove(BinaryObject obj)
          Removes a object from this group
 void stateChanged(StateObject o)
          Monitors object in group 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
 

Field Detail

OR

public static int OR
state change policy


AND

public static int AND
Constructor Detail

BinaryGroup

public BinaryGroup(int policy)
Creates a BinaryGroup with the name and policy.

Parameters:
policy - policy governing the state of the group

BinaryGroup

public BinaryGroup(java.lang.String name,
                   int policy)
Creates a BinaryGroup with the name and policy.

Parameters:
name - name of this group
policy - policy governing the state of the group
Method Detail

getName

public java.lang.String getName()
Gets the group's name

Specified by:
getName in interface Named
Returns:
name of the group

add

public void add(BinaryObject obj)
Adds a object to this group

Parameters:
obj - the object to be added

remove

public void remove(BinaryObject obj)
Removes a object from this group

Parameters:
obj - the object to be removed

isMember

public boolean isMember(BinaryObject obj)
Checks to see if object is in group

Parameters:
obj - the object to be checked

getPolicy

public int getPolicy()
Gets the group policy

Returns:
policy of the group AND / OR

stateChanged

public void stateChanged(StateObject o)
Monitors object in group for state changes

Specified by:
stateChanged in interface StateChangeListener
Parameters:
o - object that was updated
See Also:
StateChangeListener