public abstract class AbstractSpawnActivity
extends java.lang.Object
implements java.io.Serializable, java.lang.Runnable
spawn
primitive.
The spawned activity should be a PURELY COMPUTATIONAL (algorithmic) process,
with the purpose to delegate computations to the coordination medium. For
this reason, a set of "constrained" Linda primitives are provided: they
CANNOT access a remote space. Furthermore, the programmer is strongly
encouraged not to put communications, locks or other potentially
"extra-algorithmic" features in its SpawnActivity.Constructor and Description |
---|
AbstractSpawnActivity() |
Modifier and Type | Method and Description |
---|---|
boolean |
checkInstantiation()
Checks if the activity to spawn has been correctly instantiated.
|
abstract void |
doActivity()
To be overridden by user
|
TucsonIdWrapper<?> |
getSpawnerId()
Both agents and the coordination medium itself can
spawn a
computation, hence we need to handle both. |
TucsonTupleCentreId |
getTargetTC()
Gets the tuplecentre identifier hosting the spawned activity.
|
protected LogicTuple |
in(LogicTuple tuple) |
protected java.util.List<LogicTuple> |
inAll(LogicTuple tuple) |
protected LogicTuple |
inp(LogicTuple tuple) |
protected void |
log(java.lang.String msg)
Standard output log utility.
|
protected LogicTuple |
no(LogicTuple tuple) |
protected java.util.List<LogicTuple> |
noAll(LogicTuple tuple) |
protected LogicTuple |
nop(LogicTuple tuple) |
protected LogicTuple |
out(LogicTuple tuple) |
protected java.util.List<LogicTuple> |
outAll(LogicTuple tuple) |
protected LogicTuple |
rd(LogicTuple tuple) |
protected java.util.List<LogicTuple> |
rdAll(LogicTuple tuple) |
protected LogicTuple |
rdp(LogicTuple tuple) |
void |
run()
Called by the ReSpecT engine.
|
void |
setSpawnerId(TucsonAgentId id)
Linda operations used in the spawned activity are performed ON BEHALF of
the agent who issued the
spawn (its "owner"). |
void |
setSpawnerId(TucsonTupleCentreId id)
Linda operations used in the spawned activity are performed ON BEHALF of
the tuplecentre who issued the
spawn (its "owner"). |
void |
setTargetTC(TucsonTupleCentreId id)
The tuplecentre target, which will "host" the spawned computation.
|
protected LogicTuple |
uin(LogicTuple tuple) |
protected LogicTuple |
uinp(LogicTuple tuple) |
protected LogicTuple |
uno(LogicTuple tuple) |
protected LogicTuple |
unop(LogicTuple tuple) |
protected LogicTuple |
urd(LogicTuple tuple) |
protected LogicTuple |
urdp(LogicTuple tuple) |
public final boolean checkInstantiation()
public abstract void doActivity()
public final TucsonIdWrapper<?> getSpawnerId()
spawn
a
computation, hence we need to handle both.getId()
)TucsonIdWrapper
public final TucsonTupleCentreId getTargetTC()
public final void run()
run
in interface java.lang.Runnable
public final void setSpawnerId(TucsonAgentId id)
spawn
(its "owner").id
- the identifier of the agent "owner" of the spawned activity.public final void setSpawnerId(TucsonTupleCentreId id)
spawn
(its "owner").id
- the identifier of the tuplecentre "owner" of the spawned
activity.public final void setTargetTC(TucsonTupleCentreId id)
id
- the identifier of the tuplecentre target of the spawned
activity.protected final LogicTuple in(LogicTuple tuple) throws TucsonInvalidLogicTupleException
tuple
- the tuple argument of the operationTucsonInvalidLogicTupleException
- if the given tuple is not a valid representation of a tupleOrdinarySynchACC
protected final java.util.List<LogicTuple> inAll(LogicTuple tuple) throws TucsonInvalidLogicTupleException
tuple
- the tuple argument of the operationTucsonInvalidLogicTupleException
- if the given tuple is not a valid representation of a tupleBulkSynchACC
protected final LogicTuple inp(LogicTuple tuple) throws TucsonInvalidLogicTupleException
tuple
- the tuple argument of the operationTucsonInvalidLogicTupleException
- if the given tuple is not a valid representation of a tupleOrdinarySynchACC
protected void log(java.lang.String msg)
msg
- the message to log on standard output.protected final LogicTuple no(LogicTuple tuple) throws TucsonInvalidLogicTupleException
tuple
- the tuple argument of the operationTucsonInvalidLogicTupleException
- if the given tuple is not a valid representation of a tupleOrdinarySynchACC
protected final java.util.List<LogicTuple> noAll(LogicTuple tuple) throws TucsonInvalidLogicTupleException
tuple
- the tuple argument of the operationTucsonInvalidLogicTupleException
- if the given tuple is not a valid representation of a tupleBulkSynchACC
protected final LogicTuple nop(LogicTuple tuple) throws TucsonInvalidLogicTupleException
tuple
- the tuple argument of the operationTucsonInvalidLogicTupleException
- if the given tuple is not a valid representation of a tupleOrdinarySynchACC
protected final LogicTuple out(LogicTuple tuple) throws TucsonInvalidLogicTupleException
tuple
- the tuple argument of the operationTucsonInvalidLogicTupleException
- if the given tuple is not a valid representation of a tupleOrdinarySynchACC
protected final java.util.List<LogicTuple> outAll(LogicTuple tuple) throws TucsonInvalidLogicTupleException
tuple
- the tuple argument of the operationTucsonInvalidLogicTupleException
- if the given tuple is not a valid representation of a tupleBulkSynchACC
protected final LogicTuple rd(LogicTuple tuple) throws TucsonInvalidLogicTupleException
tuple
- the tuple argument of the operationTucsonInvalidLogicTupleException
- if the given tuple is not a valid representation of a tupleOrdinarySynchACC
protected final java.util.List<LogicTuple> rdAll(LogicTuple tuple) throws TucsonInvalidLogicTupleException
tuple
- the tuple argument of the operationTucsonInvalidLogicTupleException
- if the given tuple is not a valid representation of a tupleBulkSynchACC
protected final LogicTuple rdp(LogicTuple tuple) throws TucsonInvalidLogicTupleException
tuple
- the tuple argument of the operationTucsonInvalidLogicTupleException
- if the given tuple is not a valid representation of a tupleOrdinarySynchACC
protected final LogicTuple uin(LogicTuple tuple) throws TucsonInvalidLogicTupleException
tuple
- the tuple argument of the operationTucsonInvalidLogicTupleException
- if the given tuple is not a valid representation of a tupleUniformSynchACC
protected final LogicTuple uinp(LogicTuple tuple) throws TucsonInvalidLogicTupleException
tuple
- the tuple argument of the operationTucsonInvalidLogicTupleException
- if the given tuple is not a valid representation of a tupleUniformSynchACC
protected final LogicTuple uno(LogicTuple tuple) throws TucsonInvalidLogicTupleException
tuple
- the tuple argument of the operationTucsonInvalidLogicTupleException
- if the given tuple is not a valid representation of a tupleUniformSynchACC
protected final LogicTuple unop(LogicTuple tuple) throws TucsonInvalidLogicTupleException
tuple
- the tuple argument of the operationTucsonInvalidLogicTupleException
- if the given tuple is not a valid representation of a tupleUniformSynchACC
protected final LogicTuple urd(LogicTuple tuple) throws TucsonInvalidLogicTupleException
tuple
- the tuple argument of the operationTucsonInvalidLogicTupleException
- if the given tuple is not a valid representation of a tupleUniformSynchACC
protected final LogicTuple urdp(LogicTuple tuple) throws TucsonInvalidLogicTupleException
tuple
- the tuple argument of the operationTucsonInvalidLogicTupleException
- if the given tuple is not a valid representation of a tupleUniformSynchACC