|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlime.Reactor
Field Summary | |
private RegisteredReaction |
currentRR
A pointer to the current registered reaction within the linked list. |
private RegisteredReaction |
firstRR
A pointer to the first registered reaction within the linked list. |
private RegisteredReaction |
lastRR
A pointer to the last registered reaction within the linked list. |
private java.util.Vector |
matchingTuples
Holds tuples coming from the main TS that are a match for a new oncepertuple reaction. |
private java.util.Vector |
newTuples
Holds the tuples that have been dropped by a write performed within a reaction. |
private java.util.Vector |
reactions
Holds the RegisteredReactions for "efficient" access for finding a reaction in the list |
(package private) boolean |
running
Keeps track of whether a reactive program is running. |
(package private) java.lang.String |
tsname
The tuple space's name |
(package private) lights.interfaces.ITupleSpace |
tupleSpace
The tuple space. |
private java.util.Vector |
workingTuples
Holds tuples that are being passed to the reactor upon triggering its computation, i.e., tuples from a write or from engagement. |
Constructor Summary | |
(package private) |
Reactor(lights.interfaces.ITupleSpace tupleSpace,
java.lang.String tsname)
The constructor for a Reactor. |
Method Summary | |
(package private) lights.interfaces.ITuple |
createDeepCopy(lights.interfaces.ITuple t)
Returns a copy of the tuple by serializing and then deserializing the tuple object. |
(package private) static lights.interfaces.ITuple |
deserialize(byte[] serForm)
Returns a copy of the tuple by deserializing the byte array passed as a parameter. |
(package private) lights.interfaces.ITuple |
doRead(lights.interfaces.ITuple t)
|
(package private) lights.interfaces.ITuple[] |
doReadg(lights.interfaces.ITuple t)
|
(package private) lights.interfaces.ITuple |
doTake(lights.interfaces.ITuple t)
|
(package private) lights.interfaces.ITuple[] |
doTakeg(lights.interfaces.ITuple t)
|
(package private) void |
doWrite(lights.interfaces.ITuple[] t)
Places the tuples into the newTuples vector. |
private lights.interfaces.ITuple[] |
findAllMatches(java.util.Vector tuples,
lights.interfaces.ITuple template)
Return all matches, or an array of length zero if no match is found. |
private lights.interfaces.ITuple |
findMatch(java.util.Vector tuples,
lights.interfaces.ITuple template)
|
(package private) RegisteredReaction[] |
getAgentReactions(AgentID a)
Return the reactions belonging to the specified agent. |
(package private) RegisteredReaction[] |
getAllReactions()
Returns all of the reactions that are registered on this tuple space. |
(package private) byte[] |
getSerializedForm(lights.interfaces.ITuple t)
Returns the byte array containing the serialized form of the tuple. |
(package private) RegisteredReaction[] |
installReactions(Reaction[] r,
java.lang.String name,
AgentID a,
long seqNum)
|
(package private) RegisteredReaction[] |
installRegisteredReactions(RegisteredReaction[] r)
Reinstalls a reaction. |
(package private) boolean |
isRegistered(RegisteredReaction r)
Returns true if the RegisteredReaction is registered within this Reactor. |
(package private) boolean |
isRunning()
Returns whether a reactive program is running. |
(package private) void |
printAllReactions()
|
(package private) void |
putReactions(RegisteredReaction[] r)
Used when reactions must be merged in the reactor and no reactive program must be run. |
private void |
react(lights.interfaces.ITuple t,
RegisteredReaction r)
|
private void |
reactOnce(lights.interfaces.ITuple t,
RegisteredReaction r)
Fires the reaction using the specified tuple. |
private boolean |
reactOnce(java.util.Vector tuples,
lights.interfaces.ITuple t,
RegisteredReaction r)
Tries to react once on those tuples in the multiset that match the tuple. |
private boolean |
reactSelectively(java.util.Vector tuples,
lights.interfaces.ITuple t,
RegisteredReaction r)
Tries to react once-per-tuple on those tuples in the multiset that match the tuple. |
private void |
removeMatch(java.util.Vector tuples,
lights.interfaces.ITuple[] t)
|
(package private) boolean |
removeReactions(RegisteredReaction[] r)
removes an array of reactions from the list of registered reactions processed during runReactiveProgram. |
(package private) void |
runReactiveProgram(lights.interfaces.ITuple[] wt)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
lights.interfaces.ITupleSpace tupleSpace
java.lang.String tsname
boolean running
private RegisteredReaction firstRR
private RegisteredReaction lastRR
private RegisteredReaction currentRR
private java.util.Vector reactions
private transient java.util.Vector workingTuples
private transient java.util.Vector matchingTuples
private transient java.util.Vector newTuples
Constructor Detail |
Reactor(lights.interfaces.ITupleSpace tupleSpace, java.lang.String tsname)
tupleSpace
- The tuple spacetsname
- The name of the tuple spaceMethod Detail |
RegisteredReaction[] installReactions(Reaction[] r, java.lang.String name, AgentID a, long seqNum)
RegisteredReaction[] installRegisteredReactions(RegisteredReaction[] r)
RegisteredReaction[] getAgentReactions(AgentID a)
RegisteredReaction[] getAllReactions()
void putReactions(RegisteredReaction[] r)
boolean removeReactions(RegisteredReaction[] r)
r
- array of registered reactions to be removed.
boolean isRegistered(RegisteredReaction r)
boolean isRunning()
void doWrite(lights.interfaces.ITuple[] t)
lights.interfaces.ITuple doRead(lights.interfaces.ITuple t)
lights.interfaces.ITuple[] doReadg(lights.interfaces.ITuple t)
private void removeMatch(java.util.Vector tuples, lights.interfaces.ITuple[] t)
lights.interfaces.ITuple doTake(lights.interfaces.ITuple t)
lights.interfaces.ITuple[] doTakeg(lights.interfaces.ITuple t)
void runReactiveProgram(lights.interfaces.ITuple[] wt)
private void react(lights.interfaces.ITuple t, RegisteredReaction r)
private void reactOnce(lights.interfaces.ITuple t, RegisteredReaction r)
t
- the tuple that caused the reaction to fire.r
- the reaction that should be fired.private boolean reactOnce(java.util.Vector tuples, lights.interfaces.ITuple t, RegisteredReaction r)
tuples
- The tuples to look throughr
- the reaction to fire.
private boolean reactSelectively(java.util.Vector tuples, lights.interfaces.ITuple t, RegisteredReaction r)
tuples
- the tuples to look throughr
- the reaction to fire.private lights.interfaces.ITuple findMatch(java.util.Vector tuples, lights.interfaces.ITuple template)
private lights.interfaces.ITuple[] findAllMatches(java.util.Vector tuples, lights.interfaces.ITuple template)
tuples
- the tuples to look through.template
- the template to match against.
void printAllReactions()
lights.interfaces.ITuple createDeepCopy(lights.interfaces.ITuple t)
byte[] getSerializedForm(lights.interfaces.ITuple t)
static lights.interfaces.ITuple deserialize(byte[] serForm)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |