org.jicengine.operation
Class LocalContext

java.lang.Object
  extended byorg.jicengine.operation.AbstractContext
      extended byorg.jicengine.operation.LocalContext
All Implemented Interfaces:
Context

public class LocalContext
extends AbstractContext

local context is a context inside a larger context (parent context). objects in the local context override objects of the parent context. if an object is not found from the local context, the parent context is searched.

new objects are added only to the local context.

the local context is represented by another Local-instance. this way its implementation can be changed.

Author:
.timo

Nested Class Summary
 
Nested classes inherited from class org.jicengine.operation.Context
Context.DuplicateNameException, Context.ObjectNotFoundException
 
Constructor Summary
LocalContext(Context parent)
           
LocalContext(Context local, Context parent)
           
LocalContext(java.lang.String name, Context local, Context parent)
           
 
Method Summary
 void addObject(java.lang.String name, java.lang.Object object)
          If addObject success, the object stored will be returned by getObject with the same name.
protected  java.lang.Object getFromParent(java.lang.String name)
           
 java.lang.Object getObject(java.lang.String name)
          finds an object from the context.
 Context getParent()
           
protected  boolean hasInParent(java.lang.String name)
           
 boolean hasObject(java.lang.String name)
           
 void setParent(Context context)
           
 java.lang.String toString()
           
 
Methods inherited from class org.jicengine.operation.AbstractContext
getName, getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalContext

public LocalContext(Context parent)

LocalContext

public LocalContext(Context local,
                    Context parent)

LocalContext

public LocalContext(java.lang.String name,
                    Context local,
                    Context parent)
Method Detail

setParent

public void setParent(Context context)

getParent

public Context getParent()

getObject

public java.lang.Object getObject(java.lang.String name)
Description copied from interface: Context
finds an object from the context.

Returns:
the object. NOTE: currently no null values supported.

getFromParent

protected java.lang.Object getFromParent(java.lang.String name)

hasObject

public boolean hasObject(java.lang.String name)

hasInParent

protected boolean hasInParent(java.lang.String name)

addObject

public void addObject(java.lang.String name,
                      java.lang.Object object)
Description copied from interface: Context
If addObject success, the object stored will be returned by getObject with the same name.


toString

public java.lang.String toString()
Overrides:
toString in class AbstractContext