public abstract class EnvironmentController
extends java.util.Observable
implements java.util.Observer
Modifier and Type | Class and Description |
---|---|
static class |
EnvironmentController.PersistenceStrategy
The enumeration PersistenceStrategy helps to differentiate when an
environment model should be opened or saved.
|
Constructor and Description |
---|
EnvironmentController()
Constructor for a new environment controller for handling
and displaying the current environment model during a running simulation.
|
EnvironmentController(Project project)
Constructor for a controller within the Agent.GUI application.
|
Modifier and Type | Method and Description |
---|---|
void |
callLoadEnvironment(EnvironmentController.PersistenceStrategy invokedFrom)
Call to load the environment model.
|
void |
callSaveEnvironment(EnvironmentController.PersistenceStrategy invokedFrom)
Call to save the environment model.
|
protected abstract EnvironmentPanel |
createEnvironmentPanel()
Creates here the EnvironmentPanel, which allows to display the current data model
of the environment model.
|
abstract AbstractEnvironmentModel |
getAbstractEnvironmentModel()
Returns the abstract (and individual) environment object of the EnvironmentModel
|
abstract AbstractEnvironmentModel |
getAbstractEnvironmentModelCopy()
Returns a copy of the abstract (and individual) environment object of the EnvironmentModel
|
javax.swing.DefaultListModel<AgentClassElement4SimStart> |
getAgents2Start()
Gets the list of agents to start.
|
AgentClassElement4SimStart[] |
getAgents2StartFromAgentName(java.lang.String agentName)
Gets the description instances of the agents to start, identified by the agent name
|
protected SimulationSetup |
getCurrentSimulationSetup()
Returns the current simulation setup
|
AbstractDisplayAgent |
getDisplayAgent()
Returns the
AbstractDisplayAgent that is using this EnvironmentController
in case that the agency is executed. |
abstract DisplaytEnvironmentModel |
getDisplayEnvironmentModel()
Returns the displayable environment object of the EnvironmentModel
|
abstract DisplaytEnvironmentModel |
getDisplayEnvironmentModelCopy()
Returns a copy of the displayable environment object of the EnvironmentModel
|
int |
getEmptyPosition4Agents2Start()
Returns an empty position for the Agents2Start.
|
java.lang.String |
getEnvFolderPath()
Gets the environment folder path.
|
EnvironmentModel |
getEnvironmentModel()
Returns the current instances of the EnvironmentModel.
|
EnvironmentPanel |
getEnvironmentPanel()
Gets the environment panel for displaying the data model.
|
EnvironmentPanel |
getOrCreateEnvironmentPanel()
Gets the environment panel for displaying the data model or creates it new.
|
protected abstract EnvironmentController.PersistenceStrategy |
getPersistenceStrategy()
Has to return which strategy is to be used to load or save an
EnvironmentModel . |
Project |
getProject()
Gets the current project.
|
TimeModel |
getTimeModel()
Returns the TimeModel.
|
TimeModel |
getTimeModelCopy()
Returns the TimeModel copy.
|
protected abstract void |
handleProjectNotification(java.lang.Object updateObject)
Invoked by the observer for the current
Project you can react on changes within the Project. |
protected abstract void |
handleSimulationSetupNotification(SimulationSetupNotification sscn)
Invoked by the projects observer if the simulation setup change event occurs.
|
abstract void |
loadEnvironment()
Has to load the environment model (e.g. from file).
|
protected void |
registerDefaultListModel4SimulationStart(java.lang.String listName)
With this method the list of Agents
agents2Start , which has to
be started with the environment can be registered at the SimulationSetup |
void |
reNumberAgents2Start()
Renumber the list of agents to start.
|
abstract void |
saveEnvironment()
Has to save the environment model (e.g. to to file).
|
abstract void |
setAbstractEnvironmentModel(AbstractEnvironmentModel abstractEnvironmentModel)
Set the abstract (and individual) environment object of the EnvironmentModel
|
void |
setAgents2Start(javax.swing.DefaultListModel<AgentClassElement4SimStart> agents2Start)
Sets the list of agents to start.
|
void |
setDisplayAgent(AbstractDisplayAgent newDisplayAgent)
Sets the
AbstractDisplayAgent that is using this EnvironmentController
In case that the agency is executed. |
abstract void |
setDisplayEnvironmentModel(DisplaytEnvironmentModel displayEnvironmentModel)
Set the displayable environment object of the EnvironmentModel
|
void |
setEnvFolderPath(java.lang.String envFolderPath)
Sets the environment folder path.
|
void |
setEnvironmentModel(EnvironmentModel environmentModel)
Sets the environment model.
|
void |
setEnvironmentPanel(EnvironmentPanel environmentPanel)
Sets the environment panel for displaying the data model.
|
void |
setProject(Project currProject)
Sets the project.
|
void |
setTimeModel(TimeModel mewTimeModel)
Sets the TimeModel.
|
void |
update(java.util.Observable observable,
java.lang.Object updateObject) |
public EnvironmentController()
public EnvironmentController(Project project)
project
- the current projectpublic void setEnvironmentPanel(EnvironmentPanel environmentPanel)
environmentPanel
- the EnvironmentPanel to setpublic EnvironmentPanel getEnvironmentPanel()
public EnvironmentPanel getOrCreateEnvironmentPanel()
protected abstract EnvironmentPanel createEnvironmentPanel()
protected SimulationSetup getCurrentSimulationSetup()
public Project getProject()
public void setProject(Project currProject)
currProject
- the new projectpublic void setEnvFolderPath(java.lang.String envFolderPath)
envFolderPath
- the new environment folder pathpublic java.lang.String getEnvFolderPath()
protected abstract EnvironmentController.PersistenceStrategy getPersistenceStrategy()
EnvironmentModel
. Hereby, it can be adjusted
when the methods loadEnvironment()
and saveEnvironment()
will be called from Agent.Workbench.EnvironmentController.PersistenceStrategy
public abstract void loadEnvironment()
public abstract void saveEnvironment()
public final void callLoadEnvironment(EnvironmentController.PersistenceStrategy invokedFrom)
invokedFrom
- indicates if the method was called during open a project or a setuppublic final void callSaveEnvironment(EnvironmentController.PersistenceStrategy invokedFrom)
invokedFrom
- indicates if the method was called during open a project or a setuppublic javax.swing.DefaultListModel<AgentClassElement4SimStart> getAgents2Start()
public void setAgents2Start(javax.swing.DefaultListModel<AgentClassElement4SimStart> agents2Start)
agents2Start
- the new agents2 startpublic int getEmptyPosition4Agents2Start()
public AgentClassElement4SimStart[] getAgents2StartFromAgentName(java.lang.String agentName)
agentName
- the agent namepublic void reNumberAgents2Start()
protected void registerDefaultListModel4SimulationStart(java.lang.String listName)
agents2Start
, which has to
be started with the environment can be registered at the SimulationSetup
listName
- Consider the use of the constant value SimulationSetup.AGENT_LIST_EnvironmentConfiguration
or just use an individual namepublic final void update(java.util.Observable observable, java.lang.Object updateObject)
update
in interface java.util.Observer
protected abstract void handleProjectNotification(java.lang.Object updateObject)
Project
you can react on changes within the Project.
Normally, the provided updateObject will be one of the constants specified in the class Project
.
For example the 'SAVED' constant of that class.updateObject
- the update object that informs about the type of change within the current projectprotected abstract void handleSimulationSetupNotification(SimulationSetupNotification sscn)
sscn
- the SimulationSetupsChangeNotification that can be differentiated by its globalspublic void setEnvironmentModel(EnvironmentModel environmentModel)
environmentModel
- the new environment modelpublic EnvironmentModel getEnvironmentModel()
public void setTimeModel(TimeModel mewTimeModel)
mewTimeModel
- the new TimeModelpublic TimeModel getTimeModel()
public TimeModel getTimeModelCopy()
public abstract void setDisplayEnvironmentModel(DisplaytEnvironmentModel displayEnvironmentModel)
displayEnvironmentModel
- the environment modelpublic abstract DisplaytEnvironmentModel getDisplayEnvironmentModel()
public abstract DisplaytEnvironmentModel getDisplayEnvironmentModelCopy()
public abstract void setAbstractEnvironmentModel(AbstractEnvironmentModel abstractEnvironmentModel)
abstractEnvironmentModel
- the environment modelpublic abstract AbstractEnvironmentModel getAbstractEnvironmentModel()
public abstract AbstractEnvironmentModel getAbstractEnvironmentModelCopy()
public void setDisplayAgent(AbstractDisplayAgent newDisplayAgent)
AbstractDisplayAgent
that is using this EnvironmentController
In case that the agency is executed. Using this instance you're able to translate
user interactions into ACLMessage
and SimulationService
-notifications
that can change settings and parameters during the runtime of the agency.newDisplayAgent
- the new, extended AbstractDisplayAgent
public AbstractDisplayAgent getDisplayAgent()
AbstractDisplayAgent
that is using this EnvironmentController
in case that the agency is executed. Using this instance you're able to translate
user interactions into ACLMessage
and SimulationService
-notifications
that can change settings and parameters during the runtime of the agency.