public class RowData extends Object implements Key
属性値のセット(setAttrib)の際には、その属性値をindex化をするかどうかの選択ができる。 index化された属性値は、属性を管理するオブジェクト(Attribute)の持つMap(Comparableな場合は NavigableMap)に登録され、その属性値をsearchする処理が高速になる。 さらに、AttributeにOverlayがbindされた場合には、その属性値がOverlayに 自動的にaddKeyされ、他のピアからの検索対象となる。(index化の主目的はここにある)
但し、index化には次の点に留意する必要がある。
RowData全体をAttributeから一時的に解放することも可能である。このために、bindToAttribute/ unbindToAttributeのメソッドが用意されている。unbindされると、すべての属性値はAttributeの index化から外される。これによって、RowDataは検索対象から外れる。bindによってこの状態は元に戻る。 この機能は、Agentのsleep/wakupの実現を意図した機能となっている。
属性値に対する操作メソッドはすべて同期化されていて、お互いが並行に動作することはない。
特殊なケースであるが、RowDataはCombinedOverlayでは検索対象のKeyとして扱われる。 このため、RowDataはKeyをimplementsしている。 (SkipGraphなどへのaddKeyの対象にはならないところに注意)
| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected boolean |
isBoundToAttribute
RowDataがAttributeの管理下(bound)にあるかどうかを保持するための状態フラグ。
|
Id |
rowId |
protected AttributeTable |
table |
| 修飾子 | コンストラクタと説明 |
|---|---|
protected |
RowData(AttributeTable table,
Id rowId,
boolean isBoundToAttribute)
RowDataを生成する。
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
boolean |
bindToAttribute() |
void |
fin() |
List<String> |
getAttribNames()
Returns a list of attribute names.
|
Object |
getAttribValue(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.
|
boolean |
isBoundToAttribute() |
boolean |
isIndexed(String attribName)
属性値がindex化されている場合 trueを返す。
|
boolean |
removeAttrib(String name)
setAttribでセットした属性値を削除する。
|
boolean |
satisfies(List<VarDestinationPair> conds)
RowDataがリストの要素であるVarSubsetPairをすべて満たすかどうかを判定する。
|
boolean |
setAttrib(String name,
Object value) |
boolean |
setAttrib(String name,
Object value,
boolean useIndex)
指定された属性名で属性値をセットする。
|
String |
toString() |
boolean |
unbindToAttribute() |
protected transient AttributeTable table
public Id rowId
protected boolean isBoundToAttribute
protected RowData(AttributeTable table, Id rowId, boolean isBoundToAttribute)
table - a table.rowId - a row ID.isBoundToAttribute - a flag that indicates the row data is managed by the Attribute.public void fin()
public boolean isBoundToAttribute()
public boolean bindToAttribute()
public boolean unbindToAttribute()
public boolean setAttrib(String name, Object value) throws IllegalArgumentException, IncompatibleTypeException
public boolean setAttrib(String name, Object value, boolean useIndex) throws IllegalArgumentException, IncompatibleTypeException
Attributeが型を持っていて、属性値が代入不可能な場合はIncompatibleTypeExceptionが throwされて、属性値のセットは失敗する。 RowDataがisBoundToAttributeでない場合は、実際には Attributeのindexには反映されない。 次に、boundな状態になったタイミングで一括登録される。
name - 属性名value - 属性値useIndex - indexが使える場合に使うときにtrueを指定するIllegalArgumentException - 属性名または属性値にnullがセットされた場合IncompatibleTypeException - 属性値が代入不可能な場合public boolean removeAttrib(String name) throws IllegalStateException
通常は起こらないが、setAttribをした際にindex化された属性値がAttributeの内部ではindex化 されていなかったり、Attribute自体がtypeを持っていない(typeを持っていないとindex化はできない) ことが検知された場合、IllegalStateExceptionがthrowされる。 RowDataがisBoundToAttributeでない場合は、実際には Attributeのindexには反映されない。 次に、boundな状態になったタイミングで一括削除される。
name - 属性名IllegalStateException - Attributeの状態の中に不整合を検知した場合public Object getAttribValue(String attribName)
attribName - the attribute namepublic boolean isIndexed(String attribName) throws IllegalArgumentException
attribName - 属性名IllegalArgumentException - 属性名が存在しない場合public List<String> getAttribNames()
public List<String> getIndexedAttribNames()
public List<String> getUnindexedAttribNames()
public boolean satisfies(List<VarDestinationPair> conds)
conds - VarSubsetPairのリストCopyright © 2017. All rights reserved.