|
JavaTM 2 Platform Std. Ed. v1.4.0 |
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | ||||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | ||||||||||
java.lang.Object | +--java.awt.image.renderable.ParameterBlock
ParameterBlock は、RenderableImageOp や、イメージを処理するほかのクラスによって必要とされるソースおよびパラメータ (Object) についてのすべての情報をカプセル化します。
ソース Vector には任意のオブジェクトを配置できますが、このクラスのユーザは、たとえば、すべてのソースは RenderedImages または RenderableImage でなければならない、などのような意味制約を加えることもできます。ParameterBlock 自体はコンテナにすぎないので、ソースまたはパラメータの型のチェックは行いません。
ParameterBlock のパラメータはすべてオブジェクトです。基本型の引数をとる簡易 add メソッドおよび set メソッドが利用可能で、適切な Number (Integer または Float など) のサブクラスを作成します。対応する get メソッドは、下方キャストを実行し、基本型の戻り値を受け取ります。格納される値の型が正しい型でない場合は、例外がスローされます。short s; add(s) の結果と add(new Short(s)) の結果は区別できません。
get メソッドおよび set メソッドは参照に影響を与えます。したがって、ParameterBlock 間での参照の共有が不適切な場合は、共有しないようにしてください。たとえば、追加されたソースを除いて、古い ParameterBlock と同じ新しい ParameterBlock を作成する場合に、次のように記述してしまいがちです。
ParameterBlock addSource(ParameterBlock pb, RenderableImage im) {
ParameterBlock pb1 = new ParameterBlock(pb.getSources());
pb1.addSource(im);
return pb1;
}
このコードは、getSources 操作がソース Vector への参照を返したために、元の ParameterBlock を変更する副作用があります。pb と pb1 はソース Vector を共有しているので、一方の変更は両方に対して可視になります。
addSource 関数の記述方法で適切なのは、次のようにソース Vector を複製する方法です。
ParameterBlock addSource (ParameterBlock pb, RenderableImage im) {
ParameterBlock pb1 = new ParameterBlock(pb.getSources().clone());
pb1.addSource(im);
return pb1;
}
ParameterBlock の clone メソッドは、こうした理由でソースとパラメータの両方の Vector の複製を実行するように定義されています。標準のシャロー複製を shallowClone として利用できます。
addSource、setSource、add、および set の各メソッドは、引数を追加したあとで this を返すように定義されます。そのため、次のような構文の使用が可能です。
ParameterBlock pb = new ParameterBlock();
op = new RenderableImageOp("operation", pb.add(arg1).add(arg2));
| フィールドの概要 | |
protected Vector |
parameters
任意の Object として格納される、ソース以外のパラメータの Vector です。 |
protected Vector |
sources
任意の Object として格納される、ソースの Vector です。 |
| コンストラクタの概要 | |
ParameterBlock()
ダミーコンストラクタです。 |
|
ParameterBlock(Vector sources)
指定されたソースの Vector を使って ParameterBlock を構築します。 |
|
ParameterBlock(Vector sources,
Vector parameters)
指定されたソースの Vector およびパラメータの Vector を使って ParameterBlock を構築します。 |
|
| メソッドの概要 | |
ParameterBlock |
add(byte b)
Byte をパラメータのリストに追加します。 |
ParameterBlock |
add(char c)
Character をパラメータのリストに追加します。 |
ParameterBlock |
add(double d)
Double をパラメータのリストに追加します。 |
ParameterBlock |
add(float f)
Float をパラメータのリストに追加します。 |
ParameterBlock |
add(int i)
Integer をパラメータのリストに追加します。 |
ParameterBlock |
add(long l)
Long をパラメータのリストに追加します。 |
ParameterBlock |
add(Object obj)
オブジェクトをパラメータのリストに追加します。 |
ParameterBlock |
add(short s)
Short をパラメータのリストに追加します。 |
ParameterBlock |
addSource(Object source)
イメージをソースのリストの最後に追加します。 |
Object |
clone()
ParameterBlock のコピーを作成します。 |
byte |
getByteParameter(int index)
パラメータを byte として返す簡易メソッドです。 |
char |
getCharParameter(int index)
パラメータを char として返す簡易メソッドです。 |
double |
getDoubleParameter(int index)
パラメータを double として返す簡易メソッドです。 |
float |
getFloatParameter(int index)
パラメータを float として返す簡易メソッドです。 |
int |
getIntParameter(int index)
パラメータを int として返す簡易メソッドです。 |
long |
getLongParameter(int index)
パラメータを long として返す簡易メソッドです。 |
int |
getNumParameters()
パラメータの数を返します。 |
int |
getNumSources()
ソースイメージの数を返します。 |
Object |
getObjectParameter(int index)
パラメータをオブジェクトとして取得します。 |
Class[] |
getParamClasses()
パラメータの型を記述する Class オブジェクトの配列を返します。 |
Vector |
getParameters()
パラメータの Vector 全体を返します。 |
RenderableImage |
getRenderableSource(int index)
ソースを RenderableImage として返します。 |
RenderedImage |
getRenderedSource(int index)
ソースを RenderedImage として返します。 |
short |
getShortParameter(int index)
パラメータを short として返す簡易メソッドです。 |
Object |
getSource(int index)
ソースを一般的な Object として返します。 |
Vector |
getSources()
ソースの Vector 全体を返します。 |
void |
removeParameters()
パラメータのリストをクリアします。 |
void |
removeSources()
ソースイメージのリストをクリアします。 |
ParameterBlock |
set(byte b,
int index)
パラメータのリストの Object を Byte に置き換えます。 |
ParameterBlock |
set(char c,
int index)
パラメータのリストの Object を Character に置き換えます。 |
ParameterBlock |
set(double d,
int index)
パラメータのリストの Object を Double に置き換えます。 |
ParameterBlock |
set(float f,
int index)
パラメータのリストの Object を Float に置き換えます。 |
ParameterBlock |
set(int i,
int index)
パラメータのリストの Object を Integer に置き換えます。 |
ParameterBlock |
set(long l,
int index)
パラメータのリストの Object を Long に置き換えます。 |
ParameterBlock |
set(Object obj,
int index)
パラメータのリストの Object を置き換えます。 |
ParameterBlock |
set(short s,
int index)
パラメータのリストの Object を Short に置き換えます。 |
void |
setParameters(Vector parameters)
指定された Vector にパラメータの Vector 全体を設定します。 |
ParameterBlock |
setSource(Object source,
int index)
ソースのリストのエントリを新しいソースに置き換えます。 |
void |
setSources(Vector sources)
指定された Vector にソースの Vector 全体を設定します。 |
Object |
shallowClone()
ParameterBlock のシャローコピーを作成します。 |
| クラス java.lang.Object から継承したメソッド |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| フィールドの詳細 |
protected Vector sources
protected Vector parameters
| コンストラクタの詳細 |
public ParameterBlock()
public ParameterBlock(Vector sources)
ParameterBlock を構築します。
sources - ソースイメージの Vector
public ParameterBlock(Vector sources,
Vector parameters)
ParameterBlock を構築します。
sources - ソースイメージの Vectorparameters - 描画操作で使用されるパラメータの Vector| メソッドの詳細 |
public Object shallowClone()
ParameterBlock のシャローコピーを作成します。ソースおよびパラメータの Vector は参照でコピーされます。追加や変更は両方のバージョンに対して可視になります。
ParameterBlock の Object の複製public Object clone()
ParameterBlock のコピーを作成します。ソースおよびパラメータの Vector は複製されますが、実際のソースおよびパラメータは参照でコピーされます。このため、複製でのソースおよびパラメータの順序と数の変更は、元の ParameterBlock からは不可視になります。一方、共有されるソースまたはパラメータ自体の変更は可視になります。
Object 内の cloneParameterBlock の Object の複製Cloneablepublic ParameterBlock addSource(Object source)
source - ソースリストに格納されるイメージオブジェクト
source を格納する新規の ParameterBlockpublic Object getSource(int index)
index - 返されるソースのインデックス
sources Vector 内の指定されたインデックスにあるソースを表す ObjectsetSource(Object, int)
public ParameterBlock setSource(Object source,
int index)
source - 指定されたソースイメージindex - 指定された source を挿入する sources Vector 内のインデックス
index で指定された source を格納する新規の ParameterBlockgetSource(int)public RenderedImage getRenderedSource(int index)
RenderedImage として返します。このメソッドは簡易メソッドです。ソースが RenderedImage でない場合、例外がスローされます。
index - 返されるソースのインデックス
sources Vector 内の指定されたインデックスにあるソースイメージを表す RenderedImagepublic RenderableImage getRenderableSource(int index)
index - 返されるソースのインデックス
sources Vector 内の指定されたインデックスにあるソースイメージを表す RenderableImage public int getNumSources()
sources Vector 内のソースイメージの数public Vector getSources()
sources VectorsetSources(Vector)public void setSources(Vector sources)
sources - ソースイメージの VectorgetSources()public void removeSources()
public int getNumParameters()
parameters Vector 内のパラメータの数public Vector getParameters()
parameters VectorsetParameters(Vector)public void setParameters(Vector parameters)
parameters - パラメータの指定された VectorgetParameters()public void removeParameters()
public ParameterBlock add(Object obj)
obj - parameters Vector に追加する Object
ParameterBlockpublic ParameterBlock add(byte b)
b - parameters Vector に追加する byte
ParameterBlockpublic ParameterBlock add(char c)
c - parameters Vector に追加する char
ParameterBlockpublic ParameterBlock add(short s)
s - parameters Vector に追加する short
ParameterBlockpublic ParameterBlock add(int i)
i - parameters Vector に追加する int
ParameterBlockpublic ParameterBlock add(long l)
l - parameters Vector に追加する long
ParameterBlockpublic ParameterBlock add(float f)
f - parameters Vector に追加する float
ParameterBlockpublic ParameterBlock add(double d)
d - parameters Vector に追加する double
ParameterBlock
public ParameterBlock set(Object obj,
int index)
obj - parameters Vector 内の指定されたインデックスにあるパラメータを置き換えるパラメータindex - 指定されたパラメータに置き換えられるパラメータのインデックス
ParameterBlock
public ParameterBlock set(byte b,
int index)
b - parameters Vector 内の指定されたインデックスにあるパラメータを置き換えるパラメータindex - 指定されたパラメータに置き換えられるパラメータのインデックス
ParameterBlock
public ParameterBlock set(char c,
int index)
c - parameters Vector 内の指定されたインデックスにあるパラメータを置き換えるパラメータindex - 指定されたパラメータに置き換えられるパラメータのインデックス
ParameterBlock
public ParameterBlock set(short s,
int index)
s - parameters Vector 内の指定されたインデックスにあるパラメータを置き換えるパラメータindex - 指定されたパラメータに置き換えられるパラメータのインデックス
ParameterBlock
public ParameterBlock set(int i,
int index)
i - parameters Vector 内の指定されたインデックスにあるパラメータを置き換えるパラメータindex - 指定されたパラメータに置き換えられるパラメータのインデックス
ParameterBlock
public ParameterBlock set(long l,
int index)
l - parameters Vector 内の指定されたインデックスにあるパラメータを置き換えるパラメータindex - 指定されたパラメータに置き換えられるパラメータのインデックス
ParameterBlock
public ParameterBlock set(float f,
int index)
f - parameters Vector 内の指定されたインデックスにあるパラメータを置き換えるパラメータindex - 指定されたパラメータに置き換えられるパラメータのインデックス
ParameterBlock
public ParameterBlock set(double d,
int index)
d - parameters Vector 内の指定されたインデックスにあるパラメータを置き換えるパラメータindex - 指定されたパラメータに置き換えられるパラメータのインデックス
ParameterBlockpublic Object getObjectParameter(int index)
index - 取得するパラメータのインデックス
parameters Vector 内の指定されたインデックスにあるパラメータを表す Objectpublic byte getByteParameter(int index)
null の場合、または Byte でない場合は、例外がスローされます。
index - 返されるパラメータのインデックス
byte 値としてのパラメータ
ClassCastException - 指定されたインデックスでのパラメータが Byte でない場合
NullPointerException - 指定されたインデックスでのパラメータが null の場合
ArrayIndexOutOfBoundsException - index が負の場合、またはこの ParameterBlock オブジェクトの現在のサイズよりも小さくない場合public char getCharParameter(int index)
null の場合、または Character でない場合は、例外がスローされます。
index - 返されるパラメータのインデックス
char 値としてのパラメータ
ClassCastException - 指定されたインデックスでのパラメータが Character でない場合
NullPointerException - 指定されたインデックスでのパラメータが null の場合
ArrayIndexOutOfBoundsException - index が負の場合、またはこの ParameterBlock オブジェクトの現在のサイズよりも小さくない場合public short getShortParameter(int index)
null の場合、または Short でない場合は、例外がスローされます。
index - 返されるパラメータのインデックス
short 値としてのパラメータ
ClassCastException - 指定されたインデックスでのパラメータが Short でない場合
NullPointerException - 指定されたインデックスでのパラメータが null の場合
ArrayIndexOutOfBoundsException - index が負の場合、またはこの ParameterBlock オブジェクトの現在のサイズよりも小さくない場合public int getIntParameter(int index)
null の場合、または Integer でない場合は、例外がスローされます。
index - 返されるパラメータのインデックス
int 値としてのパラメータ
ClassCastException - 指定されたインデックスでのパラメータが Integer でない場合
NullPointerException - 指定されたインデックスでのパラメータが null の場合
ArrayIndexOutOfBoundsException - index が負の場合、またはこの ParameterBlock オブジェクトの現在のサイズよりも小さくない場合public long getLongParameter(int index)
null の場合、または Long でない場合は、例外がスローされます。
index - 返されるパラメータのインデックス
long 値としてのパラメータ
ClassCastException - 指定されたインデックスでのパラメータが Long でない場合
NullPointerException - 指定されたインデックスでのパラメータが null の場合
ArrayIndexOutOfBoundsException - index が負の場合、またはこの ParameterBlock オブジェクトの現在のサイズよりも小さくない場合public float getFloatParameter(int index)
null の場合、または Float でない場合は、例外がスローされます。
index - 返されるパラメータのインデックス
float 値としてのパラメータ
ClassCastException - 指定されたインデックスでのパラメータが Float でない場合
NullPointerException - 指定されたインデックスでのパラメータが null の場合
ArrayIndexOutOfBoundsException - index が負の場合、またはこの ParameterBlock オブジェクトの現在のサイズよりも小さくない場合public double getDoubleParameter(int index)
null の場合、または Double でない場合は、例外がスローされます。
index - 返されるパラメータのインデックス
double 値としてのパラメータ
ClassCastException - 指定されたインデックスでのパラメータが Double でない場合
NullPointerException - 指定されたインデックスでのパラメータが null の場合
ArrayIndexOutOfBoundsException - index が負の場合、またはこの ParameterBlock オブジェクトの現在のサイズよりも小さくない場合public Class[] getParamClasses()
Class オブジェクトの配列
|
JavaTM 2 Platform Std. Ed. v1.4.0 |
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | ||||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | ||||||||||
Java、Java 2D、および JDBC は米国ならびにその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.