Java Doc for ParameterBlock.java in  » 6.0-JDK-Core » AWT » java » awt » image » renderable » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » AWT » java.awt.image.renderable 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.awt.image.renderable.ParameterBlock

ParameterBlock
public class ParameterBlock implements Cloneable,Serializable(Code)
A ParameterBlock encapsulates all the information about sources and parameters (Objects) required by a RenderableImageOp, or other classes that process images.

Although it is possible to place arbitrary objects in the source Vector, users of this class may impose semantic constraints such as requiring all sources to be RenderedImages or RenderableImage. ParameterBlock itself is merely a container and performs no checking on source or parameter types.

All parameters in a ParameterBlock are objects; convenience add and set methods are available that take arguments of base type and construct the appropriate subclass of Number (such as Integer or Float). Corresponding get methods perform a downward cast and have return values of base type; an exception will be thrown if the stored values do not have the correct type. There is no way to distinguish between the results of "short s; add(s)" and "add(new Short(s))".

Note that the get and set methods operate on references. Therefore, one must be careful not to share references between ParameterBlocks when this is inappropriate. For example, to create a new ParameterBlock that is equal to an old one except for an added source, one might be tempted to write:

 ParameterBlock addSource(ParameterBlock pb, RenderableImage im) {
 ParameterBlock pb1 = new ParameterBlock(pb.getSources());
 pb1.addSource(im);
 return pb1;
 }
 

This code will have the side effect of altering the original ParameterBlock, since the getSources operation returned a reference to its source Vector. Both pb and pb1 share their source Vector, and a change in either is visible to both.

A correct way to write the addSource function is to clone the source Vector:

 ParameterBlock addSource (ParameterBlock pb, RenderableImage im) {
 ParameterBlock pb1 = new ParameterBlock(pb.getSources().clone());
 pb1.addSource(im);
 return pb1;
 }
 

The clone method of ParameterBlock has been defined to perform a clone of both the source and parameter Vectors for this reason. A standard, shallow clone is available as shallowClone.

The addSource, setSource, add, and set methods are defined to return 'this' after adding their argument. This allows use of syntax like:

 ParameterBlock pb = new ParameterBlock();
 op = new RenderableImageOp("operation", pb.add(arg1).add(arg2));
 


Field Summary
protected  Vector<Object>parameters
     A Vector of non-source parameters, stored as arbitrary Objects.
protected  Vector<Object>sources
     A Vector of sources, stored as arbitrary Objects.

Constructor Summary
public  ParameterBlock()
     A dummy constructor.
public  ParameterBlock(Vector<Object> sources)
     Constructs a ParameterBlock with a given Vector of sources.
public  ParameterBlock(Vector<Object> sources, Vector<Object> parameters)
     Constructs a ParameterBlock with a given Vector of sources and Vector of parameters.

Method Summary
public  ParameterBlockadd(Object obj)
     Adds an object to the list of parameters.
public  ParameterBlockadd(byte b)
     Adds a Byte to the list of parameters.
public  ParameterBlockadd(char c)
     Adds a Character to the list of parameters.
public  ParameterBlockadd(short s)
     Adds a Short to the list of parameters.
public  ParameterBlockadd(int i)
     Adds a Integer to the list of parameters.
public  ParameterBlockadd(long l)
     Adds a Long to the list of parameters.
public  ParameterBlockadd(float f)
     Adds a Float to the list of parameters.
public  ParameterBlockadd(double d)
     Adds a Double to the list of parameters.
public  ParameterBlockaddSource(Object source)
     Adds an image to end of the list of sources.
public  Objectclone()
     Creates a copy of a ParameterBlock.
public  bytegetByteParameter(int index)
     A convenience method to return a parameter as a byte.
public  chargetCharParameter(int index)
     A convenience method to return a parameter as a char.
public  doublegetDoubleParameter(int index)
     A convenience method to return a parameter as a double.
public  floatgetFloatParameter(int index)
     A convenience method to return a parameter as a float.
public  intgetIntParameter(int index)
     A convenience method to return a parameter as an int.
public  longgetLongParameter(int index)
     A convenience method to return a parameter as a long.
public  intgetNumParameters()
     Returns the number of parameters (not including source images).
public  intgetNumSources()
     Returns the number of source images.
public  ObjectgetObjectParameter(int index)
     Gets a parameter as an object.
public  Class[]getParamClasses()
     Returns an array of Class objects describing the types of the parameters.
public  Vector<Object>getParameters()
     Returns the entire Vector of parameters.
public  RenderableImagegetRenderableSource(int index)
     Returns a source as a RenderableImage.
public  RenderedImagegetRenderedSource(int index)
     Returns a source as a RenderedImage.
public  shortgetShortParameter(int index)
     A convenience method to return a parameter as a short.
public  ObjectgetSource(int index)
     Returns a source as a general Object.
public  Vector<Object>getSources()
     Returns the entire Vector of sources.
public  voidremoveParameters()
     Clears the list of parameters.
public  voidremoveSources()
     Clears the list of source images.
public  ParameterBlockset(Object obj, int index)
     Replaces an Object in the list of parameters.
public  ParameterBlockset(byte b, int index)
     Replaces an Object in the list of parameters with a Byte.
public  ParameterBlockset(char c, int index)
     Replaces an Object in the list of parameters with a Character.
public  ParameterBlockset(short s, int index)
     Replaces an Object in the list of parameters with a Short.
public  ParameterBlockset(int i, int index)
     Replaces an Object in the list of parameters with an Integer.
public  ParameterBlockset(long l, int index)
     Replaces an Object in the list of parameters with a Long.
public  ParameterBlockset(float f, int index)
     Replaces an Object in the list of parameters with a Float.
public  ParameterBlockset(double d, int index)
     Replaces an Object in the list of parameters with a Double.
public  voidsetParameters(Vector<Object> parameters)
     Sets the entire Vector of parameters to a given Vector.
public  ParameterBlocksetSource(Object source, int index)
     Replaces an entry in the list of source with a new source.
public  voidsetSources(Vector<Object> sources)
     Sets the entire Vector of sources to a given Vector.
public  ObjectshallowClone()
     Creates a shallow copy of a ParameterBlock.

Field Detail
parameters
protected Vector<Object> parameters(Code)
A Vector of non-source parameters, stored as arbitrary Objects.



sources
protected Vector<Object> sources(Code)
A Vector of sources, stored as arbitrary Objects.




Constructor Detail
ParameterBlock
public ParameterBlock()(Code)
A dummy constructor.



ParameterBlock
public ParameterBlock(Vector<Object> sources)(Code)
Constructs a ParameterBlock with a given Vector of sources.
Parameters:
  sources - a Vector of source images



ParameterBlock
public ParameterBlock(Vector<Object> sources, Vector<Object> parameters)(Code)
Constructs a ParameterBlock with a given Vector of sources and Vector of parameters.
Parameters:
  sources - a Vector of source images
Parameters:
  parameters - a Vector of parameters to be used in therendering operation




Method Detail
add
public ParameterBlock add(Object obj)(Code)
Adds an object to the list of parameters.
Parameters:
  obj - the Object to add to the parameters Vector a new ParameterBlock containing the specified parameter.



add
public ParameterBlock add(byte b)(Code)
Adds a Byte to the list of parameters.
Parameters:
  b - the byte to add to the parameters Vector a new ParameterBlock containing the specified parameter.



add
public ParameterBlock add(char c)(Code)
Adds a Character to the list of parameters.
Parameters:
  c - the char to add to the parameters Vector a new ParameterBlock containing the specified parameter.



add
public ParameterBlock add(short s)(Code)
Adds a Short to the list of parameters.
Parameters:
  s - the short to add to the parameters Vector a new ParameterBlock containing the specified parameter.



add
public ParameterBlock add(int i)(Code)
Adds a Integer to the list of parameters.
Parameters:
  i - the int to add to the parameters Vector a new ParameterBlock containing the specified parameter.



add
public ParameterBlock add(long l)(Code)
Adds a Long to the list of parameters.
Parameters:
  l - the long to add to the parameters Vector a new ParameterBlock containing the specified parameter.



add
public ParameterBlock add(float f)(Code)
Adds a Float to the list of parameters.
Parameters:
  f - the float to add to the parameters Vector a new ParameterBlock containing the specified parameter.



add
public ParameterBlock add(double d)(Code)
Adds a Double to the list of parameters.
Parameters:
  d - the double to add to the parameters Vector a new ParameterBlock containing the specified parameter.



addSource
public ParameterBlock addSource(Object source)(Code)
Adds an image to end of the list of sources. The image is stored as an object in order to allow new node types in the future.
Parameters:
  source - an image object to be stored in the source list. a new ParameterBlock containing the specifiedsource.



clone
public Object clone()(Code)
Creates a copy of a ParameterBlock. 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 original ParameterBlock. Changes to the shared sources or parameters themselves will still be visible. an Object clone of the ParameterBlock.



getByteParameter
public byte getByteParameter(int index)(Code)
A convenience method to return a parameter as a byte. An exception is thrown if the parameter is null or not a Byte.
Parameters:
  index - the index of the parameter to be returned. the parameter at the specified indexas a byte value.
throws:
  ClassCastException - if the parameter at thespecified index is not a Byte
throws:
  NullPointerException - if the parameter at the specifiedindex is null
throws:
  ArrayIndexOutOfBoundsException - if indexis negative or not less than the current size of thisParameterBlock object



getCharParameter
public char getCharParameter(int index)(Code)
A convenience method to return a parameter as a char. An exception is thrown if the parameter is null or not a Character.
Parameters:
  index - the index of the parameter to be returned. the parameter at the specified index as a char value.
throws:
  ClassCastException - if the parameter at thespecified index is not a Character
throws:
  NullPointerException - if the parameter at the specifiedindex is null
throws:
  ArrayIndexOutOfBoundsException - if indexis negative or not less than the current size of thisParameterBlock object



getDoubleParameter
public double getDoubleParameter(int index)(Code)
A convenience method to return a parameter as a double. An exception is thrown if the parameter is null or not a Double.
Parameters:
  index - the index of the parameter to be returned. the parameter at the specified index as a double value.
throws:
  ClassCastException - if the parameter at thespecified index is not a Double
throws:
  NullPointerException - if the parameter at the specifiedindex is null
throws:
  ArrayIndexOutOfBoundsException - if indexis negative or not less than the current size of thisParameterBlock object



getFloatParameter
public float getFloatParameter(int index)(Code)
A convenience method to return a parameter as a float. An exception is thrown if the parameter is null or not a Float.
Parameters:
  index - the index of the parameter to be returned. the parameter at the specified index as a float value.
throws:
  ClassCastException - if the parameter at thespecified index is not a Float
throws:
  NullPointerException - if the parameter at the specifiedindex is null
throws:
  ArrayIndexOutOfBoundsException - if indexis negative or not less than the current size of thisParameterBlock object



getIntParameter
public int getIntParameter(int index)(Code)
A convenience method to return a parameter as an int. An exception is thrown if the parameter is null or not an Integer.
Parameters:
  index - the index of the parameter to be returned. the parameter at the specified index as a int value.
throws:
  ClassCastException - if the parameter at thespecified index is not a Integer
throws:
  NullPointerException - if the parameter at the specifiedindex is null
throws:
  ArrayIndexOutOfBoundsException - if indexis negative or not less than the current size of thisParameterBlock object



getLongParameter
public long getLongParameter(int index)(Code)
A convenience method to return a parameter as a long. An exception is thrown if the parameter is null or not a Long.
Parameters:
  index - the index of the parameter to be returned. the parameter at the specified index as a long value.
throws:
  ClassCastException - if the parameter at thespecified index is not a Long
throws:
  NullPointerException - if the parameter at the specifiedindex is null
throws:
  ArrayIndexOutOfBoundsException - if indexis negative or not less than the current size of thisParameterBlock object



getNumParameters
public int getNumParameters()(Code)
Returns the number of parameters (not including source images). the number of parameters in the parametersVector.



getNumSources
public int getNumSources()(Code)
Returns the number of source images. the number of source images in the sourcesVector.



getObjectParameter
public Object getObjectParameter(int index)(Code)
Gets a parameter as an object.
Parameters:
  index - the index of the parameter to get an Object representing thethe parameter at the specified indexinto the parametersVector.



getParamClasses
public Class[] getParamClasses()(Code)
Returns an array of Class objects describing the types of the parameters. an array of Class objects.



getParameters
public Vector<Object> getParameters()(Code)
Returns the entire Vector of parameters. the parameters Vector.
See Also:   ParameterBlock.setParameters(Vector)



getRenderableSource
public RenderableImage getRenderableSource(int index)(Code)
Returns a source as a RenderableImage. This method is a convenience method. An exception will be thrown if the sources is not a RenderableImage.
Parameters:
  index - the index of the source to be returned a RenderableImage that represents the sourceimage that is at the specified index in the sources Vector.



getRenderedSource
public RenderedImage getRenderedSource(int index)(Code)
Returns a source as a RenderedImage. This method is a convenience method. An exception will be thrown if the source is not a RenderedImage.
Parameters:
  index - the index of the source to be returned a RenderedImage that represents the sourceimage that is at the specified index in the sources Vector.



getShortParameter
public short getShortParameter(int index)(Code)
A convenience method to return a parameter as a short. An exception is thrown if the parameter is null or not a Short.
Parameters:
  index - the index of the parameter to be returned. the parameter at the specified index as a short value.
throws:
  ClassCastException - if the parameter at thespecified index is not a Short
throws:
  NullPointerException - if the parameter at the specifiedindex is null
throws:
  ArrayIndexOutOfBoundsException - if indexis negative or not less than the current size of thisParameterBlock object



getSource
public Object getSource(int index)(Code)
Returns a source as a general Object. The caller must cast it into an appropriate type.
Parameters:
  index - the index of the source to be returned. an Object that represents the source locatedat the specified index in the sourcesVector.
See Also:   ParameterBlock.setSource(Object,int)



getSources
public Vector<Object> getSources()(Code)
Returns the entire Vector of sources. the sources Vector.
See Also:   ParameterBlock.setSources(Vector)
See Also:   



removeParameters
public void removeParameters()(Code)
Clears the list of parameters.



removeSources
public void removeSources()(Code)
Clears the list of source images.



set
public ParameterBlock set(Object obj, int index)(Code)
Replaces an Object in the list of parameters. If the index lies beyond the current source list, the list is extended with nulls as needed.
Parameters:
  obj - the parameter that replaces the parameter at the specified index in theparameters Vector
Parameters:
  index - the index of the parameter to be replaced with the specified parameter a new ParameterBlock containingthe specified parameter.



set
public ParameterBlock set(byte b, int index)(Code)
Replaces an Object in the list of parameters with a Byte. If the index lies beyond the current source list, the list is extended with nulls as needed.
Parameters:
  b - the parameter that replaces the parameter at the specified index in theparameters Vector
Parameters:
  index - the index of the parameter to be replaced with the specified parameter a new ParameterBlock containingthe specified parameter.



set
public ParameterBlock set(char c, int index)(Code)
Replaces an Object in the list of parameters with a Character. If the index lies beyond the current source list, the list is extended with nulls as needed.
Parameters:
  c - the parameter that replaces the parameter at the specified index in theparameters Vector
Parameters:
  index - the index of the parameter to be replaced with the specified parameter a new ParameterBlock containingthe specified parameter.



set
public ParameterBlock set(short s, int index)(Code)
Replaces an Object in the list of parameters with a Short. If the index lies beyond the current source list, the list is extended with nulls as needed.
Parameters:
  s - the parameter that replaces the parameter at the specified index in theparameters Vector
Parameters:
  index - the index of the parameter to be replaced with the specified parameter a new ParameterBlock containingthe specified parameter.



set
public ParameterBlock set(int i, int index)(Code)
Replaces an Object in the list of parameters with an Integer. If the index lies beyond the current source list, the list is extended with nulls as needed.
Parameters:
  i - the parameter that replaces the parameter at the specified index in theparameters Vector
Parameters:
  index - the index of the parameter to be replaced with the specified parameter a new ParameterBlock containingthe specified parameter.



set
public ParameterBlock set(long l, int index)(Code)
Replaces an Object in the list of parameters with a Long. If the index lies beyond the current source list, the list is extended with nulls as needed.
Parameters:
  l - the parameter that replaces the parameter at the specified index in theparameters Vector
Parameters:
  index - the index of the parameter to be replaced with the specified parameter a new ParameterBlock containingthe specified parameter.



set
public ParameterBlock set(float f, int index)(Code)
Replaces an Object in the list of parameters with a Float. If the index lies beyond the current source list, the list is extended with nulls as needed.
Parameters:
  f - the parameter that replaces the parameter at the specified index in theparameters Vector
Parameters:
  index - the index of the parameter to be replaced with the specified parameter a new ParameterBlock containingthe specified parameter.



set
public ParameterBlock set(double d, int index)(Code)
Replaces an Object in the list of parameters with a Double. If the index lies beyond the current source list, the list is extended with nulls as needed.
Parameters:
  d - the parameter that replaces the parameter at the specified index in theparameters Vector
Parameters:
  index - the index of the parameter to be replaced with the specified parameter a new ParameterBlock containingthe specified parameter.



setParameters
public void setParameters(Vector<Object> parameters)(Code)
Sets the entire Vector of parameters to a given Vector.
Parameters:
  parameters - the specified Vector ofparameters
See Also:   ParameterBlock.getParameters



setSource
public ParameterBlock setSource(Object source, int index)(Code)
Replaces an entry in the list of source with a new source. If the index lies beyond the current source list, the list is extended with nulls as needed.
Parameters:
  source - the specified source image
Parameters:
  index - the index into the sources Vector at which toinsert the specified source a new ParameterBlock that contains thespecified source at the specifiedindex.
See Also:   ParameterBlock.getSource(int)



setSources
public void setSources(Vector<Object> sources)(Code)
Sets the entire Vector of sources to a given Vector.
Parameters:
  sources - the Vector of source images
See Also:   ParameterBlock.getSources



shallowClone
public Object shallowClone()(Code)
Creates a shallow copy of a ParameterBlock. The source and parameter Vectors are copied by reference -- additions or changes will be visible to both versions. an Object clone of the ParameterBlock.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.