hkontrol.core
Class State

java.lang.Object
  extended by java.util.Observable
      extended by hkontrol.core.State

public class State
extends java.util.Observable

This class is the very core of HKontrol's MVC implementation. It merely implements a restricted, observable map. Module have to use this class to announce their runtime obtained status information while Rule objects constitue appropriate actions to execute.


Constructor Summary
State()
          initializes the State object.
 
Method Summary
 java.lang.String getProperty(java.lang.String key)
          returns the current value of a given property or null if no such property was set.
 boolean setProperties(java.util.Map properties)
          sets a number of properties at once.
 boolean setProperty(java.lang.String key, boolean value)
          sets a single property and notifies the state observers if the state actually changed.
 boolean setProperty(java.lang.String key, long value)
          sets a single property and notifies the state observers if the state actually changed.
 boolean setProperty(java.lang.String key, java.lang.String value)
          sets a single property and notifies the state observers if the state actually changed.
 java.lang.String toString()
          returns a string describing the contents of the state object.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

State

public State()
initializes the State object.

Method Detail

setProperties

public boolean setProperties(java.util.Map properties)
sets a number of properties at once. The map must contain only String objects as keys and values. The state observers are being notified only once and only if the state actually changed.

Parameters:
properties - a map containing keys value pairs describing a current module state.
Returns:
true if any property has been changed, false otherwise.

setProperty

public boolean setProperty(java.lang.String key,
                           long value)
sets a single property and notifies the state observers if the state actually changed.

Parameters:
key - the key of the property to change
value - the property's new value that will be converted to a String object
Returns:
true if any property has been changed, false otherwise.

setProperty

public boolean setProperty(java.lang.String key,
                           boolean value)
sets a single property and notifies the state observers if the state actually changed.

Parameters:
key - the key of the property to change
value - the property's new value that will be converted to a String object
Returns:
true if any property has been changed, false otherwise.

setProperty

public boolean setProperty(java.lang.String key,
                           java.lang.String value)
sets a single property and notifies the state observers if the state actually changed.

Parameters:
key - the key of the property to change
value - the property's new value that will be converted to a String object
Returns:
true if any property has been changed, false otherwise.

getProperty

public java.lang.String getProperty(java.lang.String key)
returns the current value of a given property or null if no such property was set.

Parameters:
key - the key of the requested property
Returns:
the current value of the named property or null if no such property was set.

toString

public java.lang.String toString()
returns a string describing the contents of the state object.

Overrides:
toString in class java.lang.Object
Returns:
the string representing the current state.