- java.lang.Object
 -  
      
- java.awt.image.renderable.ParameterBlock
 
 
-  
       
- 实现的所有接口
 -  
         
Serializable,Cloneable 
public class ParameterBlock extends Object implements Cloneable, Serializable
ParameterBlock封装了有关RenderableImageOp或其他处理图像的类所需的源和参数(对象)的所有信息。虽然可以在源Vector中放置任意对象,但是此类的用户可能会施加语义约束,例如要求所有源都是RenderedImages或RenderableImage。
ParameterBlock本身只是一个容器,不会检查源或参数类型。ParameterBlock中的所有参数都是对象; 方便的add和set方法可用于获取基类型的参数并构造Number的相应子类(例如Integer或Float)。 相应的get方法执行向下转换并具有基类型的返回值; 如果存储的值没有正确的类型,则抛出异常。 无法区分“short s; add(s)”和“add(new Short(s))”的结果。请注意,get和set方法对引用进行操作。 因此,当不合适时,必须注意不要在
ParameterBlock之间共享引用。 例如,要创建一个新的ParameterBlock,除了添加的源之外,它等于旧的,可能有人想写:ParameterBlock addSource(ParameterBlock pb, RenderableImage im) { ParameterBlock pb1 = new ParameterBlock(pb.getSources()); pb1.addSource(im); return pb1; }此代码将具有更改原始
ParameterBlock,因为getSources操作返回对其源Vector的引用。 pb和pb1都共享它们的源Vector,并且两者中的任何一个都可以看到。编写addSource函数的正确方法是克隆源Vector:
ParameterBlock addSource (ParameterBlock pb, RenderableImage im) { ParameterBlock pb1 = new ParameterBlock(pb.getSources().clone()); pb1.addSource(im); return pb1; }由于这个原因,已经定义了
ParameterBlock的克隆方法以执行源和参数向量的克隆。 标准的浅克隆可用作shallowClone。addSource,setSource,add和set方法被定义为在添加参数后返回'this'。 这允许使用如下语法:
ParameterBlock pb = new ParameterBlock(); op = new RenderableImageOp("operation", pb.add(arg1).add(arg2));- 另请参见:
 - Serialized Form
 
 
-  
        
       
-  
             
构造方法摘要
构造方法 构造器 描述 ParameterBlock()虚拟构造函数。ParameterBlock(Vector<Object> sources)使用给定的源向量构造ParameterBlock。ParameterBlock(Vector<Object> sources, Vector<Object> parameters)使用给定的源向量和参数向量构造ParameterBlock。 
-  
             
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 ParameterBlockadd(byte b)将字节添加到参数列表中。ParameterBlockadd(char c)将一个Character添加到参数列表中。ParameterBlockadd(double d)将Double添加到参数列表中。ParameterBlockadd(float f)将Float添加到参数列表中。ParameterBlockadd(int i)将Integer添加到参数列表中。ParameterBlockadd(long l)将Long添加到参数列表中。ParameterBlockadd(short s)在参数列表中添加Short。ParameterBlockadd(Object obj)将对象添加到参数列表中。ParameterBlockaddSource(Object source)将图像添加到源列表的末尾。Objectclone()创建ParameterBlock的副本。bytegetByteParameter(int index)将参数作为字节返回的便捷方法。chargetCharParameter(int index)将参数作为char返回的便捷方法。doublegetDoubleParameter(int index)将参数作为double返回的便捷方法。floatgetFloatParameter(int index)将参数作为float返回的便捷方法。intgetIntParameter(int index)将参数作为int返回的便捷方法。longgetLongParameter(int index)将参数作为long返回的便捷方法。intgetNumParameters()返回参数数量(不包括源图像)。intgetNumSources()返回源图像的数量。ObjectgetObjectParameter(int index)获取参数作为对象。类<?>[]getParamClasses()返回描述参数类型的Class对象数组。Vector<Object>getParameters()返回整个参数Vector。RenderableImagegetRenderableSource(int index)将源返回为RenderableImage。RenderedImagegetRenderedSource(int index)将源返回为RenderedImage。shortgetShortParameter(int index)将参数作为short返回的便捷方法。ObjectgetSource(int index)将源作为常规Object返回。Vector<Object>getSources()返回整个Vector数据源。voidremoveParameters()清除参数列表。voidremoveSources()清除源图像列表。ParameterBlockset(byte b, int index)用Byte替换参数列表中的Object。ParameterBlockset(char c, int index)使用Character替换参数列表中的Object。ParameterBlockset(double d, int index)使用Double替换参数列表中的Object。ParameterBlockset(float f, int index)使用Float替换参数列表中的Object。ParameterBlockset(int i, int index)使用Integer替换参数列表中的Object。ParameterBlockset(long l, int index)用Long替换参数列表中的Object。ParameterBlockset(short s, int index)使用Short替换参数列表中的Object。ParameterBlockset(Object obj, int index)替换参数列表中的对象。voidsetParameters(Vector<Object> parameters)将整个参数Vector设置为给定的Vector。ParameterBlocksetSource(Object source, int index)用新源替换源列表中的条目。voidsetSources(Vector<Object> sources)将整个Vector of Source设置为给定的Vector。ObjectshallowClone()创建ParameterBlock的浅表副本。 
 -  
             
 
-  
        
       
-  
             
方法详细信息
-  
shallowClone
public Object shallowClone()
创建ParameterBlock的浅表副本。 源和参数Vector通过引用复制 - 两个版本都可以看到添加或更改。- 结果
 -  
              
ParameterBlock的对象克隆。 
 
-  
clone
public Object clone()
创建ParameterBlock的副本。 克隆源和参数Vector,但通过引用复制实际的源和参数。 这允许修改克隆中的源和参数的顺序和数量对原始ParameterBlock不可见。 对共享源或参数本身的更改仍然可见。 
-  
addSource
public ParameterBlock addSource(Object source)
将图像添加到源列表的末尾。 图像存储为对象,以便将来允许新的节点类型。- 参数
 -  
              
source- 要存储在源列表中的图像对象。 - 结果
 - 
               新 
              
ParameterBlock包含指定source。 
 
-  
getSource
public Object getSource(int index)
将源作为常规Object返回。 调用者必须将其转换为适当的类型。- 参数
 -  
              
index- 要返回的源的索引。 - 结果
 -  
              
Object,表示位于sourcesVector指定索引处的源。 - 另请参见:
 -  
              
setSource(Object, int) 
 
-  
setSource
public ParameterBlock setSource(Object source, int index)
用新源替换源列表中的条目。 如果索引位于当前源列表之外,则根据需要使用空值扩展列表。- 参数
 -  
              
source- 指定的源图像 -  
              
index-索引到sourcesVector要插入指定source - 结果
 - 
               新的 
              
ParameterBlock,包含指定的source,指定的index。 - 另请参见:
 -  
              
getSource(int) 
 
-  
getRenderedSource
public RenderedImage getRenderedSource(int index)
返回源为RenderedImage。 该方法是一种方便的方法。 如果源不是RenderedImage,则抛出异常。- 参数
 -  
              
index- 要返回的源的索引 - 结果
 - 
               一个 
              
RenderedImage表示源图像是在指定索引处sources Vector。 
 
-  
getRenderableSource
public RenderableImage getRenderableSource(int index)
将源返回为RenderableImage。 该方法是一种方便的方法。 如果源不是RenderableImage,则抛出异常。- 参数
 -  
              
index- 要返回的源的索引 - 结果
 - 
               一个 
              
RenderableImage表示源图像是在指定索引处sources Vector。 
 
-  
getNumSources
public int getNumSources()
返回源图像的数量。- 结果
 -  
              
sourcesVector的源图像数量。 
 
-  
getSources
public Vector<Object> getSources()
返回整个Vector数据源。- 结果
 -  
              
sources Vector。 - 另请参见:
 -  
              
setSources(Vector) 
 
-  
setSources
public void setSources(Vector<Object> sources)
将整个Vector of Source设置为给定的Vector。- 参数
 -  
              
sources- 源图像的Vector - 另请参见:
 -  
              
getSources() 
 
-  
removeSources
public void removeSources()
清除源图像列表。 
-  
getNumParameters
public int getNumParameters()
返回参数数量(不包括源图像)。- 结果
 -  
              
parametersVector的参数数量。 
 
-  
getParameters
public Vector<Object> getParameters()
返回整个参数Vector。- 结果
 -  
              
parameters Vector。 - 另请参见:
 -  
              
setParameters(Vector) 
 
-  
setParameters
public void setParameters(Vector<Object> parameters)
将整个参数Vector设置为给定的Vector。- 参数
 -  
              
parameters- 指定的Vector参数 - 另请参见:
 -  
              
getParameters() 
 
-  
removeParameters
public void removeParameters()
清除参数列表。 
-  
add
public ParameterBlock add(Object obj)
将对象添加到参数列表中。- 参数
 -  
              
obj-Object加入parameters Vector - 结果
 - 
               包含指定参数的新 
              
ParameterBlock。 
 
-  
add
public ParameterBlock add(byte b)
将字节添加到参数列表中。- 参数
 -  
              
b- 要添加到parameters Vector的字节 - 结果
 - 
               包含指定参数的新 
              
ParameterBlock。 
 
-  
add
public ParameterBlock add(char c)
将一个Character添加到参数列表中。- 参数
 -  
              
c- 要添加到parameters Vector的字符 - 结果
 - 
               包含指定参数的新 
              
ParameterBlock。 
 
-  
add
public ParameterBlock add(short s)
在参数列表中添加Short。- 参数
 -  
              
s- 短期添加到parameters Vector - 结果
 - 
               包含指定参数的新 
              
ParameterBlock。 
 
-  
add
public ParameterBlock add(int i)
将Integer添加到参数列表中。- 参数
 -  
              
i- 要添加到parameters Vector的int - 结果
 - 
               包含指定参数的新 
              
ParameterBlock。 
 
-  
add
public ParameterBlock add(long l)
将Long添加到参数列表中。- 参数
 -  
              
l- 长期加入parameters Vector - 结果
 - 
               包含指定参数的新 
              
ParameterBlock。 
 
-  
add
public ParameterBlock add(float f)
将Float添加到参数列表中。- 参数
 -  
              
f- 要添加到parameters Vector - 结果
 - 
               包含指定参数的新 
              
ParameterBlock。 
 
-  
add
public ParameterBlock add(double d)
将Double添加到参数列表中。- 参数
 -  
              
d- 要添加到parameters Vector - 结果
 - 
               包含指定参数的新 
              
ParameterBlock。 
 
-  
set
public ParameterBlock set(Object obj, int index)
替换参数列表中的对象。 如果索引位于当前源列表之外,则根据需要使用空值扩展列表。- 参数
 -  
              
obj- 替换parameters Vector指定索引处的参数的参数 -  
              
index- 要用指定参数替换的参数的索引 - 结果
 - 
               包含指定参数的新 
              
ParameterBlock。 
 
-  
set
public ParameterBlock set(byte b, int index)
用Byte替换参数列表中的Object。 如果索引位于当前源列表之外,则根据需要使用空值扩展列表。- 参数
 -  
              
b- 替换parameters Vector指定索引处的参数的参数 -  
              
index- 要用指定参数替换的参数的索引 - 结果
 - 
               包含指定参数的新 
              
ParameterBlock。 
 
-  
set
public ParameterBlock set(char c, int index)
使用Character替换参数列表中的Object。 如果索引位于当前源列表之外,则根据需要使用空值扩展列表。- 参数
 -  
              
c- 替换parameters Vector指定索引处的参数的参数 -  
              
index- 要用指定参数替换的参数的索引 - 结果
 - 
               包含指定参数的新 
              
ParameterBlock。 
 
-  
set
public ParameterBlock set(short s, int index)
使用Short替换参数列表中的Object。 如果索引位于当前源列表之外,则根据需要使用空值扩展列表。- 参数
 -  
              
s- 替换parameters Vector指定索引处的参数的参数 -  
              
index- 要用指定参数替换的参数的索引 - 结果
 - 
               包含指定参数的新 
              
ParameterBlock。 
 
-  
set
public ParameterBlock set(int i, int index)
使用Integer替换参数列表中的Object。 如果索引位于当前源列表之外,则根据需要使用空值扩展列表。- 参数
 -  
              
i- 替换parameters Vector指定索引处的参数的参数 -  
              
index- 要用指定参数替换的参数的索引 - 结果
 - 
               包含指定参数的新 
              
ParameterBlock。 
 
-  
set
public ParameterBlock set(long l, int index)
用Long替换参数列表中的Object。 如果索引位于当前源列表之外,则根据需要使用空值扩展列表。- 参数
 -  
              
l- 替换parameters Vector指定索引处的参数的参数 -  
              
index- 要用指定参数替换的参数的索引 - 结果
 - 
               包含指定参数的新 
              
ParameterBlock。 
 
-  
set
public ParameterBlock set(float f, int index)
使用Float替换参数列表中的Object。 如果索引位于当前源列表之外,则根据需要使用空值扩展列表。- 参数
 -  
              
f- 替换parameters Vector指定索引处的参数的参数 -  
              
index- 要用指定参数替换的参数的索引 - 结果
 - 
               包含指定参数的新 
              
ParameterBlock。 
 
-  
set
public ParameterBlock set(double d, int index)
使用Double替换参数列表中的Object。 如果索引位于当前源列表之外,则根据需要使用空值扩展列表。- 参数
 -  
              
d- 替换parameters Vector指定索引处的参数的参数 -  
              
index- 要用指定参数替换的参数的索引 - 结果
 - 
               包含指定参数的新 
              
ParameterBlock。 
 
-  
getObjectParameter
public Object getObjectParameter(int index)
获取参数作为对象。- 参数
 -  
              
index- 要获取的参数的索引 - 结果
 -  
              
Object表示parametersVector指定索引处的参数。 
 
-  
getByteParameter
public byte getByteParameter(int index)
将参数作为字节返回的便捷方法。 如果参数是null或不是Byte则抛出异常。- 参数
 -  
              
index- 要返回的参数的索引。 - 结果
 - 
               指定索引处的参数为 
              
byte值。 - 异常
 -  
              
ClassCastException- 如果指定索引处的参数不是Byte -  
              
NullPointerException- 如果指定索引处的参数为null -  
              
ArrayIndexOutOfBoundsException- 如果index为负数或不小于此ParameterBlock对象的当前大小 
 
-  
getCharParameter
public char getCharParameter(int index)
将参数作为char返回的便捷方法。 如果参数是null或不是Character则抛出异常。- 参数
 -  
              
index- 要返回的参数的索引。 - 结果
 - 
               指定索引处的参数为 
              
char值。 - 异常
 -  
              
ClassCastException- 如果指定索引处的参数不是Character -  
              
NullPointerException- 如果指定索引处的参数为null -  
              
ArrayIndexOutOfBoundsException- 如果index为负数或不小于此ParameterBlock对象的当前大小 
 
-  
getShortParameter
public short getShortParameter(int index)
将参数作为short返回的便捷方法。 如果参数是null或不是Short则抛出异常。- 参数
 -  
              
index- 要返回的参数的索引。 - 结果
 - 
               指定索引处的参数为 
              
short值。 - 异常
 -  
              
ClassCastException- 如果指定索引处的参数不是Short -  
              
NullPointerException- 如果指定索引处的参数为null -  
              
ArrayIndexOutOfBoundsException- 如果index为负数或不小于此ParameterBlock对象的当前大小 
 
-  
getIntParameter
public int getIntParameter(int index)
将参数作为int返回的便捷方法。 如果参数是null或不是Integer则抛出异常。- 参数
 -  
              
index- 要返回的参数的索引。 - 结果
 - 
               指定索引处的参数为 
              
int值。 - 异常
 -  
              
ClassCastException- 如果指定索引处的参数不是Integer -  
              
NullPointerException- 如果指定索引处的参数为null -  
              
ArrayIndexOutOfBoundsException- 如果index为负数或不小于此ParameterBlock对象的当前大小 
 
-  
getLongParameter
public long getLongParameter(int index)
将参数作为long返回的便捷方法。 如果参数是null或不是Long则抛出异常。- 参数
 -  
              
index- 要返回的参数的索引。 - 结果
 - 
               指定索引处的参数为 
              
long值。 - 异常
 -  
              
ClassCastException- 如果指定索引处的参数不是Long -  
              
NullPointerException- 如果指定索引处的参数为null -  
              
ArrayIndexOutOfBoundsException- 如果index为负数或不小于此ParameterBlock对象的当前大小 
 
-  
getFloatParameter
public float getFloatParameter(int index)
将参数作为float返回的便捷方法。 如果参数是null或不是Float则抛出异常。- 参数
 -  
              
index- 要返回的参数的索引。 - 结果
 - 
               指定索引处的参数为 
              
float值。 - 异常
 -  
              
ClassCastException- 如果指定索引处的参数不是Float -  
              
NullPointerException- 如果指定索引处的参数为null -  
              
ArrayIndexOutOfBoundsException- 如果index为负数或不小于此ParameterBlock对象的当前大小 
 
-  
getDoubleParameter
public double getDoubleParameter(int index)
将参数作为double返回的便捷方法。 如果参数是null或不是Double则抛出异常。- 参数
 -  
              
index- 要返回的参数的索引。 - 结果
 - 
               指定索引处的参数为 
              
double值。 - 异常
 -  
              
ClassCastException- 如果指定索引处的参数不是Double -  
              
NullPointerException- 如果指定索引处的参数为null -  
              
ArrayIndexOutOfBoundsException- 如果index为负数或不小于此ParameterBlock对象的当前大小 
 
-  
getParamClasses
public 类<?>[] getParamClasses()
返回描述参数类型的Class对象数组。- 结果
 - 
               一组 
              
类对象。 
 
 -  
 
 -