Jacson

de.spieleck.app.jacson
Class JacsonState

java.lang.Object
  extended byde.spieleck.app.jacson.JacsonState
All Implemented Interfaces:
ConfigParamMap, java.io.Serializable, SimpleParamGetter
Direct Known Subclasses:
ProjectJacsonState

public class JacsonState
extends java.lang.Object
implements ConfigParamMap, SimpleParamGetter

The state of the Jacson Engine. A parameter map, a chunk counter. JacsonBlock puts some life scoping arround this.

Author:
fsn
See Also:
Serialized Form

Field Summary
protected  java.util.Map attributes
          Storage for (local) attributes
protected  int chunkNo
          The chunk Counter
protected  JacsonState parent
          The parent state (for attributes inheritance)
 
Constructor Summary
JacsonState()
           
JacsonState(JacsonState parent)
          Nested constructor for scoping.
 
Method Summary
 java.lang.String expand(java.lang.String input)
          Expand a string (i.e. expand parameter references)
 java.lang.Object get(java.lang.String key)
          Get a value to a given key.
 int getChunkNo()
          Get the current chunk count.
 java.lang.Object getContextual(java.lang.String key)
          Get the value to a given key, searching locally and then the parent.
 java.lang.Object getGlobal(java.lang.String key)
          Get the value from the root (no parent) state.
 java.util.Set getKeySet()
          What keys do we have locally or in the inheritance hierarchy.
 java.lang.Object getLocal(java.lang.String key)
          Get the value to a given key only search the key locally.
 java.util.Set getLocalKeySet()
          What keys do we have locally ?
 java.lang.String getParam(java.lang.String key)
          Wrap get(java.lang.String) to SimpleParamGetter.getParam(java.lang.String) for compatibility
protected  JacsonState getParent()
           
protected  JacsonState getRoot()
           
 void incChunkNo()
          Increment the chunk count.
 void put(java.lang.String key, java.lang.Object value)
          Store a key,value pair in the state.
 void putContext(java.lang.String key, java.lang.Object value)
          Store the key/value pair in the most local context containing this key.
 void putGlobal(java.lang.String key, java.lang.Object value)
          Store key/value pair in the root state.
 void putLocal(java.lang.String key, java.lang.Object value)
          Store a key/value pair in the local memory.
 void set(java.lang.String key, java.lang.String value)
          Wrap put(java.lang.String, java.lang.Object) as ConfigParamMap.set(java.lang.String, java.lang.String) for compatibility
 void setParent(JacsonState parent)
          Register the parent state of this state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

chunkNo

protected int chunkNo
The chunk Counter


parent

protected JacsonState parent
The parent state (for attributes inheritance)


attributes

protected java.util.Map attributes
Storage for (local) attributes

Constructor Detail

JacsonState

public JacsonState()

JacsonState

public JacsonState(JacsonState parent)
Nested constructor for scoping.

Method Detail

setParent

public void setParent(JacsonState parent)
Register the parent state of this state. States form a hierarchy with value inheritance.


incChunkNo

public void incChunkNo()
Increment the chunk count. Usually done by the driver program.


getChunkNo

public int getChunkNo()
Get the current chunk count.


get

public java.lang.Object get(java.lang.String key)
Get a value to a given key.


getLocal

public java.lang.Object getLocal(java.lang.String key)
Get the value to a given key only search the key locally.


getContextual

public java.lang.Object getContextual(java.lang.String key)
Get the value to a given key, searching locally and then the parent.


getGlobal

public java.lang.Object getGlobal(java.lang.String key)
Get the value from the root (no parent) state. Depending on the driver program the root state is often a special one: It is the ant environment within ant tasks and it is the JJacket environment within jjacket.


put

public void put(java.lang.String key,
                java.lang.Object value)
Store a key,value pair in the state.

Parameters:
key - the name of the object
value - the object to be remembered

putLocal

public void putLocal(java.lang.String key,
                     java.lang.Object value)
Store a key/value pair in the local memory.

Parameters:
key - the name of the object
value - the object to be remembered

putContext

public void putContext(java.lang.String key,
                       java.lang.Object value)
Store the key/value pair in the most local context containing this key. This will be root if the key isn't existing yet.

Parameters:
key - the name of the object
value - the object to be remembered

putGlobal

public void putGlobal(java.lang.String key,
                      java.lang.Object value)
Store key/value pair in the root state. Depending on the driver program the root state is often a special one: It is the ant environment within ant tasks and it is the JJacket environment within jjacket.

Parameters:
key - the name of the object
value - the object to be remembered

getLocalKeySet

public java.util.Set getLocalKeySet()
What keys do we have locally ?


getKeySet

public java.util.Set getKeySet()
What keys do we have locally or in the inheritance hierarchy.


getRoot

protected JacsonState getRoot()

getParent

protected JacsonState getParent()

set

public void set(java.lang.String key,
                java.lang.String value)
Wrap put(java.lang.String, java.lang.Object) as ConfigParamMap.set(java.lang.String, java.lang.String) for compatibility

Specified by:
set in interface ConfigParamMap

getParam

public java.lang.String getParam(java.lang.String key)
Wrap get(java.lang.String) to SimpleParamGetter.getParam(java.lang.String) for compatibility

Specified by:
getParam in interface SimpleParamGetter

expand

public java.lang.String expand(java.lang.String input)
Description copied from interface: ConfigParamMap
Expand a string (i.e. expand parameter references)

Specified by:
expand in interface ConfigParamMap

Spieleck

Copyleft 2002 spieleck.de.