Class ParameterBlockImageN
- All Implemented Interfaces:
Serializable,Cloneable,ParameterList
ParameterBlock that allows the use of default parameter values and
getting/setting sources and parameters by name. A ParameterBlockImageN is constructed using either an
OperationDescriptor, or an operation name (that will be looked up in the appropriate default
OperationRegistry) and a mode which should be in OperationDescriptor.getSupportedModes() (such as
rendered, renderable, collection or renderableCollection). If the mode is not specified ParameterBlockImageN
will by default work with the first mode in the array of Strings returned by
OperationDescriptor.getSupportedModes().
Once constructed, a ParameterBlockImageN appears to have no sources. It contains all the parameters
required by its OperationDescriptor for a specified mode, each having its default value as given by the
OperationDescriptor. Such a ParameterBlockImageN may not yet be usable, its sources (if
any) are not set, and some or all of its parameters may have inapproriate values. The addSource methods
of ParameterBlock may be used to initialize the source values, and the set(value, index)
methods may be used to modify new parameter values. The preferred way of setting parameter values is the
setParameter(name, value) described below. The add() methods should not be used since the
parameter list is already long enough to hold all of the parameters required by the OperationDescriptor.
Additionally, ParameterBlockImageN offers setParameter(name, value) methods that take a
parameter name; the index of the parameter is determined from the OperationDescriptor and the
corresponding parameter is set. (users are strongly recommended to use this method instead of the equivalent
set(value, index) or the deprecated set(value, name) methods). As in ParameterBlock,
all parameters are stored internally as subclasses of Object and all get/set methods that take or return values of
primitive types are simply convenience methods that transform values between the primitive types and their
corresponding wrapper classes.
The OperationDescriptor that is used to initialize a ParameterBlockImageN at
construction is not serializable and thus cannot be serialized using the default serialization mechanism. The
operation name is serialized instead and included in the serialized ParameterBlockImageN stream. During
de-serialization, the operation name is de-serialized and then looked up in the default OperationRegistry
available at the time of de-serialization. If no OperationDescriptor has been registered with
this
OperationRegistry under the given operation name, a NotSerializableException will be thrown. The serialization
of ParameterBlockImageN works correctly only if the OperationDescriptor registered for the
operation name in question is identical to the OperationDescriptor that was registered with the
OperationRegistry available at serialization time.
All parameter names are treated in a case-insensitive but retentive manner.
Warning: Serialized objects of this class will not be compatible with future releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of ImageN.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionParameterBlockImageN(String operationName) Constructs aParameterBlockImageNfor a particular operation by name.ParameterBlockImageN(String operationName, String modeName) Constructs aParameterBlockImageNfor a particular operation by name and a registry mode.Constructs aParameterBlockImageNfor use with an operation described by a particularOperationDescriptor.ParameterBlockImageN(OperationDescriptor odesc, String modeName) Constructs aParameterBlockImageNfor use with an operation described by a particularOperationDescriptorand a registry mode. -
Method Summary
Modifier and TypeMethodDescriptionAdds an object to the list of parameters.clone()Creates a copy of aParameterBlockImageN.booleangetBooleanParameter(String paramName) A convenience method to return a parameter as aboolean.bytegetByteParameter(String paramName) A convenience method to return a parameter as abyte.chargetCharParameter(String paramName) A convenience method to return a parameter as achar.doublegetDoubleParameter(String paramName) A convenience method to return a parameter as adouble.floatgetFloatParameter(String paramName) A convenience method to return a parameter as afloat.intgetIntParameter(String paramName) A convenience method to return a parameter as anint.longgetLongParameter(String paramName) A convenience method to return a parameter as along.getMode()Get the operation mode used to determine parameter names, classes and default values.getObjectParameter(String paramName) Gets a named parameter as an Object.Returns theOperationDescriptorassociated with thisParameterBlockImageN.Class[]Returns an array ofClassobjects describing the types of the parameters.Returns theParameterListDescriptorthat provides descriptions of the parameters associated with the operator and mode.shortgetShortParameter(String paramName) A convenience method to return a parameter as anshort.intDeprecated.as of ImageN 0.4.0 - use "indexOfParam" instead.intindexOfParam(String paramName) Returns the zero-relative index of a named parameter within the list of parameters.intindexOfSource(String sourceName) Returns the zero-relative index of a named source within the list of sources.Deprecated.as of ImageN 0.4.0 - usesetParameterinstead.Deprecated.as of ImageN 0.4.0 - usesetParameterinstead.Deprecated.as of ImageN 0.4.0 - usesetParameterinstead.Deprecated.as of ImageN 0.4.0 - usesetParameterinstead.Deprecated.as of ImageN 0.4.0 - usesetParameterinstead.Deprecated.as of ImageN 0.4.0 - usesetParameterinstead.Deprecated.as of ImageN 0.4.0 - usesetParameterinstead.Replaces an Object in the list of parameters.Deprecated.as of ImageN 0.4.0 - usesetParameterinstead.setParameter(String paramName, boolean b) Sets a named parameter to abooleanvalue.setParameter(String paramName, byte b) Sets a named parameter to abytevalue.setParameter(String paramName, char c) Sets a named parameter to acharvalue.setParameter(String paramName, double d) Sets a named parameter to adoublevalue.setParameter(String paramName, float f) Sets a named parameter to afloatvalue.setParameter(String paramName, int i) Sets a named parameter to anintvalue.setParameter(String paramName, long l) Sets a named parameter to alongvalue.setParameter(String paramName, short s) Sets a named parameter to ashortvalue.setParameter(String paramName, Object obj) Sets a named parameter to anObjectvalue.voidsetParameters(Vector parameters) Sets the entireVectorof parameters to a givenVector.Sets a named source to a givenObjectvalue.Methods inherited from class ParameterBlock
add, add, add, add, add, add, add, addSource, getByteParameter, getCharParameter, getDoubleParameter, getFloatParameter, getIntParameter, getLongParameter, getNumParameters, getNumSources, getObjectParameter, getParameters, getRenderableSource, getRenderedSource, getShortParameter, getSource, getSources, removeParameters, removeSources, set, set, set, set, set, set, set, setSource, setSources, shallowClone
-
Constructor Details
-
ParameterBlockImageN
Constructs aParameterBlockImageNfor use with an operation described by a particularOperationDescriptor. It uses the first mode in the array ofStrings returned byOperationDescriptor.getSupportedModes()to get theParameterListDescriptorfromOperationDescriptor. The default values of the parameters are filled in.- Parameters:
odesc- the OperationDescriptor describing the parameters to be managed.- Throws:
IllegalArgumentException- if odesc is null
-
ParameterBlockImageN
Constructs aParameterBlockImageNfor a particular operation by name. TheOperationRegistryassociated with the default instance of theImageNclass is used to locate theOperationDescriptorassociated with the operation name.It uses the first mode in the array of
Strings returned byOperationDescriptor.getSupportedModes()to get theParameterListDescriptorfromOperationDescriptor. The default values of the parameters are filled in.- Parameters:
operationName- aStringgiving the name of the operation.- Throws:
IllegalArgumentException- if operationName is null.
-
ParameterBlockImageN
Constructs aParameterBlockImageNfor use with an operation described by a particularOperationDescriptorand a registry mode. The default values of the parameters are filled in.- Parameters:
odesc- the OperationDescriptor describing the parameters to be managed.modeName- the operation mode whose paramters are to be managed.- Throws:
IllegalArgumentException- if modeName is null or odesc is null
-
ParameterBlockImageN
Constructs aParameterBlockImageNfor a particular operation by name and a registry mode. TheOperationRegistryassociated with the default instance of theImageNclass is used to locate theOperationDescriptorassociated with the operation name. The default values of the parameters are filled in.- Parameters:
operationName- aStringgiving the name of the operation.modeName- the operation mode whose paramters are to be managed.- Throws:
IllegalArgumentException- if operationName or modeName is null
-
-
Method Details
-
indexOfSource
Returns the zero-relative index of a named source within the list of sources.- Parameters:
sourceName- aStringcontaining the parameter name.- Throws:
IllegalArgumentException- if source is null or if there is no source with the specified name.
-
indexOfParam
Returns the zero-relative index of a named parameter within the list of parameters.- Parameters:
paramName- aStringcontaining the parameter name.- Throws:
IllegalArgumentException- if paramName is null or if there is no parameter with the specified name.
-
getOperationDescriptor
Returns theOperationDescriptorassociated with thisParameterBlockImageN. -
getParameterListDescriptor
Returns theParameterListDescriptorthat provides descriptions of the parameters associated with the operator and mode.- Specified by:
getParameterListDescriptorin interfaceParameterList
-
getMode
Get the operation mode used to determine parameter names, classes and default values. -
setSource
Sets a named source to a givenObjectvalue.- Parameters:
sourceName- aStringnaming a source.source- anObjectvalue for the source.- Throws:
IllegalArgumentException- ifsourceis null.IllegalArgumentException- ifsourceNameis null.IllegalArgumentException- ifsourceis not an instance of (any of) the expected class(es).IllegalArgumentException- if the associated operation has no source with the supplied name.
-
getParamClasses
Returns an array ofClassobjects describing the types of the parameters. This is a more efficient implementation than that of the superclass as the parameter classes are known a priori.- Overrides:
getParamClassesin classParameterBlock
-
getObjectParameter
Gets a named parameter as an Object. Parameters belonging to a primitive type, such asint, will be returned as a member of the correspondingNumbersubclass, such asInteger.- Specified by:
getObjectParameterin interfaceParameterList- Parameters:
paramName- the name of the parameter to be returned.- Throws:
IllegalArgumentException- if there is no parameter with the specified name.IllegalStateException- if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT
-
getByteParameter
A convenience method to return a parameter as abyte. An exception will be thrown if the parameter is of a different type.- Specified by:
getByteParameterin interfaceParameterList- Parameters:
paramName- the name of the parameter to be returned.- Throws:
IllegalArgumentException- if there is no parameter with the specified name.ClassCastException- if the parameter is of a different type.IllegalStateException- if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT
-
getBooleanParameter
A convenience method to return a parameter as aboolean. An exception will be thrown if the parameter is of a different type.- Specified by:
getBooleanParameterin interfaceParameterList- Parameters:
paramName- the name of the parameter to be returned.- Throws:
IllegalArgumentException- if there is no parameter with the specified name.ClassCastException- if the parameter is of a different type.IllegalStateException- if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT
-
getCharParameter
A convenience method to return a parameter as achar. An exception will be thrown if the parameter is of a different type.- Specified by:
getCharParameterin interfaceParameterList- Parameters:
paramName- the name of the parameter to be returned.- Throws:
IllegalArgumentException- if there is no parameter with the specified name.ClassCastException- if the parameter is of a different type.IllegalStateException- if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT
-
getShortParameter
A convenience method to return a parameter as anshort. An exception will be thrown if the parameter is of a different type.- Specified by:
getShortParameterin interfaceParameterList- Parameters:
paramName- the name of the parameter to be returned.- Throws:
IllegalArgumentException- if there is no parameter with the specified name.ClassCastException- if the parameter is of a different type.IllegalStateException- if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT
-
getIntParameter
A convenience method to return a parameter as anint. An exception will be thrown if the parameter is of a different type.- Specified by:
getIntParameterin interfaceParameterList- Parameters:
paramName- the name of the parameter to be returned.- Throws:
IllegalArgumentException- if there is no parameter with the specified name.ClassCastException- if the parameter is of a different type.IllegalStateException- if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT
-
getLongParameter
A convenience method to return a parameter as along. An exception will be thrown if the parameter is of a different type.- Specified by:
getLongParameterin interfaceParameterList- Parameters:
paramName- the name of the parameter to be returned.- Throws:
IllegalArgumentException- if there is no parameter with the specified name.ClassCastException- if the parameter is of a different type.IllegalStateException- if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT
-
getFloatParameter
A convenience method to return a parameter as afloat. An exception will be thrown if the parameter is of a different type.- Specified by:
getFloatParameterin interfaceParameterList- Parameters:
paramName- the name of the parameter to be returned.- Throws:
IllegalArgumentException- if there is no parameter with the specified name.ClassCastException- if the parameter is of a different type.IllegalStateException- if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT
-
getDoubleParameter
A convenience method to return a parameter as adouble. An exception will be thrown if the parameter is of a different type.- Specified by:
getDoubleParameterin interfaceParameterList- Parameters:
paramName- the name of the parameter to be returned.- Throws:
IllegalArgumentException- if there is no parameter with the specified name.ClassCastException- if the parameter is of a different type.IllegalStateException- if the parameter value is still ParameterListDescriptor.NO_PARAMETER_DEFAULT
-
setParameter
Sets a named parameter to abytevalue. Checks are made to verify that the parameter is of the rightClasstype and that the value is valid.- Specified by:
setParameterin interfaceParameterList- Parameters:
paramName- aStringnaming a parameter.b- abytevalue for the parameter.- Throws:
IllegalArgumentException- if paramName is null.IllegalArgumentException- if there is no parameter with the specified name.IllegalArgumentException- if the class type of parameter pointed to by the paramName is not aByteIllegalArgumentException- if the parameter value is invalid.
-
setParameter
Sets a named parameter to abooleanvalue. Checks are made to verify that the parameter is of the rightClasstype and that the value is valid.- Specified by:
setParameterin interfaceParameterList- Parameters:
paramName- aStringnaming a parameter.b- abooleanvalue for the parameter.- Throws:
IllegalArgumentException- if paramName is null.IllegalArgumentException- if there is no parameter with the specified name.IllegalArgumentException- if the class type of parameter pointed to by the paramName is not aBooleanIllegalArgumentException- if the parameter value is invalid.
-
setParameter
Sets a named parameter to acharvalue. Checks are made to verify that the parameter is of the rightClasstype and that the value is valid.- Specified by:
setParameterin interfaceParameterList- Parameters:
paramName- aStringnaming a parameter.c- acharvalue for the parameter.- Throws:
IllegalArgumentException- if paramName is null.IllegalArgumentException- if there is no parameter with the specified name.IllegalArgumentException- if the class type of parameter pointed to by the paramName is not aCharacterIllegalArgumentException- if the parameter value is invalid.
-
setParameter
Sets a named parameter to ashortvalue. Checks are made to verify that the parameter is of the rightClasstype and that the value is valid.- Specified by:
setParameterin interfaceParameterList- Parameters:
paramName- aStringnaming a parameter.s- ashortvalue for the parameter.- Throws:
IllegalArgumentException- if paramName is null.IllegalArgumentException- if there is no parameter with the specified name.IllegalArgumentException- if the class type of parameter pointed to by the paramName is not aShortIllegalArgumentException- if the parameter value is invalid.
-
setParameter
Sets a named parameter to anintvalue. Checks are made to verify that the parameter is of the rightClasstype and that the value is valid.- Specified by:
setParameterin interfaceParameterList- Parameters:
paramName- aStringnaming a parameter.i- anintvalue for the parameter.- Throws:
IllegalArgumentException- if paramName is null.IllegalArgumentException- if there is no parameter with the specified name.IllegalArgumentException- if the class type of parameter pointed to by the paramName is not aIntegerIllegalArgumentException- if the parameter value is invalid.
-
setParameter
Sets a named parameter to alongvalue. Checks are made to verify that the parameter is of the rightClasstype and that the value is valid.- Specified by:
setParameterin interfaceParameterList- Parameters:
paramName- aStringnaming a parameter.l- alongvalue for the parameter.- Throws:
IllegalArgumentException- if paramName is null.IllegalArgumentException- if there is no parameter with the specified name.IllegalArgumentException- if the class type of parameter pointed to by the paramName is not aLongIllegalArgumentException- if the parameter value is invalid.
-
setParameter
Sets a named parameter to afloatvalue. Checks are made to verify that the parameter is of the rightClasstype and that the value is valid.- Specified by:
setParameterin interfaceParameterList- Parameters:
paramName- aStringnaming a parameter.f- afloatvalue for the parameter.- Throws:
IllegalArgumentException- if paramName is null.IllegalArgumentException- if there is no parameter with the specified name.IllegalArgumentException- if the class type of parameter pointed to by the paramName is not aFloatIllegalArgumentException- if the parameter value is invalid.
-
setParameter
Sets a named parameter to adoublevalue. Checks are made to verify that the parameter is of the rightClasstype and that the value is valid.- Specified by:
setParameterin interfaceParameterList- Parameters:
paramName- aStringnaming a parameter.d- adoublevalue for the parameter.- Throws:
IllegalArgumentException- if paramName is null.IllegalArgumentException- if there is no parameter with the specified name.IllegalArgumentException- if the class type of parameter pointed to by the paramName is not aDoubleIllegalArgumentException- if the parameter value is invalid.
-
setParameter
Sets a named parameter to anObjectvalue. The value may benull, an instance of the class expected for this parameter, or aDeferredDatainstance thegetDataClass()method of which returns the expected class. If the object is aDeferredDatainstance, then its wrapped data value is checked for validity if and only if itsisValid()method returnstrue. If the object is not aDeferredDatainstance, then it is always checked for validity.- Specified by:
setParameterin interfaceParameterList- Parameters:
paramName- aStringnaming a parameter.obj- anObjectvalue for the parameter.- Throws:
IllegalArgumentException- if paramName is null.IllegalArgumentException- if there is no parameter with the specified name.IllegalArgumentException- if the parameter value is invalid.
-
add
Adds an object to the list of parameters.This method always throws an
IllegalStateExceptionbecause theParameterBlockImageNconstructor initializes all parameters with their default values.- Overrides:
addin classParameterBlock- Throws:
IllegalStateException- if parameters are added to an already initialized ParameterBlockImageN
-
set
Replaces an Object in the list of parameters.- Overrides:
setin classParameterBlock- Parameters:
obj- The new value of the parameter.index- The zero-relative index of the parameter.- Throws:
ArrayIndexOutOfBoundsException- ifindexis negative or not less than the number of parameters expected for the associated operation.IllegalArgumentException- ifobjis non-nulland not an instance of the class expected for the indicated parameter or ifobjis an invalid value for the indicated parameter.
-
setParameters
Sets the entireVectorof parameters to a givenVector. TheVectoris saved by reference.- Overrides:
setParametersin classParameterBlock- Throws:
IllegalArgumentException- if the size of the suppliedVectordoes not equal the number of parameters of the associated operation.IllegalArgumentException- if a non-null, non-DeferredDatavalue is not an instance of the class expected for the indicated parameter or ifobjis an invalid value for the indicated parameter.IllegalArgumentException- if a non-null,DeferredDatavalue does not wrap an instance of the class expected for the indicated parameter or if it is valid but its wrapped value is invalid for the indicated parameter.
-
indexOf
Deprecated.as of ImageN 0.4.0 - use "indexOfParam" instead.Returns the zero-relative index of a named parameter within the list of parameters.- Parameters:
paramName- aStringcontaining the parameter name.- Throws:
IllegalArgumentException- if paramName is null or if there is no parameter with the specified name.- See Also:
-
set
Deprecated.as of ImageN 0.4.0 - usesetParameterinstead.Sets a named parameter to abytevalue.- Parameters:
paramName- aStringnaming a parameter.b- abytevalue for the parameter.- Throws:
IllegalArgumentException- if paramName is null.IllegalArgumentException- if there is no parameter with the specified name.- See Also:
-
set
Deprecated.as of ImageN 0.4.0 - usesetParameterinstead.Sets a named parameter to acharvalue.- Parameters:
paramName- aStringnaming a parameter.c- acharvalue for the parameter.- Throws:
IllegalArgumentException- if paramName is null.IllegalArgumentException- if there is no parameter with the specified name.- See Also:
-
set
Deprecated.as of ImageN 0.4.0 - usesetParameterinstead.Sets a named parameter to a short value.- Parameters:
paramName- aStringnaming a parameter.s- a short value for the parameter.- Throws:
IllegalArgumentException- if paramName is null.IllegalArgumentException- if there is no parameter with the specified name.- See Also:
-
set
Deprecated.as of ImageN 0.4.0 - usesetParameterinstead.Sets a named parameter to anintvalue.- Parameters:
paramName- aStringnaming a parameter.i- anintvalue for the parameter.- Throws:
IllegalArgumentException- if paramName is null.IllegalArgumentException- if there is no parameter with the specified name.- See Also:
-
set
Deprecated.as of ImageN 0.4.0 - usesetParameterinstead.Sets a named parameter to alongvalue.- Parameters:
paramName- aStringnaming a parameter.l- alongvalue for the parameter.- Throws:
IllegalArgumentException- if paramName is null.IllegalArgumentException- if there is no parameter with the specified name.- See Also:
-
set
Deprecated.as of ImageN 0.4.0 - usesetParameterinstead.Sets a named parameter to afloatvalue.- Parameters:
paramName- aStringnaming a parameter.f- afloatvalue for the parameter.- Throws:
IllegalArgumentException- if paramName is null.IllegalArgumentException- if there is no parameter with the specified name.- See Also:
-
set
Deprecated.as of ImageN 0.4.0 - usesetParameterinstead.Sets a named parameter to adoublevalue.- Parameters:
paramName- aStringnaming a parameter.d- adoublevalue for the parameter.- Throws:
IllegalArgumentException- if paramName is null.IllegalArgumentException- if there is no parameter with the specified name.- See Also:
-
set
Deprecated.as of ImageN 0.4.0 - usesetParameterinstead.Sets a named parameter to an Object value.- Parameters:
paramName- aStringnaming a parameter.obj- an Object value for the parameter.- Throws:
IllegalArgumentException- if obj is null, or if the class type of obj does not match the class type of parameter pointed to by the paramName.IllegalArgumentException- if paramName is null.IllegalArgumentException- if there is no parameter with the specified name.- See Also:
-
clone
Creates a copy of aParameterBlockImageN. The source and parameter Vectors are cloned, but the actual sources and parameters are copied by reference. This allows modifications to the order and number of sources and parameters in the clone to be invisible to the originalParameterBlockImageN. Changes to the shared sources or parameters themselves will still be visible.- Overrides:
clonein classParameterBlock- Returns:
- an Object clone of the
ParameterBlockImageN.
-