public abstract class Artifact
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
Artifact.AbstractAsyncProcess |
Modifier and Type | Field and Description |
---|---|
protected double |
observabilityRadius |
protected AbstractWorkspacePoint |
position |
protected OpId |
thisOpId |
Constructor and Description |
---|
Artifact() |
Modifier and Type | Method and Description |
---|---|
protected void |
await_time(long dt)
Blocks the execution of current operation until the specified amount of
time has passed.
|
protected void |
await(IBlockingCmd cmd)
Blocks the execution of current operation until the specified blocking
command has been executed.
|
protected void |
await(java.lang.String guardName,
java.lang.Object... params)
Blocks the execution of current operation until the condition specified
by the guard is satisfied.
|
protected void |
commit() |
protected void |
defineObsProperty(java.lang.String name,
java.lang.Object... values)
Add an observable property
|
protected void |
defineOp(IArtifactOp op,
IArtifactGuard guard)
Defining a new artifact operation
|
protected void |
delay(long ms)
Delay the execution of next instruction of the specified amount of time
Note that this operation blocks the artifact access
|
protected void |
dispose()
Method automatically called when the artifact is
disposed.
|
protected void |
dispose(ArtifactId aid)
Dispose an artifact
|
protected void |
execInternalOp(java.lang.String opName,
java.lang.Object... params)
Start the execution of an internal operation.
|
protected void |
execLinkedOp(ArtifactId aid,
java.lang.String opName,
java.lang.Object... params)
Execute a linked operation, given the artifact id
|
protected void |
execLinkedOp(java.lang.String outPortName,
java.lang.String opName,
java.lang.Object... params)
Execute a linked operation
|
protected void |
failed(java.lang.String reason)
Terminate current operation with a failure
|
protected void |
failed(java.lang.String reason,
java.lang.String tupleDesc,
java.lang.Object... params)
Terminate current operation with a failure
|
protected AgentId |
getCreatorId() |
protected ArtifactId |
getId()
Get the artifact unique identifier
|
static java.lang.String |
getManualSrcFile(java.lang.String artType)
Get the name of the file containing the manual for the specified artifact
template, by accessing to ARTIFACT_INFO annotation.
|
protected double |
getObservabilityRadius() |
protected ObsProperty |
getObsProperty(java.lang.String name) |
protected ObsProperty |
getObsPropertyByTemplate(java.lang.String name,
java.lang.Object... values) |
static java.lang.String |
getOpKey(java.lang.String opName,
int nargs)
Get the key of an operation, given its name and n args.
|
protected ArtifactId |
getOpUserBody()
Get the identifier of the current user artifact body (if available)
|
protected AgentId |
getOpUserId()
Get the identifier of the current user
|
protected java.lang.String |
getOpUserName()
Get the name of the current user
|
protected AbstractWorkspacePoint |
getPosition() |
protected boolean |
hasObsProperty(java.lang.String name) |
protected boolean |
hasObsPropertyByTemplate(java.lang.String name,
java.lang.Object... values) |
protected boolean |
isLinked(java.lang.String outPortName)
Check if an artifact is linked to a port
|
protected void |
log(java.lang.String msg)
Log the information on standard output.
|
protected ArtifactId |
lookupArtifact(java.lang.String name)
Lookup an artifact
|
protected ArtifactId |
makeArtifact(java.lang.String name,
java.lang.String type,
ArtifactConfig params)
Create an artifact from another artifact.
|
protected void |
removeObsProperty(java.lang.String name)
Remove an observable property
|
protected void |
removeObsPropertyByTemplate(java.lang.String name,
java.lang.Object... values)
Remove an observable property
|
protected void |
setupOperations()
Set up artifact operations.
|
protected void |
setupPosition(AbstractWorkspacePoint pos,
double observabilityRadius) |
protected void |
signal(AgentId target,
java.lang.String type,
java.lang.Object... objs)
Primitive to generate an event.
|
protected void |
signal(java.lang.String type,
java.lang.Object... objs)
Primitive to generate an event.
|
protected void |
updateObservabilityRadius(double radius) |
protected void |
updateObsProperty(java.lang.String name,
java.lang.Object... values)
For compatibility reason...
|
protected void |
updatePosition(AbstractWorkspacePoint pos) |
protected OpId thisOpId
protected AbstractWorkspacePoint position
protected double observabilityRadius
protected void setupOperations() throws CartagoException
CartagoException
public static java.lang.String getManualSrcFile(java.lang.String artType) throws UnknownArtifactException
artType
- artifact templateUnknownArtifactException
public static java.lang.String getOpKey(java.lang.String opName, int nargs)
opName
- op namenargs
- number of parametersprotected ArtifactId getId()
protected AgentId getOpUserId()
protected ArtifactId getOpUserBody()
protected java.lang.String getOpUserName()
protected void commit()
protected void signal(java.lang.String type, java.lang.Object... objs)
protected void signal(AgentId target, java.lang.String type, java.lang.Object... objs)
protected void failed(java.lang.String reason)
reason
- description of the failureprotected void failed(java.lang.String reason, java.lang.String tupleDesc, java.lang.Object... params)
reason
- description of the failuretupleDesc
- functor of a machine readable tuple describing the failureparams
- parameters of a machine readable tuple describing the failureprotected void defineObsProperty(java.lang.String name, java.lang.Object... values)
name
- name of the propertyvalues
- values of the propertyprotected void removeObsProperty(java.lang.String name)
name
- name of the propertyprotected void removeObsPropertyByTemplate(java.lang.String name, java.lang.Object... values)
name
- name of the propertyvalues
- arguments of the propertyprotected ObsProperty getObsProperty(java.lang.String name)
protected boolean hasObsProperty(java.lang.String name)
protected ObsProperty getObsPropertyByTemplate(java.lang.String name, java.lang.Object... values)
protected boolean hasObsPropertyByTemplate(java.lang.String name, java.lang.Object... values)
protected void updateObsProperty(java.lang.String name, java.lang.Object... values)
protected void await(java.lang.String guardName, java.lang.Object... params)
guardName
- - name of the boolean method implementing the guardparams
- - parameters of the methodprotected void await_time(long dt)
dt
- - amount of time in millisecondsprotected void await(IBlockingCmd cmd)
cmd
- - the command to be executedprotected void execInternalOp(java.lang.String opName, java.lang.Object... params)
op
- - the operation to be executedprotected void execLinkedOp(java.lang.String outPortName, java.lang.String opName, java.lang.Object... params) throws OperationException
outPortName
- name of the out portopName
- name of the operation to executeparams
- parameters of the operationOperationException
protected boolean isLinked(java.lang.String outPortName)
outPortName
- protected void execLinkedOp(ArtifactId aid, java.lang.String opName, java.lang.Object... params) throws OperationException
aid
- artifact identifieropName
- name of the operation to executeparams
- parameters of the operationOperationException
protected ArtifactId makeArtifact(java.lang.String name, java.lang.String type, ArtifactConfig params) throws OperationException
name
- name of the artifacttype
- templateparams
- parameters - use ArtifactConfig.DEFAULT_CONFIG for default
configurationOperationException
protected void dispose(ArtifactId aid) throws OperationException
aid
- artifact idOperationException
protected ArtifactId lookupArtifact(java.lang.String name) throws OperationException
name
- artifact nameOperationException
protected void delay(long ms)
ms
- amount of time in millisecondsprotected void log(java.lang.String msg)
protected void defineOp(IArtifactOp op, IArtifactGuard guard)
op
- operationguard
- guardprotected void dispose()
protected void setupPosition(AbstractWorkspacePoint pos, double observabilityRadius)
protected void updatePosition(AbstractWorkspacePoint pos)
protected void updateObservabilityRadius(double radius)
protected final AbstractWorkspacePoint getPosition()
protected final double getObservabilityRadius()
protected AgentId getCreatorId()
>DEIS - University of Bologna