javax.media.jai
Class EnumeratedParameter

java.lang.Object
  extended byjavax.media.jai.EnumeratedParameter
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ColorQuantizerType, CompositeDestAlpha, DFTDataNature, DFTScalingType, MaxFilterShape, MedianFilterShape, MinFilterShape, MosaicType, ShearDir, TransposeType

public class EnumeratedParameter
extends Object
implements Serializable

This class provides a mechanism by which enumerated parameters may be added to subclasses of OperationDescriptorImpl while retaining the ability to perform introspection on the allowable range of values of the enumeration. An example of an enumerated parameter is the type parameter of the "Transpose" operation which is defined in TransposeDescriptor to accept only the values defined by the FLIP_* and ROTATE_* fields of the descriptor.

This class may be used to create enumerated parameters in an OperationDescriptor as follows:

With respect to TransposeDescriptor, the three steps above would be to 1) create a final class TransposeType in the javax.media.jai.operator package; 2) define the type of the "type" parameter as TransposeType.class; and 3) define a static final field of class TransposeType for each of the enumerated values with each field being initialized to an instance of TransposeType with name equal to the name of the field and value to its integral (enumerated) value.

Since:
JAI 1.1
See Also:
OperationDescriptorImpl, TransposeDescriptor, Serialized Form

Constructor Summary
EnumeratedParameter(String name, int value)
          Constructs an EnumeratedParameter with the indicated name and value.
 
Method Summary
 boolean equals(Object o)
          Returns true if and only if the parameter is an instance of the class on which this method is invoked and has either the same name or the same value.
 String getName()
          Returns the name assigned to this EnumeratedParameter when it was constructed.
 int getValue()
          Returns the value assigned to this EnumeratedParameter when it was constructed.
 int hashCode()
          Returns a hash code value for the object.
 String toString()
          Returns a String representation of this EnumeratedParameter as a concatentation of the form
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EnumeratedParameter

public EnumeratedParameter(String name,
                           int value)
Constructs an EnumeratedParameter with the indicated name and value.

Method Detail

getName

public String getName()
Returns the name assigned to this EnumeratedParameter when it was constructed.


getValue

public int getValue()
Returns the value assigned to this EnumeratedParameter when it was constructed.


hashCode

public int hashCode()
Returns a hash code value for the object.


equals

public boolean equals(Object o)
Returns true if and only if the parameter is an instance of the class on which this method is invoked and has either the same name or the same value.


toString

public String toString()
Returns a String representation of this EnumeratedParameter as a concatentation of the form
 [class name]:[parameter name]=[parameter value]
 
For example, for an instance of a subclass org.foobar.jai.EnumParam with name "SomeValue" and value "2" the returned String would be
 org.foobar.jai.EnumParam:SomeValue=2