public class

MappedSharedState

extends Object
implements SharedStateStorage
java.lang.Object
   ↳ uk.ac.imperial.presage2.util.environment.MappedSharedState

Summary

Public Constructors
MappedSharedState()
Public Methods
void change(String name, UUID participantID, Serializable value)

Change a shared state value for a given agent to a given value.

void change(String name, UUID participantID, StateTransformer change)

Modify a shared state value for a given agent.

void changeGlobal(String name, Serializable value)

Change a global shared state value to a given new value,

Value will not be changed until the next time slice.

void changeGlobal(String name, StateTransformer change)

Modify a global shared state value.

synchronized void create(String name, UUID participantID, Serializable value)

Create a shared state value for a given agent.

void create(ParticipantSharedState state)

Create a shared state value for a given agent.

synchronized void createGlobal(String name, Serializable value)

Create a value in the global shared state.

void createGlobal(SharedState state)

Create a value in the global shared state.

void delete(String name, UUID participantID)

Delete a shared state value for a given agent.

synchronized void deleteGlobal(String name)

Delete a value in the global shared state.

Serializable get(String name, UUID participantID)
Get a shared state value for an individual agent.
Serializable getGlobal(String name)
Get a global shared state value.
void incrementTime()
void setEventBus(EventBus e)
Protected Methods
Map<UUIDMap<StringSerializable>> initAgentStateMap()
Map<StringSerializable> initGlobalStateMap()
void updateState()
[Expand]
Inherited Methods
From class java.lang.Object
From interface uk.ac.imperial.presage2.core.TimeDriven
From interface uk.ac.imperial.presage2.core.environment.EnvironmentSharedStateAccess

Public Constructors

public MappedSharedState ()

Public Methods

public void change (String name, UUID participantID, Serializable value)

Change a shared state value for a given agent to a given value.

Value will not be changed until the next time slice.

Parameters
name String key of the value to change
participantID UUID of the agent
value StateTransformer which will perform the change.

public void change (String name, UUID participantID, StateTransformer change)

Modify a shared state value for a given agent.

Value will not be changed until the next time slice.

Parameters
name String key of the value to change
participantID UUID of the agent
change StateTransformer which will perform the change.

public void changeGlobal (String name, Serializable value)

Change a global shared state value to a given new value,

Value will not be changed until the next time slice.

Parameters
name String key name of the value to be changed.
value New value to be set.

public void changeGlobal (String name, StateTransformer change)

Modify a global shared state value.

Value will not be changed until the next time slice.

Parameters
name String key name of the value to be changed.
change StateTransformer which will perform the change.

public synchronized void create (String name, UUID participantID, Serializable value)

Create a shared state value for a given agent.

Value will be created in the current time cycle.

Parameters
name String key of the value to change
participantID UUID of the agent
value Initial value to set state to.

public void create (ParticipantSharedState state)

Create a shared state value for a given agent.

Value will be created in the current time cycle.

Parameters
state ParticipantSharedState describing the state to create.

public synchronized void createGlobal (String name, Serializable value)

Create a value in the global shared state.

Value will be created in the current time cycle.

Parameters
name String key name of the value to create.
value Initial value to set state to.

public void createGlobal (SharedState state)

Create a value in the global shared state.

Value will be created in the current time cycle.

Parameters
state SharedState describing the state to create.

public void delete (String name, UUID participantID)

Delete a shared state value for a given agent.

Parameters
name String key of the value to change
participantID UUID of the agent

public synchronized void deleteGlobal (String name)

Delete a value in the global shared state.

Parameters
name String key name of the value to create.

public Serializable get (String name, UUID participantID)

Get a shared state value for an individual agent.

Parameters
name String key of the value to get
participantID UUID of the agent
Returns
  • Serializable value if it exists in the state for this agent, null otherwise.

public Serializable getGlobal (String name)

Get a global shared state value.

Parameters
name String key name of the value
Returns
  • Serializable value if it exists in the state, null otherwise.

public void incrementTime ()

public void setEventBus (EventBus e)

Protected Methods

protected Map<UUIDMap<StringSerializable>> initAgentStateMap ()

protected Map<StringSerializable> initGlobalStateMap ()

protected void updateState ()