net.sourceforge.scopes.impl
Class StateImpl

java.lang.Object
  extended by net.sourceforge.scopes.impl.StateImpl
All Implemented Interfaces:
State

public class StateImpl
extends java.lang.Object
implements State

Simple implementation for a state.


Constructor Summary
StateImpl()
          Constructor.
 
Method Summary
 java.lang.Object getAttribute(java.lang.String attributeName)
          Returns an attribute, searching in all contexts, until it finds one.
 java.lang.Object getAttribute(java.lang.String contextName, java.lang.String attributeName)
          Returns an attribute in a context.
 java.util.Set<java.lang.String> getAttributeNames()
          Returns all attribute names in all contexts.
 java.util.Set<java.lang.String> getAttributeNames(java.lang.String contextName)
          Returns the attribute names for a particular context.
 Context getContext(java.lang.String contextName)
          Returns a context object.
 java.util.Set<java.lang.String> getContextNames()
          Returns the names of the used contexts.
 void removeAttribute(java.lang.String attributeName)
          Removes an attribute in every context.
 void removeAttribute(java.lang.String contextName, java.lang.String attributeName)
          Removes an attribute from a context.
 void setAttribute(java.lang.String attributeName, java.lang.Object object)
          Sets an attribute, searching if it exists.
 void setAttribute(java.lang.String contextName, java.lang.String attributeName, java.lang.Object object)
           
 void setContext(java.lang.String contextName, Context context)
          Sets a context, giving its context name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateImpl

public StateImpl()
Constructor.

Method Detail

getContextNames

public java.util.Set<java.lang.String> getContextNames()
Description copied from interface: State
Returns the names of the used contexts.

Specified by:
getContextNames in interface State
Returns:
The set of context names.

setContext

public void setContext(java.lang.String contextName,
                       Context context)
Sets a context, giving its context name.

Parameters:
contextName - The context name.
context - The context object.

getContext

public Context getContext(java.lang.String contextName)
Description copied from interface: State
Returns a context object.

Specified by:
getContext in interface State
Parameters:
contextName - The context name.
Returns:
The needed context object.

getAttribute

public java.lang.Object getAttribute(java.lang.String contextName,
                                     java.lang.String attributeName)
Description copied from interface: State
Returns an attribute in a context.

Specified by:
getAttribute in interface State
Parameters:
contextName - The name of the context.
attributeName - The name of the attribute.
Returns:
The needed attribute.

getAttributeNames

public java.util.Set<java.lang.String> getAttributeNames(java.lang.String contextName)
Description copied from interface: State
Returns the attribute names for a particular context.

Specified by:
getAttributeNames in interface State
Parameters:
contextName - The name of the context.
Returns:
The attribute name set.

setAttribute

public void setAttribute(java.lang.String contextName,
                         java.lang.String attributeName,
                         java.lang.Object object)
Specified by:
setAttribute in interface State

removeAttribute

public void removeAttribute(java.lang.String contextName,
                            java.lang.String attributeName)
Description copied from interface: State
Removes an attribute from a context.

Specified by:
removeAttribute in interface State
Parameters:
contextName - The name of the context.
attributeName - The attribute to remove.

getAttribute

public java.lang.Object getAttribute(java.lang.String attributeName)
Description copied from interface: State
Returns an attribute, searching in all contexts, until it finds one.

Specified by:
getAttribute in interface State
Parameters:
attributeName - The attribute name to search.
Returns:
The attribute.

getAttributeNames

public java.util.Set<java.lang.String> getAttributeNames()
Description copied from interface: State
Returns all attribute names in all contexts.

Specified by:
getAttributeNames in interface State
Returns:
The attribute name set.

setAttribute

public void setAttribute(java.lang.String attributeName,
                         java.lang.Object object)
Description copied from interface: State
Sets an attribute, searching if it exists. If it is found, it overwrites it, otherwise does nothing.

Specified by:
setAttribute in interface State
Parameters:
attributeName - The name of the attribute to overwrite.
object - The new attribute

removeAttribute

public void removeAttribute(java.lang.String attributeName)
Description copied from interface: State
Removes an attribute in every context.

Specified by:
removeAttribute in interface State
Parameters:
attributeName - The attribute to remove.