Class SimulationManager

java.lang.Object
edu.nps.moves.dis7.utilities.SimulationManager

public class SimulationManager extends Object
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:
  • Constructor Details

    • SimulationManager

      public SimulationManager(String newDescriptor)
      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

      public SimulationManager.RecordType getEntityRecordByIndex(int index)
      Get a single entityRecord from list
      Parameters:
      index - which record to retrieve
      Returns:
      the record matching this index
    • getHostRecordByIndex

      public SimulationManager.RecordType getHostRecordByIndex(int index)
      Get a single hostRecord from list
      Parameters:
      index - which record to retrieve
      Returns:
      the record matching this index
    • getApplicationRecordByIndex

      public SimulationManager.RecordType getApplicationRecordByIndex(int index)
      Get a single applicationRecord from list
      Parameters:
      index - which record to retrieve
      Returns:
      the record matching this index
    • getEntityRecordByID

      public SimulationManager.RecordType getEntityRecordByID(int valueOfInterest)
      Get a single entityRecord from list matching ID
      Parameters:
      valueOfInterest - id for record to retrieve
      Returns:
      the record matching this ID
    • getHostRecordByID

      public SimulationManager.RecordType getHostRecordByID(int valueOfInterest)
      Get a single hostRecord from list matching ID
      Parameters:
      valueOfInterest - id for record to retrieve
      Returns:
      the record matching this ID
    • getApplicationRecordByID

      public SimulationManager.RecordType getApplicationRecordByID(int valueOfInterest)
      Get a single applicationRecord from list matching ID
      Parameters:
      valueOfInterest - id for record to retrieve
      Returns:
      the record matching this ID
    • getEntityRecordList

      public List<SimulationManager.RecordType> getEntityRecordList()
      Provide entire entityRecordList
      Returns:
      the entityRecordList
    • getHostRecordList

      public List<SimulationManager.RecordType> getHostRecordList()
      Provide entire hostRecordList
      Returns:
      the hostRecordList
    • getApplicationRecordList

      public List<SimulationManager.RecordType> getApplicationRecordList()
      Provide entire applicationRecordList
      Returns:
      the applicationRecordList
    • getDisThreadedNetworkInterface

      protected DisThreadedNetworkInterface 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

      protected void createDisThreadedNetworkInterface(String newDescriptor)
      Constructor for disThreadedNetworkInterface with descriptor, using default multicast address and port
      Parameters:
      newDescriptor - simple descriptor name for this interface
    • createDisThreadedNetworkInterface

      protected void createDisThreadedNetworkInterface(String address, int port)
      Constructor for disThreadedNetworkInterface using specified multicast address and port
      Parameters:
      address - the multicast group or unicast address to utilize
      port - the multicast port to utilize
    • createDisThreadedNetworkInterface

      protected void createDisThreadedNetworkInterface(String address, int port, String newDescriptor)
      Constructor for disThreadedNetworkInterface using specified multicast address and port, plus descriptor.
      Parameters:
      address - the multicast group or unicast address to utilize
      port - the multicast port to utilize
      newDescriptor - simple descriptor name for this interface
    • getDescriptor

      public String getDescriptor()
      Get simple descriptor (such as parent class name) for this SimulationManager, used in trace statements
      Returns:
      simple descriptor name
    • setDescriptor

      public SimulationManager setDescriptor(String newDescriptor)
      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

      public SimulationManager clearDescriptor()
      Reset descriptor
      Returns:
      same object to permit progressive setters
    • clearAll

      public SimulationManager clearAll()
      clear all lists
      Returns:
      same object to permit progressive setters
    • addEntity

      public SimulationManager addEntity(EntityID newEntityID)
      Add entity to simulation list, if this is first occurrence
      Parameters:
      newEntityID - new entity to add
      Returns:
      same object to permit progressive setters
    • addEntity

      public SimulationManager addEntity(SimulationManager.RecordType newEntity)
      Add entity to simulation list and announce using CreateEntityPdu
      Parameters:
      newEntity - new entity to add
      Returns:
      same object to permit progressive setters
    • removeEntity

      public SimulationManager removeEntity(SimulationManager.RecordType oldEntity)
      Remove entity from simulation list, if found
      Parameters:
      oldEntity - old entity to remove
      Returns:
      same object to permit progressive setters
    • addHost

      public SimulationManager addHost(String newHost)
      Add host to simulation list, if this is first occurrence
      Parameters:
      newHost - new host to add
      Returns:
      same object to permit progressive setters
    • removeHost

      public SimulationManager removeHost(String oldHost)
      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

      public static void main(String[] args)
      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

      public PduFactory getPduFactory()
      Returns:
      the pduFactory
    • setPduFactory

      public void setPduFactory(PduFactory pduFactory)
      Parameters:
      pduFactory - the pduFactory to set