FileDocCategorySizeDatePackage
ParameterBlock.javaAPI DocAndroid 1.5 API15343Wed May 06 22:41:54 BST 2009java.awt.image.renderable

ParameterBlock

public class ParameterBlock extends Object implements Serializable, Cloneable
The class ParameterBlock groups an indexed set of parameter data with a set of renderable (source) images. The mapping between the indexed parameters and their property names is provided by a {@link ContextualRenderedImageFactory}.
since
Android 1.0

Fields Summary
private static final long
serialVersionUID
The Constant serialVersionUID.
protected Vector
sources
The sources (renderable images).
protected Vector
parameters
The parameters.
Constructors Summary
public ParameterBlock(Vector sources, Vector parameters)
Instantiates a new parameter block.

param
sources the vector of source images.
param
parameters the vector of parameters.


                                                  
         
        setSources(sources);
        setParameters(parameters);
    
public ParameterBlock(Vector sources)
Instantiates a new parameter block with no parameters.

param
sources the vector of source images.

        setSources(sources);
    
public ParameterBlock()
Instantiates a new parameter block with no image or parameter vectors.

    
Methods Summary
public java.awt.image.renderable.ParameterBlockadd(short s)
Wraps the short value in a Short and adds it to the parameter block.

param
s the short value of the parameter.
return
this parameter block.

        return add(new Short(s));
    
public java.awt.image.renderable.ParameterBlockadd(long l)
Wraps the long value in a Long and adds it to the parameter block.

param
l the long value of the parameter.
return
this parameter block.

        return add(new Long(l));
    
public java.awt.image.renderable.ParameterBlockadd(int i)
Wraps the integer value in an Integer and adds it to the parameter block.

param
i the integer value of the parameter.
return
this parameter block.

        return add(new Integer(i));
    
public java.awt.image.renderable.ParameterBlockadd(float f)
Wraps the float value in a Float and adds it to the parameter block.

param
f the float value of the parameter.
return
this parameter block.

        return add(new Float(f));
    
public java.awt.image.renderable.ParameterBlockadd(double d)
Wraps the double value in a Double and adds it to the parameter block.

param
d the double value of the parameter.
return
this parameter block.

        return add(new Double(d));
    
public java.awt.image.renderable.ParameterBlockadd(char c)
Wraps the char value in a Character and adds it to the parameter block.

param
c the char value of the parameter.
return
this parameter block.

        return add(new Character(c));
    
public java.awt.image.renderable.ParameterBlockadd(byte b)
Wraps the byte value in a Byte and adds it to the parameter block.

param
b the byte value of the parameter.
return
the parameter block.

        return add(new Byte(b));
    
public java.awt.image.renderable.ParameterBlockadd(java.lang.Object obj)
Adds the object to the vector of parameter values

param
obj the obj to add.
return
this parameter block.

        parameters.addElement(obj);
        return this;
    
public java.awt.image.renderable.ParameterBlockaddSource(java.lang.Object source)
Adds a source to the vector of sources.

param
source the source to add.
return
this parameter block.

        sources.addElement(source);
        return this;
    
public java.lang.Objectclone()
Returns a copy of this ParameterBlock instance.

return
the identical copy of this instance.

        ParameterBlock replica;
        try {
            replica = (ParameterBlock)super.clone();
        } catch (Exception e) {
            return null;
        }
        if (sources != null) {
            replica.setSources((Vector<Object>)(sources.clone()));
        }
        if (parameters != null) {
            replica.setParameters((Vector<Object>)(parameters.clone()));
        }
        return replica;
    
public bytegetByteParameter(int index)
Gets the byte-valued parameter found at the desired index in the vector of parameter values.

param
index the index.
return
the byte parameter.

        return ((Byte)parameters.elementAt(index)).byteValue();
    
public chargetCharParameter(int index)
Gets the char-valued parameter found at the desired index in the vector of parameter values.

param
index the index.
return
the char parameter.

        return ((Character)parameters.elementAt(index)).charValue();
    
public doublegetDoubleParameter(int index)
Gets the double-valued parameter found at the desired index in the vector of parameter values.

param
index the index.
return
the double parameter.

        return ((Double)parameters.elementAt(index)).doubleValue();
    
public floatgetFloatParameter(int index)
Gets the float-valued parameter found at the desired index in the vector of parameter values.

param
index the index.
return
the float parameter.

        return ((Float)parameters.elementAt(index)).floatValue();
    
public intgetIntParameter(int index)
Gets the integer-valued parameter found at the desired index in the vector of parameter values.

param
index the index.
return
the integer parameter.

        return ((Integer)parameters.elementAt(index)).intValue();
    
public longgetLongParameter(int index)
Gets the long-valued parameter found at the desired index in the vector of parameter values.

param
index the index.
return
the long parameter.

        return ((Long)parameters.elementAt(index)).longValue();
    
public intgetNumParameters()
Gets the number of elements in the vector of parameters.

return
the number of elements in the vector of parameters.

        return parameters.size();
    
public intgetNumSources()
Gets the number of elements in the vector of sources.

return
the number of elements in the vector of sources.

        return sources.size();
    
public java.lang.ObjectgetObjectParameter(int index)
Gets the object parameter found at the specified index.

param
index the index.
return
the parameter object found at the specified index.

        return parameters.elementAt(index);
    
public java.lang.Class[]getParamClasses()
Gets an array of classes corresponding to all of the parameter values found in the array of parameters, in order.

return
the parameter classes.

        int count = parameters.size();
        Class paramClasses[] = new Class[count];

        for (int i = 0; i < count; i++) {
            paramClasses[i] = parameters.elementAt(i).getClass();
        }
        return paramClasses;
    
public java.util.VectorgetParameters()
Gets the vector of parameters.

return
the parameters.

        return parameters;
    
public java.awt.image.renderable.RenderableImagegetRenderableSource(int index)
Gets the renderable source image found at the specified index in the source array.

param
index the index.
return
the renderable source image.

        return (RenderableImage)sources.elementAt(index);
    
public java.awt.image.RenderedImagegetRenderedSource(int index)
Gets the RenderedImage at the specified index from the vector of source images.

param
index the index.
return
the rendered image.

        return (RenderedImage)sources.elementAt(index);
    
public shortgetShortParameter(int index)
Gets the short-valued parameter found at the desired index in the vector of parameter values.

param
index the index.
return
the short parameter.

        return ((Short)parameters.elementAt(index)).shortValue();
    
public java.lang.ObjectgetSource(int index)
Gets the source at the specified index.

param
index the index.
return
the source object found at the specified index.

        return sources.elementAt(index);
    
public java.util.VectorgetSources()
Gets the vector of sources.

return
the sources.

        return sources;
    
public voidremoveParameters()
Clears the vector of parameters.

        parameters.removeAllElements();
    
public voidremoveSources()
Clears the vector of sources.

        sources.removeAllElements();
    
public java.awt.image.renderable.ParameterBlockset(short s, int index)
Wraps the short value in a Short and places it in the parameter block at the specified index.

param
s the short value of the parameter.
param
index the index.
return
this parameter block.

        return set(new Short(s), index);
    
public java.awt.image.renderable.ParameterBlockset(long l, int index)
Wraps the long value in a Long and places it in the parameter block at the specified index.

param
l the long value of the parameter.
param
index the index.
return
this parameter block.

        return set(new Long(l), index);
    
public java.awt.image.renderable.ParameterBlockset(int i, int index)
Wraps the integer value in an Integer and places it in the parameter block at the specified index.

param
i the integer value of the parameter.
param
index the index.
return
this parameter block.

        return set(new Integer(i), index);
    
public java.awt.image.renderable.ParameterBlockset(float f, int index)
Wraps the float value in a Float and places it in the parameter block at the specified index.

param
f the float value of the parameter.
param
index the index.
return
this parameter block.

        return set(new Float(f), index);
    
public java.awt.image.renderable.ParameterBlockset(double d, int index)
Wraps the double value in a Double and places it in the parameter block at the specified index.

param
d the double value of the parameter.
param
index the index.
return
this parameter block.

        return set(new Double(d), index);
    
public java.awt.image.renderable.ParameterBlockset(char c, int index)
Wraps the char value in a Character and places it in the parameter block at the specified index.

param
c the char value of the parameter.
param
index the index.
return
this parameter block.

        return set(new Character(c), index);
    
public java.awt.image.renderable.ParameterBlockset(byte b, int index)
Wraps the byte value in a Byte and places it in the parameter block at the specified index.

param
b the byte value of the parameter.
param
index the index.
return
this parameter block.

        return set(new Byte(b), index);
    
public java.awt.image.renderable.ParameterBlockset(java.lang.Object obj, int index)
Sets the parameter value object at the specified index.

param
obj the parameter value to place at the desired index.
param
index the index where the object is to be placed in the vector of parameters.
return
this parameter block.

        if (parameters.size() < index + 1) {
            parameters.setSize(index + 1);
        }
        parameters.setElementAt(obj, index);
        return this;
    
public voidsetParameters(java.util.Vector parameters)
Sets the vector of parameters, replacing the existing vector of parameters, if any.

param
parameters the new parameters.

        this.parameters = parameters;
    
public java.awt.image.renderable.ParameterBlocksetSource(java.lang.Object source, int index)
Sets the source image at the specified index.

param
source the source image.
param
index the index where the source will be placed.
return
this parameter block.

        if (sources.size() < index + 1) {
            sources.setSize(index + 1);
        }
        sources.setElementAt(source, index);
        return this;
    
public voidsetSources(java.util.Vector sources)
Sets the vector of sources, replacing the existing vector of sources, if any.

param
sources the new sources.

        this.sources = sources;
    
public java.lang.ObjectshallowClone()
Shallow clone (clones using the superclass clone method).

return
the clone of this object.

        try {
            return super.clone();
        } catch (Exception e) {
            return null;
        }