public interface ExternalContextAccess extends Capacity
Modifier and Type | Method and Description |
---|---|
void |
emit(space : EventSpace,
event : Event,
[scope : Scope<Address>])
Emits a given event with the provided scope in the given space.
|
ConcurrentCollection<AgentContext> |
getAllContexts()
Replies all contexts this agent is a member of, including the default context.
|
AgentContext |
getContext(contextID : UUID)
Replies the AgentContext for the given ID.
|
AgentContext |
getUniverseContext()
Replies the AgentContext that is the root of all the contexts.
|
boolean |
isInSpace(event : Event,
space : Space)
Replies if the given event was emitted in the given space.
|
boolean |
isInSpace(event : Event,
spaceID : SpaceID)
Replies if the given event was emitted in the space with
the given identifier..
|
boolean |
isInSpace(event : Event,
spaceID : UUID)
Replies if the given event was emitted in the space with
the given identifier..
|
AgentContext |
join(contextID : UUID,
expectedDefaultSpaceID : UUID)
Joins a new parent context (a new super holon).
|
boolean |
leave(contextID : UUID)
Leaves the parent's context.
|
@Pure
def
getAllContexts() : ConcurrentCollection<AgentContext>
ExternalContextAccess
@Pure
def
getContext(contextID : UUID) : AgentContext
ExternalContextAccess
contextID
- the ID of the context to get.UnknownContextException
- if the context specified context is not known by the agent.Agent.getParentID()
,
ExternalContextAccess.join(java.util.UUID, java.util.UUID)
@Pure
def
getUniverseContext() : AgentContext
ExternalContextAccess
def
join(contextID : UUID,
expectedDefaultSpaceID : UUID) : AgentContext
ExternalContextAccess
The agent will be involved in the context with the ID given by contextID. The parameter expectedDefaultSpaceID is only used to check if the caller of this function knows the ID of the default space in the context to be involved in. Note that the context must already exists, and the default space inside this context must have the same ID as expectedDefaultSpaceID. If the given expectedDefaultSpaceID does not match the ID of the default space in the context contextID, then the access to the context is forbidden.
This actions registers the agent in the default Space of the context with the ID contextID.
This function replies false
if one of the following conditions evaluates to true:
contextID
- the identifier of the context to join.expectedDefaultSpaceID
- the known identifier of the default space in the agent context with the given identifier.null
if the context cannot be joined.def
leave(contextID : UUID) : boolean
ExternalContextAccess
Because an agent must be always into a context, this function fails (and replies false
) when
the context to be leaved is the current default context of the agent, and there is no other context or
more than 1 other context that could be elected as the new default context.
This function replies false
if one of the following conditions evaluates to true:
contextID
- the identifier of the context to leave.true
if the agent has leaved the context. false
if one of the conditions described in
the function's comment evaluates to true.@Pure
def
isInSpace(event : Event,
space : Space) : boolean
ExternalContextAccess
event
- the event to test.space
- the space in which the event may be.true
if the given event was emitted in the
given space. Otherwise false
.@Pure
def
isInSpace(event : Event,
spaceID : SpaceID) : boolean
ExternalContextAccess
event
- the event to test.spaceID
- the identifier of the space in which the event may be.true
if the given event was emitted in the
space with the given identifier. Otherwise false
.@Pure
def
isInSpace(event : Event,
spaceID : UUID) : boolean
ExternalContextAccess
event
- the event to test.spaceID
- the identifier of the space in which the event may be.true
if the given event was emitted in the
space with the given identifier. Otherwise false
.def
emit(space : EventSpace,
event : Event,
[scope : Scope<Address>]) : void
ExternalContextAccess
space.emit(getID,event,scope)
space
- the space in which the event should be fired.event
- the event to emit.scope
- the definition of the scope that will be used for selected the receivers of the events. If null
, all the agents in the space will receive the event.Copyright © 2021 the original authors or authors.