lime
Class RegisteredReaction
java.lang.Object
lime.Reaction
lime.RegisteredReaction
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- MoteRegisteredReaction
- public class RegisteredReaction
- extends Reaction
Objects of this class represent a sort of a "receipt" for the registration
of a reaction. When an agent registers a Reaction
object, by
using either addStrongReaction
or
addWeakReaction
, the system returns to it a
RegisteredReaction
object, which is a copy of such reaction
augmented with information concerning the registration. This "receipt",
can later be used by the agent to deregister the reaction, by invoking
either removeReaction
or removeWeakReaction
.
- Version:
- 1.0 alpha
- Author:
- Amy L. Murphy, Gian Pietro Picco
- See Also:
LimeTupleSpace
,
Reaction
,
Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
isNew
boolean isNew
next
RegisteredReaction next
prev
RegisteredReaction prev
seqNum
long seqNum
tsName
private java.lang.String tsName
agent
private AgentID agent
tuplesReacted
private java.util.Hashtable tuplesReacted
isWeak
private boolean isWeak
inReactorReaction
RegisteredReaction inReactorReaction
uponProbe
UponProbeDescriptor uponProbe
RegisteredReaction
protected RegisteredReaction(Reaction reaction,
java.lang.String tsName,
AgentID agent,
long seqNum,
boolean isWeak)
getTupleSpaceName
public java.lang.String getTupleSpaceName()
- Return the name of the tuple space where the reaction is installed.
- Returns:
- The tuple space where the reaction is installed.
getSubscriber
public AgentID getSubscriber()
- Return a handle to the agent that registered the reaction.
- Returns:
- A handle to the agent that registered the reaction.
isWeakReaction
public boolean isWeakReaction()
setSeqNum
void setSeqNum(long seqNum)
- Sets the sequence number of a registered reaction. It was necessary to
add this method because when processing an array of upons or reactions,
it was convenient to create the array of RegisteredReactions returned to
the user before the sequence numbers could be assigned (because they are
not sequential with respect to the order they are passed, but rather with
respect to the group they are part of (to a particular host, to all
hosts, etc).
- Parameters:
seqNum
- a valid, unused sequence number
alreadyReactedTo
boolean alreadyReactedTo(LimeTupleID ltid)
- Determines whether the tuple represented by the passed parameter still
needs to be reacted to or not. If the tuple has not been reacted to,
then a side effect of alreadyReactedTo is that the tuple id is put into
the private data structure of tuples reacted to (tuplesReacted).
- Parameters:
ltid
- the tuple id to determine if it has been reacted to
- Returns:
- false if the reactsTo method should be run (the tuple has not been
reacted to). true if the reactsTo method should not be ren (the tuple
has already been reacted to
getUponDesc
UponProbeDescriptor getUponDesc()
toString
public java.lang.String toString()
- Overrides:
toString
in class Reaction
getSeqNum
public long getSeqNum()
- Returns:
- Returns the seqNum.