planetj.dataengine.parameter
Class ParameterCollection

java.lang.Object
  |
  +--planetj.dataengine.parameter.ParameterCollection
All Implemented Interfaces:
Cloneable, Serializable

public class ParameterCollection
extends Object
implements Cloneable, Serializable

A Collection of IParameter objects. IParameter objects can be retrieved either by their ID, or by their index (which is determined by the order in which they were added to this collection)

See Also:
Serialized Form

Constructor Summary
ParameterCollection(IContext context)
          Creates a new ParameterCollection
 
Method Summary
 void addParameter(IParameter param)
          Adds a parameter to this collection.
 void clear()
          Removes all parameters from this collection
 ParameterCollection cloneParameterCollection()
          Clones this parameter collection
 ParameterCollection cloneParameterCollection(IContext context)
          Clones this parameter collection.
 boolean equals(Object o)
          Tests if two ParameterCollections have equal parameters (in the same order)
 IContext getContext()
          Gets the context associated with this parameter collection
 Iterator getDisplayParameters()
          Iterates over the parameters in this context which should be displayed to the user.
 IParameter getParameter(int index)
          Gets a parameter by its index.
 IParameter getParameter(int pIndex, boolean pCreate)
          Gets a parameter by its index.
 IParameter getParameter(String parameterId)
          Gets a parameter by its its context specific id, or by its name, or by a named index.
 int getParameterCount()
          Gets the number of parameters present in this context (same as the size()) method
 int getParameterCount(Class paramClass)
          Gets the number of parameters present in this context which are of the specified class (or are subclasses of the specified class)
 List getParameters()
          Gets an unmodifiable List of this collection's IParameter objects (in order).
 Iterator getParameters(Class paramType)
          Iterates over the parameters in this collection (in order) which are of the specified Java type, or are subclasses of the specified Java type.
 List getParameters(String parameterId)
          Gets parameters by their context specific id, or by their name, or by a named index.
 int hashCode()
          Gets a hashCode based on the hashCodes of the contained parameters
 void setParameterValues(String parameterId, Object value)
          Sets the value of parameters in this ParameterCollection
 void shadowize()
          Converts all parameters in this collection to shadow parameters.
 int size()
          Gets the number of parameters present in this context (Same as the getParameterCount()) method
 String toString()
          Returns a String representation of this object
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParameterCollection

public ParameterCollection(IContext context)
Creates a new ParameterCollection

Method Detail

addParameter

public void addParameter(IParameter param)
                  throws CMException
Adds a parameter to this collection. If there is already a ShadowParameter at the position the new parameter belongs, then that ShadowParameter is replaced with the new parameter. If the ShadowParameter had a value and the new parameter does not, the ShadowParameter's value and data type are transferred to the new parameter.

CMException

clear

public void clear()
Removes all parameters from this collection


cloneParameterCollection

public ParameterCollection cloneParameterCollection()
Clones this parameter collection


cloneParameterCollection

public ParameterCollection cloneParameterCollection(IContext context)
Clones this parameter collection.

Parameters:
context - An optional parameter; if this is not null, then all of the cloned parameters in this collection will have their contexts set to the specified context.THE SPECIFIED CONTEXT MUST BE A CLONE OF THE PARAMETERS' EXISTING CONTEXT

equals

public boolean equals(Object o)
Tests if two ParameterCollections have equal parameters (in the same order)

Overrides:
equals in class Object

getContext

public IContext getContext()
Gets the context associated with this parameter collection


getDisplayParameters

public Iterator getDisplayParameters()
Iterates over the parameters in this context which should be displayed to the user. The Iterator cannot not be altered.


getParameter

public IParameter getParameter(int index)
Gets a parameter by its index. (The index is zero based.) If no parameter exists at that index, one will be created and returned


getParameter

public IParameter getParameter(int pIndex,
                               boolean pCreate)
Gets a parameter by its index.

Parameters:
pIndex - The zero based index of the parameter to get
pCreate - If this is true and no parameter with the specified index exists, a ShadowParameter will be created at the specified index and returned.

getParameter

public IParameter getParameter(String parameterId)
Gets a parameter by its its context specific id, or by its name, or by a named index. The context specific id looks like ¤3¿ or ¤0¿ The parameter name is the string corresponding to the parameter's key or column (e.g. BALANCE or VAL) The named index is the string "_parm" with the parameter's index appended on the end (e.g. _parm0 or _parm2) If more than one matching parameter exists (which can only happen if a parameter name is passed) then only one matching parameter is returned


getParameterCount

public int getParameterCount()
Gets the number of parameters present in this context (same as the size()) method


getParameterCount

public int getParameterCount(Class paramClass)
Gets the number of parameters present in this context which are of the specified class (or are subclasses of the specified class)


getParameters

public List getParameters()
Gets an unmodifiable List of this collection's IParameter objects (in order).


getParameters

public Iterator getParameters(Class paramType)
Iterates over the parameters in this collection (in order) which are of the specified Java type, or are subclasses of the specified Java type.


getParameters

public List getParameters(String parameterId)
Gets parameters by their context specific id, or by their name, or by a named index. The context specific id looks like ¤3¿ or ¤0¿ The parameter name is the string corresponding to the parameter's key or column (e.g. BALANCE or VAL) The named index is the string "_parm" with the parameter's index appended on the end (e.g. _parm0 or _parm2) The returned List is never null


hashCode

public int hashCode()
Gets a hashCode based on the hashCodes of the contained parameters

Overrides:
hashCode in class Object

setParameterValues

public void setParameterValues(String parameterId,
                               Object value)
                        throws CMException
Sets the value of parameters in this ParameterCollection

Parameters:
parameterId - A String which identifies the parameters whose values will be set. This String can either be a context specific id, a name, or by a named index. The context specific id looks like ¤3¿ or ¤0¿ The parameter name is the string corresponding to the parameter's key or column (e.g. BALANCE or VAL) A parameter name may correspond to multiple parameters, in which case all of these parameters will have their values set by this method The named index is the string "_parm" with the parameter's index appended on the end (e.g. _parm0 or _parm2)
value - The value to set parameters to
CMException

shadowize

public void shadowize()
Converts all parameters in this collection to shadow parameters. The context specific id, index, value, and data type of the converted parameters are retained, all other information in the parameters is lost.


size

public int size()
Gets the number of parameters present in this context (Same as the getParameterCount()) method


toString

public String toString()
Returns a String representation of this object

Overrides:
toString in class Object