public class SimulationSetup
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
SimulationSetup.CHANGED
Lists the possible reasons why a SimulationSetup can be changed and unsaved
|
static class |
SimulationSetup.SetupFileType
The possible indicator for setup file types.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AGENT_LIST_EnvironmentConfiguration |
static java.lang.String |
AGENT_LIST_ManualConfiguration |
static java.lang.String |
USER_MODEL_BIN_FileSuffix |
static java.lang.String |
USER_MODEL_XML_FileSuffix |
static java.lang.String |
XML_FileSuffix |
Constructor and Description |
---|
SimulationSetup()
Constructor without arguments (This is first of all
for the JAXB-Context and should not be used by any
other context).
|
SimulationSetup(Project project)
Default Constructor of this class.
|
Modifier and Type | Method and Description |
---|---|
void |
clearAgentDefaultListModels()
Clear the agent default list models.
|
void |
createHashMap4AgentDefaulListModelsFromAgentList()
This method will create all DefaultListModels which will be used within the visible application
as for example for the manual agent configuration (tab 'Simulation-Setup' => 'Agent-Start') or the configuration of the environment model (tab 'Simulation-Setup' => 'Simulation Environment'). |
javax.swing.DefaultListModel<AgentClassElement4SimStart> |
getAgentDefaultListModel(javax.swing.DefaultListModel<AgentClassElement4SimStart> newDefaultListModel4AgentStarts,
java.lang.String listName)
This method can be used in order to add an individual agent start list to the SimulationSetup.
|
javax.swing.DefaultListModel<AgentClassElement4SimStart> |
getAgentDefaultListModel(java.lang.String listName)
This method can be used in order to get an agents start list for the
simulation, given by.
|
java.util.ArrayList<AgentClassElement4SimStart> |
getAgentList()
Gets the agent list.
|
java.lang.String |
getAgentNameUnique(java.lang.String agentNameSuggestion)
Will find a new unique name for an agent, if the suggestion is not already unique.
|
javax.swing.DefaultComboBoxModel<java.lang.String> |
getComboBoxModel4AgentLists()
Gets the combo box model4 agent lists.
|
java.lang.String |
getEnvironmentFileName()
Gets the environment file name.
|
static java.io.File |
getSetupBaseFile(java.io.File fileToCheck)
Returns the nominal base setup file from the specified file, but without garanty that
the file really exists.
|
static java.io.File |
getSetupFile(java.io.File xmlBaseFile,
SimulationSetup.SetupFileType setupFileType)
Returns, based on the specified base XML file, the specified setup file (especially for user runtime objects).
|
static java.util.List<java.io.File> |
getSetupFiles(java.io.File xmlBaseFile)
Returns, based on the specified base XML file, all possible setup file (e.g. also for user runtime objects).
|
java.util.HashMap<java.lang.String,java.lang.String> |
getTimeModelSettings()
Gets the time model settings.
|
java.io.Serializable |
getUserRuntimeObject()
Gets the user runtime object.
|
boolean |
isAgentNameExists(java.lang.String localAgentName)
Checks if an agent name already exists in the current agent configuration.
|
boolean |
isAgentNameExists(java.lang.String agentName2Check,
boolean mergeListModels)
Checks if an agent name already exists in the current agent configuration.
|
static SimulationSetup |
load(java.io.File setupXmlFile,
boolean loadUserRuntimeObject)
Loads a
SimulationSetup from the specified XML file. |
boolean |
saveSetupFiles()
This method saves the current
SimulationSetup and it files to the default location for setups. |
boolean |
saveSetupFiles(java.io.File setupXmlFile,
boolean saveUserRuntimeObject)
This method saves the current
SimulationSetup to the specified location. |
void |
setAgentDefaultListModel(java.lang.String listName,
javax.swing.DefaultListModel<AgentClassElement4SimStart> defaultListModel4AgentStarts)
Here a complete agent start list (DefaultListModel) can be added to the simulation setup.
|
void |
setAgentList(java.util.ArrayList<AgentClassElement4SimStart> agentList)
Sets the agent list.
|
void |
setComboBoxModel4AgentLists(javax.swing.DefaultComboBoxModel<java.lang.String> comboBoxModel4AgentLists)
Sets the ComboBoxModel for agent lists.
|
void |
setEnvironmentFileName(java.lang.String environmentFile)
Sets the environment file name.
|
void |
setProject(Project project)
Sets the current project.
|
void |
setTimeModelSettings(java.util.HashMap<java.lang.String,java.lang.String> newTimeModelSettings)
Sets the time model settings.
|
void |
setUserRuntimeObject(java.io.Serializable userRuntimeObject)
Sets the user runtime object.
|
public static final java.lang.String XML_FileSuffix
public static final java.lang.String USER_MODEL_BIN_FileSuffix
public static final java.lang.String USER_MODEL_XML_FileSuffix
public static final java.lang.String AGENT_LIST_ManualConfiguration
public static final java.lang.String AGENT_LIST_EnvironmentConfiguration
public SimulationSetup()
public SimulationSetup(Project project)
project
- the projectpublic void setProject(Project project)
project
- the currProject to setpublic boolean saveSetupFiles()
SimulationSetup
and it files to the default location for setups.public boolean saveSetupFiles(java.io.File setupXmlFile, boolean saveUserRuntimeObject)
SimulationSetup
to the specified location.
If the user runtime object should not be saved, set the according parameter.setupXmlFile
- The setup xml file (other file paths are derived)saveUserRuntimeObject
- set true, if user runtime object should be saved in its separate filepublic static SimulationSetup load(java.io.File setupXmlFile, boolean loadUserRuntimeObject)
SimulationSetup
from the specified XML file.setupXmlFile
- the setup xml filepublic java.util.ArrayList<AgentClassElement4SimStart> getAgentList()
public void setAgentList(java.util.ArrayList<AgentClassElement4SimStart> agentList)
agentList
- the agentList to setpublic void createHashMap4AgentDefaulListModelsFromAgentList()
getAgentDefaultListModel(String)
public void setAgentDefaultListModel(java.lang.String listName, javax.swing.DefaultListModel<AgentClassElement4SimStart> defaultListModel4AgentStarts)
listName
- the list namedefaultListModel4AgentStarts
- the default list model4 agent startspublic void clearAgentDefaultListModels()
public void setComboBoxModel4AgentLists(javax.swing.DefaultComboBoxModel<java.lang.String> comboBoxModel4AgentLists)
comboBoxModel4AgentLists
- the comboBoxModel4AgentLists to setpublic javax.swing.DefaultComboBoxModel<java.lang.String> getComboBoxModel4AgentLists()
public javax.swing.DefaultListModel<AgentClassElement4SimStart> getAgentDefaultListModel(java.lang.String listName)
listName
- the list namepublic javax.swing.DefaultListModel<AgentClassElement4SimStart> getAgentDefaultListModel(javax.swing.DefaultListModel<AgentClassElement4SimStart> newDefaultListModel4AgentStarts, java.lang.String listName)
AgentClassElement4SimStart
coming from
the stored setup file and will be later on also stored in the file of the simulation setup.newDefaultListModel4AgentStarts
- the new DefaultListModel to setlistName
- the name of the list to be assigned.
Consider the use of one of the constants AGENT_LIST_ManualConfiguration
or AGENT_LIST_EnvironmentConfiguration
or just use an individual nameAgentClassElement4SimStart - The type to use within a concrete list model
public java.lang.String getEnvironmentFileName()
public void setEnvironmentFileName(java.lang.String environmentFile)
environmentFile
- the new environment file namepublic void setUserRuntimeObject(java.io.Serializable userRuntimeObject)
userRuntimeObject
- the userRuntimeObject to setpublic java.io.Serializable getUserRuntimeObject()
public boolean isAgentNameExists(java.lang.String localAgentName)
localAgentName
- The agent name to search forpublic boolean isAgentNameExists(java.lang.String agentName2Check, boolean mergeListModels)
agentName2Check
- The agent name to search formergeListModels
- indicates if the over all agentList
has to be build newpublic java.lang.String getAgentNameUnique(java.lang.String agentNameSuggestion)
agentNameSuggestion
- the agent name suggestionpublic void setTimeModelSettings(java.util.HashMap<java.lang.String,java.lang.String> newTimeModelSettings)
newTimeModelSettings
- the new time model settingspublic java.util.HashMap<java.lang.String,java.lang.String> getTimeModelSettings()
public static java.io.File getSetupFile(java.io.File xmlBaseFile, SimulationSetup.SetupFileType setupFileType)
xmlBaseFile
- the XML base filesetupFileType
- the setup file typepublic static java.util.List<java.io.File> getSetupFiles(java.io.File xmlBaseFile)
xmlBaseFile
- the XML base filepublic static java.io.File getSetupBaseFile(java.io.File fileToCheck)
fileToCheck
- the file to check