Class SimulationManager
java.lang.Object
edu.nps.moves.dis7.utilities.SimulationManager
Manage overall Simulation Management (SIMAN) choreography for a participating application in a DIS channel.
- IEEE 1278.1 DIS Application Protocols, 4.6.3.a.5 Timestamp, General Requirements, page 43
- IEEE 1278.1 DIS Application Protocols, 4.6.3.c.1 Timestamp, Relative Timestamps, page 44
- IEEE 1278.1 DIS Application Protocols, 5.6 Simulation management, page 89
- Author:
- brutzman
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Simple simulation record type -
Constructor Summary
ConstructorsConstructorDescriptionObject constructorSimulationManager
(String newDescriptor) Object constructor with descriptor -
Method Summary
Modifier and TypeMethodDescriptionAdd entity to simulation list, if this is first occurrenceaddEntity
(SimulationManager.RecordType newEntity) Add entity to simulation list and announce using CreateEntityPduAdd host to simulation list, if this is first occurrenceclearAll()
clear all listsReset descriptorprotected void
Create disThreadedNetworkInterfaceprotected void
createDisThreadedNetworkInterface
(String newDescriptor) Constructor for disThreadedNetworkInterface with descriptor, using default multicast address and portprotected void
createDisThreadedNetworkInterface
(String address, int port) Constructor for disThreadedNetworkInterface using specified multicast address and portprotected void
createDisThreadedNetworkInterface
(String address, int port, String newDescriptor) Constructor for disThreadedNetworkInterface using specified multicast address and port, plus descriptor.getApplicationRecordByID
(int valueOfInterest) Get a single applicationRecord from list matching IDgetApplicationRecordByIndex
(int index) Get a single applicationRecord from listProvide entire applicationRecordListGet simple descriptor (such as parent class name) for this SimulationManager, used in trace statementsprotected DisThreadedNetworkInterface
Provide access to current disThreadedNetworkInterfacegetEntityRecordByID
(int valueOfInterest) Get a single entityRecord from list matching IDgetEntityRecordByIndex
(int index) Get a single entityRecord from listProvide entire entityRecordListgetHostRecordByID
(int valueOfInterest) Get a single hostRecord from list matching IDgetHostRecordByIndex
(int index) Get a single hostRecord from listProvide entire hostRecordListprotected boolean
Check for disThreadedNetworkInterfacestatic void
Main method for testing.removeEntity
(SimulationManager.RecordType oldEntity) Remove entity from simulation list, if foundremoveHost
(String oldHost) Remove host from simulation list, if foundvoid
selfTest()
Self test to check basic operation, invoked by main()setDescriptor
(String newDescriptor) Set new simple descriptor (such as parent class name) for this SimulationManager, used in trace statementssetDisThreadedNetworkInterface
(DisThreadedNetworkInterface disThreadedNetworkInterface) Set the disThreadedNetworkInterface singleton to match other classesvoid
setPduFactory
(PduFactory pduFactory) void
An entity can Join the simulation according to specificationsvoid
An entity can Leave the simulation according to specificationsvoid
Pause the simulation according to specificationsvoid
Resume the simulation according to specificationsvoid
Start the simulation according to specificationsvoid
Stop the simulation according to specifications
-
Constructor Details
-
SimulationManager
Object constructor with descriptor- Parameters:
newDescriptor
- simple descriptor name for this class
-
SimulationManager
public SimulationManager()Object constructor
-
-
Method Details
-
simulationStart
public void simulationStart()Start the simulation according to specifications -
simulationPause
public void simulationPause()Pause the simulation according to specifications -
simulationResume
public void simulationResume()Resume the simulation according to specifications -
simulationStop
public void simulationStop()Stop the simulation according to specifications -
simulationJoin
public void simulationJoin()An entity can Join the simulation according to specifications -
simulationLeave
public void simulationLeave()An entity can Leave the simulation according to specifications -
getEntityRecordByIndex
Get a single entityRecord from list- Parameters:
index
- which record to retrieve- Returns:
- the record matching this index
-
getHostRecordByIndex
Get a single hostRecord from list- Parameters:
index
- which record to retrieve- Returns:
- the record matching this index
-
getApplicationRecordByIndex
Get a single applicationRecord from list- Parameters:
index
- which record to retrieve- Returns:
- the record matching this index
-
getEntityRecordByID
Get a single entityRecord from list matching ID- Parameters:
valueOfInterest
- id for record to retrieve- Returns:
- the record matching this ID
-
getHostRecordByID
Get a single hostRecord from list matching ID- Parameters:
valueOfInterest
- id for record to retrieve- Returns:
- the record matching this ID
-
getApplicationRecordByID
Get a single applicationRecord from list matching ID- Parameters:
valueOfInterest
- id for record to retrieve- Returns:
- the record matching this ID
-
getEntityRecordList
Provide entire entityRecordList- Returns:
- the entityRecordList
-
getHostRecordList
Provide entire hostRecordList- Returns:
- the hostRecordList
-
getApplicationRecordList
Provide entire applicationRecordList- Returns:
- the applicationRecordList
-
getDisThreadedNetworkInterface
Provide access to current disThreadedNetworkInterface- Returns:
- the disThreadedNetworkInterface
-
setDisThreadedNetworkInterface
public SimulationManager setDisThreadedNetworkInterface(DisThreadedNetworkInterface disThreadedNetworkInterface) Set the disThreadedNetworkInterface singleton to match other classes- Parameters:
disThreadedNetworkInterface
- the disThreadedNetworkInterface to set- Returns:
- same object to permit progressive setters
-
hasDisThreadedNetworkInterface
protected boolean hasDisThreadedNetworkInterface()Check for disThreadedNetworkInterface- Returns:
- whether singleton disThreadedNetworkInterface has been instantiated
-
createDisThreadedNetworkInterface
protected void createDisThreadedNetworkInterface()Create disThreadedNetworkInterface -
createDisThreadedNetworkInterface
Constructor for disThreadedNetworkInterface with descriptor, using default multicast address and port- Parameters:
newDescriptor
- simple descriptor name for this interface
-
createDisThreadedNetworkInterface
Constructor for disThreadedNetworkInterface using specified multicast address and port- Parameters:
address
- the multicast group or unicast address to utilizeport
- the multicast port to utilize
-
createDisThreadedNetworkInterface
Constructor for disThreadedNetworkInterface using specified multicast address and port, plus descriptor.- Parameters:
address
- the multicast group or unicast address to utilizeport
- the multicast port to utilizenewDescriptor
- simple descriptor name for this interface
-
getDescriptor
Get simple descriptor (such as parent class name) for this SimulationManager, used in trace statements- Returns:
- simple descriptor name
-
setDescriptor
Set new simple descriptor (such as parent class name) for this SimulationManager, used in trace statements- Parameters:
newDescriptor
- simple descriptor name for this interface- Returns:
- same object to permit progressive setters
-
clearDescriptor
Reset descriptor- Returns:
- same object to permit progressive setters
-
clearAll
clear all lists- Returns:
- same object to permit progressive setters
-
addEntity
Add entity to simulation list, if this is first occurrence- Parameters:
newEntityID
- new entity to add- Returns:
- same object to permit progressive setters
-
addEntity
Add entity to simulation list and announce using CreateEntityPdu- Parameters:
newEntity
- new entity to add- Returns:
- same object to permit progressive setters
-
removeEntity
Remove entity from simulation list, if found- Parameters:
oldEntity
- old entity to remove- Returns:
- same object to permit progressive setters
-
addHost
Add host to simulation list, if this is first occurrence- Parameters:
newHost
- new host to add- Returns:
- same object to permit progressive setters
-
removeHost
Remove host from simulation list, if found- Parameters:
oldHost
- old host to remove- Returns:
- same object to permit progressive setters
-
selfTest
public void selfTest()Self test to check basic operation, invoked by main() -
main
Main method for testing.- Parameters:
args
- [address, port, descriptor] command-line arguments are an array of optional String parameters that are passed from execution environment during invocation- See Also:
-
getPduFactory
- Returns:
- the pduFactory
-
setPduFactory
- Parameters:
pduFactory
- the pduFactory to set
-