org.globus.cog.gridshell.model
Class ScopeImpl

java.lang.Object
  extended byorg.globus.cog.gridshell.model.ScopeImpl
All Implemented Interfaces:
PropertyChangeNotifier, Scope, Serializable

public class ScopeImpl
extends Object
implements Scope

An implementation of Scope

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.globus.cog.gridshell.interfaces.Scope
Scope.Mode
 
Field Summary
 
Fields inherited from interface org.globus.cog.gridshell.interfaces.Scope
READ_ONLY, READ_WRITE
 
Constructor Summary
ScopeImpl()
          Default Constructor
ScopeImpl(Scope _super)
          Allows a superclass to be specified
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener pcListener)
          Add a property change listener
 void addPropertyChangeListener(String name, PropertyChangeListener pcListener)
          Add a property change listener for propertyName
static Scope createImmutableScope(Scope scope)
          Creates a scope whos variables can't be modified
 Scope.Mode getMode(String name)
          Returns the mode the variable is
 Scope getSuper()
          Returns a super class if one is defined, otherwise returns null
static Scope getSystemScope()
          Returns a Scope of the system
 Set getUniqueValues()
          Returns values (no duplicates)
 Object getValue(String name)
          Gets the value associated with variable name for this or superclass
 Collection getValues()
          Returns all the values (duplicates included)
 Set getVariableNames()
          Returns a collection of the variable names for this scope and any superclass
 void removePropertyChangeListener(PropertyChangeListener pcListener)
          Remove a property change listener
 void setMode(String name, Scope.Mode value)
          Sets the mode of a variable
 void setVariableTo(String name, Object value)
          If a variable "name" is defined in "this" sets the variable to value, next checks for the variable "name" up the superclass chain.
 boolean variableExists(String name)
          Returns true of the variable exists either in "this" or up the super chain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScopeImpl

public ScopeImpl(Scope _super)
Allows a superclass to be specified

Parameters:
_super - - the superclass

ScopeImpl

public ScopeImpl()
Default Constructor

Method Detail

getVariableNames

public Set getVariableNames()
Description copied from interface: Scope
Returns a collection of the variable names for this scope and any superclass

Specified by:
getVariableNames in interface Scope
Returns:

getValues

public Collection getValues()
Description copied from interface: Scope
Returns all the values (duplicates included)

Specified by:
getValues in interface Scope
Returns:

getUniqueValues

public Set getUniqueValues()
Description copied from interface: Scope
Returns values (no duplicates)

Specified by:
getUniqueValues in interface Scope
Returns:

getSuper

public Scope getSuper()
Description copied from interface: Scope
Returns a super class if one is defined, otherwise returns null

Specified by:
getSuper in interface Scope
Returns:

getValue

public Object getValue(String name)
Description copied from interface: Scope
Gets the value associated with variable name for this or superclass

Specified by:
getValue in interface Scope
Parameters:
name - - the name of the variable to look for
Returns:

setVariableTo

public void setVariableTo(String name,
                          Object value)
                   throws ScopeException
Description copied from interface: Scope
If a variable "name" is defined in "this" sets the variable to value, next checks for the variable "name" up the superclass chain. If no such variable is found all the way up, creates a new variable this.name and sets to value

Specified by:
setVariableTo in interface Scope
Parameters:
name - - the name of the variable
value - - the value to set the variable to
Throws:
ScopeException - - thrown if failed to set the variable

variableExists

public boolean variableExists(String name)
Description copied from interface: Scope
Returns true of the variable exists either in "this" or up the super chain

Specified by:
variableExists in interface Scope
Parameters:
name -
Returns:

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener pcListener)
Description copied from interface: PropertyChangeNotifier
Add a property change listener

Specified by:
addPropertyChangeListener in interface PropertyChangeNotifier
Parameters:
pcListener -

addPropertyChangeListener

public void addPropertyChangeListener(String name,
                                      PropertyChangeListener pcListener)
Description copied from interface: PropertyChangeNotifier
Add a property change listener for propertyName

Specified by:
addPropertyChangeListener in interface PropertyChangeNotifier
Parameters:
name -
pcListener -

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener pcListener)
Description copied from interface: PropertyChangeNotifier
Remove a property change listener

Specified by:
removePropertyChangeListener in interface PropertyChangeNotifier
Parameters:
pcListener -

getMode

public Scope.Mode getMode(String name)
Description copied from interface: Scope
Returns the mode the variable is

Specified by:
getMode in interface Scope
Parameters:
name -
Returns:

setMode

public void setMode(String name,
                    Scope.Mode value)
Description copied from interface: Scope
Sets the mode of a variable

Specified by:
setMode in interface Scope
Parameters:
name -
value -

createImmutableScope

public static Scope createImmutableScope(Scope scope)
Creates a scope whos variables can't be modified

Parameters:
scope -
Returns:

getSystemScope

public static Scope getSystemScope()
Returns a Scope of the system

Returns: