|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectaa.tool.TupleSpace
This class implements a tuple space that maintains actor tuples. An actor tuple consists of the actor name field and property fields.
History:
Field Summary | |
protected java.util.LinkedList |
m_llActorTuples
A linked list of actor tuples stored in this tuple space. |
Constructor Summary | |
TupleSpace()
Constructs an tuple space. |
Method Summary | |
private boolean |
areTypeMatched(ActorTuple p_atTemplate,
ActorTuple p_atTuple)
Checks whether element types between the given tuple template and the given actor tuple are matched. |
private ActorTuple[] |
getAllImpl(ActorTuple p_atTemplate,
boolean p_bRemoveFlag)
Returns all actor tuples matched with the specified tuple template, and remove them if bRemoveFlag is true. |
private ActorTuple |
getImpl(ActorTuple p_atTemplate,
boolean p_bRemoveFlag)
Gets a actor tuple matched with the specified tuple template, and remove it if bRemoveFlag is true. |
protected ActorTuple[] |
getMatchedTupleList(ActorTuple p_atTemplate,
boolean p_bActorName)
Finds actor tuples in this tuple space matched with the specified tuple template. |
private boolean |
isValidDataTuple(ActorTuple p_atTuple)
Checks whether the given actor tuple has any null element. |
ActorTuple |
read(ActorTuple p_atTemplate)
Reads an actor tuple matched with the specified tuple template. |
ActorTuple[] |
readAll(ActorTuple p_atTemplate)
Reads all actor tuples matched with the specified tuple template. |
void |
removeAll(ActorTuple p_atTemplate)
Removes all actor tuples matched with the sepecified tuple template. |
ActorName |
search(ActorTuple p_atTemplate)
Returns the actor name in an actor tuple matched with the specified tuple template. |
ActorName[] |
searchAll(ActorTuple p_atTemplate)
Returns actor names in all actor tuples matched with the specified tuple template. |
ActorTuple |
take(ActorTuple p_atTemplate)
Reads an actor tuple matched with the specified tuple template, and then removes it. |
ActorTuple[] |
takeAll(ActorTuple p_atTemplate)
Reads all actor tuples matched with the specified tuple template, and then removes them. |
void |
update(ActorTuple p_atTemplate,
ActorTuple p_atTuple)
Removes actor tuples matched with the given tuple template, and then inserts an actor tuple in this tuple space. |
void |
write(ActorTuple p_atTuple)
Inserts an actor tuple in this tuple space. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.LinkedList m_llActorTuples
Constructor Detail |
public TupleSpace()
Method Detail |
private boolean isValidDataTuple(ActorTuple p_atTuple)
p_atTuple
- an actor tuple to be checked.
true
if any element of the given actur tuple is null;
false
otherwise.private boolean areTypeMatched(ActorTuple p_atTemplate, ActorTuple p_atTuple)
p_atTemplate
- a tuple template to be used for matching with
actor tuples in this tuple space.p_atTuple
- an actor tuple to be stored in this tuple space.
protected ActorTuple[] getMatchedTupleList(ActorTuple p_atTemplate, boolean p_bActorName) throws TupleSpaceException
p_atTemplate
- a tuple template to be used for matching with actor tuples
in this tuple space.p_bActorName
- the flag to decide whethter ActorName will be checked or not.
TupleSpaceException
- if the given tuple template is null.private ActorTuple getImpl(ActorTuple p_atTemplate, boolean p_bRemoveFlag) throws TupleSpaceException
bRemoveFlag
is true.
p_atTemplate
- a tuple template to be used for matching with actor tuples
in this tuple space.p_bRemoveFlag
- the flag to remove a tuple after the tuple is retrieved.
TupleSpaceException
- if this tuple space cannot find any actor tuple
that are matched with the specified tuple template.private ActorTuple[] getAllImpl(ActorTuple p_atTemplate, boolean p_bRemoveFlag) throws TupleSpaceException
bRemoveFlag
is true.
p_atTemplate
- a tuple template to be used for matching with actor tuples
in this tuple space.p_bRemoveFlag
- the flag to remove actor tuples after they are retrieved.
TupleSpaceException
- if this tuple space cannot find any actor tuple.public void write(ActorTuple p_atTuple) throws TupleSpaceException
p_atTuple
- an actor tuple to be stored in this tuple space.
TupleSpaceException
- either if the actor tuple is invalid or
if the same actor tuple already exits in this tuple space.public final ActorTuple read(ActorTuple p_atTemplate) throws TupleSpaceException
p_atTemplate
- a tuple template to be used for matching with
actor tuples in this tuple space.
TupleSpaceException
- if this tuple space cannot find any actor tuple
that are matched with the specified tuple template.public final ActorTuple[] readAll(ActorTuple p_atTemplate) throws TupleSpaceException
p_atTemplate
- a tuple template to be used for matching with
actor tuples in this tuple space.
TupleSpaceException
- if this tuple space cannot find any actor tuple
that are matched with the specified tuple template.public ActorTuple take(ActorTuple p_atTemplate) throws TupleSpaceException
p_atTemplate
- a tuple template to be used for matching with
actor tuples in this tuple space.
TupleSpaceException
- if this tuple space cannot find any actor tuple
that are matched with the specified tuple template.public ActorTuple[] takeAll(ActorTuple p_atTemplate) throws TupleSpaceException
p_atTemplate
- a tuple template to be used for matching with
actor tuples in this tuple space.
TupleSpaceException
- if this tuple space cannot find any actor tuple
that are matched with the specified tuple template.public void update(ActorTuple p_atTemplate, ActorTuple p_atTuple) throws TupleSpaceException
p_atTemplate
- a tuple template to be used for matching with
actor tuples in this tuple space.p_atTuple
- an actor tuple to be stored in this tuple space.
TupleSpaceException
- either if the actor tuple is invalid or
if the type of an element in the given actor tuple
is not matched with the type of the corresponding
element in the given tuple template.public void removeAll(ActorTuple p_atTemplate) throws TupleSpaceException
p_atTemplate
- a tuple template to be used for matching with
actor tuples in this tuple space.
TupleSpaceException
- if this tuple space cannot find any actor tuple
that are matched with the specified tuple template.public final ActorName search(ActorTuple p_atTemplate) throws TupleSpaceException
p_atTemplate
- a tuple template to be used for matching with
actor tuples in this tuple space.
TupleSpaceException
- if this tuple space cannot find any actor tuple
that are matched with the specified tuple template.public final ActorName[] searchAll(ActorTuple p_atTemplate) throws TupleSpaceException
p_atTemplate
- a tuple template to be used for matching with
actor tuples in this tuple space.
TupleSpaceException
- if this tuple space cannot find any actor tuple
that are matched with the specified tuple template.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |