クラス RowData
- すべての実装されたインタフェース:
Serializable,Destination,Key
public class RowData extends Object implements Key
属性値のセット(setAttrib)の際には、その属性値をindex化をするかどうかの選択ができる。 index化された属性値は、属性を管理するオブジェクト(Attribute)の持つMap(Comparableな場合は NavigableMap)に登録され、その属性値をsearchする処理が高速になる。 さらに、AttributeにOverlayがbindされた場合には、その属性値がOverlayに 自動的にaddKeyされ、他のピアからの検索対象となる。(index化の主目的はここにある)
但し、index化には次の点に留意する必要がある。
- setAttribの時点で、Attributeは型を持っている必要がある。
- 属性値は、Attributeの持つ型と互換(代入可能)でなければいけない。
RowData全体をAttributeから一時的に解放することも可能である。このために、bindToAttribute/ unbindToAttributeのメソッドが用意されている。unbindされると、すべての属性値はAttributeの index化から外される。これによって、RowDataは検索対象から外れる。bindによってこの状態は元に戻る。 この機能は、Agentのsleep/wakupの実現を意図した機能となっている。
属性値に対する操作メソッドはすべて同期化されていて、お互いが並行に動作することはない。
特殊なケースであるが、RowDataはCombinedOverlayでは検索対象のKeyとして扱われる。 このため、RowDataはKeyをimplementsしている。 (SkipGraphなどへのaddKeyの対象にはならないところに注意)
- 関連項目:
- 直列化された形式
-
フィールドの概要
フィールド 修飾子とタイプ フィールド 説明 protected booleanisBoundToAttributeRowDataがAttributeの管理下(bound)にあるかどうかを保持するための状態フラグ。IdrowIdprotected AttributeTabletable -
コンストラクタの概要
コンストラクタ 修飾子 コンストラクタ 説明 protectedRowData(AttributeTable table, Id rowId, boolean isBoundToAttribute)RowDataを生成する。 -
メソッドの概要
修飾子とタイプ メソッド 説明 booleanbindToAttribute()voidfin()List<String>getAttribNames()Returns a list of attribute names.ObjectgetAttribValue(String attribName)指定されたnameの属性値を返す。List<Object>getAttribValues()List<String>getIndexedAttribNames()Returns an indexed list of attribute names.List<String>getUnindexedAttribNames()Returns an not-indexed attribute names.booleanisBoundToAttribute()booleanisIndexed(String attribName)属性値がindex化されている場合 trueを返す。booleanremoveAttrib(String name)setAttribでセットした属性値を削除する。booleansatisfies(List<VarDestinationPair> conds)RowDataがリストの要素であるVarSubsetPairをすべて満たすかどうかを判定する。booleansetAttrib(String name, Object value)booleansetAttrib(String name, Object value, boolean useIndex)指定された属性名で属性値をセットする。StringtoString()booleanunbindToAttribute()
-
フィールド詳細
-
table
-
rowId
-
isBoundToAttribute
protected boolean isBoundToAttributeRowDataがAttributeの管理下(bound)にあるかどうかを保持するための状態フラグ。 主な用途はAgentのsleepとwakeup。 unboundな状態で追加されたvalueは実際にはAttributeのindex化の対象とはならない。 このようにsetAttribされたデータはboundの状態に移行した時に、一括してindex化される。 また、boundからunboundな状態に移行した際には、すべてのindex化対象のvalueが Attributeのindex化から外される。
-
-
コンストラクタの詳細
-
RowData
RowDataを生成する。 通常は、AttribTableがRowDataの生成を行う。 このため、protected にしている。- パラメータ:
table- a table.rowId- a row ID.isBoundToAttribute- a flag that indicates the row data is managed by the Attribute.
-
-
メソッドの詳細
-
fin
public void fin() -
isBoundToAttribute
public boolean isBoundToAttribute() -
bindToAttribute
public boolean bindToAttribute() -
unbindToAttribute
public boolean unbindToAttribute() -
setAttrib
public boolean setAttrib(String name, Object value) throws IllegalArgumentException, IncompatibleTypeException -
setAttrib
public boolean setAttrib(String name, Object value, boolean useIndex) throws IllegalArgumentException, IncompatibleTypeException指定された属性名で属性値をセットする。 useIndexをtrueで指定した場合は、Attributeがindex可能状態にあるときにのみ、 その属性値はindex化される。index化された場合は返り値にtrueが返される。 index化されなかった場合は、falseが返される。Attributeが型を持っていて、属性値が代入不可能な場合はIncompatibleTypeExceptionが throwされて、属性値のセットは失敗する。 RowDataがisBoundToAttributeでない場合は、実際には Attributeのindexには反映されない。 次に、boundな状態になったタイミングで一括登録される。
- パラメータ:
name- 属性名value- 属性値useIndex- indexが使える場合に使うときにtrueを指定する- 戻り値:
- index化された場合 true
- 例外:
IllegalArgumentException- 属性名または属性値にnullがセットされた場合IncompatibleTypeException- 属性値が代入不可能な場合
-
removeAttrib
setAttribでセットした属性値を削除する。 削除対象の属性値が存在しない(過去にsetAttribでセットされていない)場合は、falseが返される。通常は起こらないが、setAttribをした際にindex化された属性値がAttributeの内部ではindex化 されていなかったり、Attribute自体がtypeを持っていない(typeを持っていないとindex化はできない) ことが検知された場合、IllegalStateExceptionがthrowされる。 RowDataがisBoundToAttributeでない場合は、実際には Attributeのindexには反映されない。 次に、boundな状態になったタイミングで一括削除される。
- パラメータ:
name- 属性名- 戻り値:
- 属性値の削除に成功した場合はtrue、削除対象の属性値が存在しない場合はfalse
- 例外:
IllegalStateException- Attributeの状態の中に不整合を検知した場合
-
getAttribValue
指定されたnameの属性値を返す。 テーブルがsuperRowを持つ場合は、その属性値もチェックする。- パラメータ:
attribName- the attribute name- 戻り値:
- the value to be associated with the specified name
-
getAttribValues
-
isIndexed
属性値がindex化されている場合 trueを返す。- パラメータ:
attribName- 属性名- 戻り値:
- 属性値がindex化されている場合 true
- 例外:
IllegalArgumentException- 属性名が存在しない場合
-
getAttribNames
Returns a list of attribute names. The returned list is a snapshot at the time the function is called.- 戻り値:
- a list of attribute names.
-
getIndexedAttribNames
Returns an indexed list of attribute names. The returned list is a snapshot at the time the function is called.- 戻り値:
- a list of indexed attribute names.
-
getUnindexedAttribNames
Returns an not-indexed attribute names. The returned list is a snapshot at the time the function is called.- 戻り値:
- an not-indexed list of attribute names.
-
satisfies
RowDataがリストの要素であるVarSubsetPairをすべて満たすかどうかを判定する。- パラメータ:
conds- VarSubsetPairのリスト- 戻り値:
- リストの要素であるVarSubsetPairをすべて満たした場合true
-
toString
-