Class HubDomain

All Implemented Interfaces:
Comparable<Domain>, CondObserver<Condition,Domain>, NamedObjectOps
Direct Known Subclasses:
ExtDomain, SysDomain, UsrDomain

public abstract class HubDomain extends Domain
Base class for hub domains. Hub domains are communication domains, and have an associated instance of the class DelayTable to determine travel times between hubs.
  • Constructor Details

    • HubDomain

      protected HubDomain(DramaSimulation sim, String name, boolean intern, int priority)
      Constructor.
      Parameters:
      sim - the simulation
      name - the name of this object
      intern - true if this object should be interned in the simulation's name table; false otherwise
      priority - the priority for this domain
    • HubDomain

      protected HubDomain(DramaSimulation sim, String name, boolean intern, Domain parent, int priority)
      Constructor with a parent domain.
      Parameters:
      sim - the simulation
      name - the name of this object
      intern - true if this object should be interned in the simulation's name table; false otherwise
      parent - the parent domain
      priority - the priority for this domain
  • Method Details

    • fetchCommDomainType

      protected abstract CommDomainType fetchCommDomainType()
      Get this object's communication domain type. Concrete subclasses must override this method and ensure that the method is idempotent. The value returned must not be null.

      This method is provided because the subclasses UsrDomain and SysDomain use different communication-domain types, while this class is expected to be a communication domain.

      Returns:
      this domain's communication-domain type
    • getDelayTable

      public DelayTable getDelayTable()
      Get the delay table. Each hub domain contains a table providing delay information for each hub. A factory for a hub domain will typically call this method to configure delays. Users not using factories will have to call this method directly to configure delays
      Returns:
      the delay table for this hub
    • estimateDelay

      public double estimateDelay(double time, Hub hub1, Hub hub2, int n)
      Estimate the delay for travel between two hubs given a starting time.
      Parameters:
      time - the simulation time at which to get the travel delay between any two hubs.
      hub1 - the starting hub
      hub2 - the ending hub
      n - the number of individuals traveling together
      Returns:
      the delay in units of seconds
    • estimateDelay

      public double estimateDelay(Hub hub1, Hub hub2, int n)
      Estimate the delay for travel between two hubs. The starting time is the current simulation time.
      Parameters:
      hub1 - the starting hub
      hub2 - the ending hub
      n - the number of individuals traveling together
      Returns:
      the delay in units of seconds
    • getDelay

      public double getDelay(double time, Hub hub1, Hub hub2, int n)
      Get the delay for travel between two hubs given a starting time.
      Parameters:
      time - the simulation time at which to get the travel delay between any two hubs.
      hub1 - the starting hub
      hub2 - the ending hub
      n - the number of individuals traveling together
      Returns:
      the delay in units of seconds
    • getDelay

      public double getDelay(Hub hub1, Hub hub2, int n)
      Get the delay for travel between two hubs. The starting time is the current simulation time.
      Parameters:
      hub1 - the starting hub
      hub2 - the ending hub
      n - the number of individuals traveling together
      Returns:
      the delay in units of seconds
    • getParentHubDomain

      public HubDomain getParentHubDomain()
      Get a user domain's parent, provided it is an instance of HubDomain.
      Returns:
      the parent if it is an instance of ExtDomain; null otherwise
    • printConfiguration

      public void printConfiguration(String iPrefix, String prefix, boolean printName, PrintWriter out)
      Print the configuration for an instance of HubDomain. The documentation for method SimObject.printConfiguration(String,String,boolean,java.io.PrintWriter) contains a description of how this method is used and how to override it. The method GenericActor.printConfiguration(String,String,boolean,java.io.PrintWriter) describes the data that will be printed for the superclass of this class. The data that will be printed when this method is called are the following.

      For class HubDomain:

      • the delay table for this domain.
      Overrides:
      printConfiguration in class GenericDomain<DramaSimulation,Actor,Condition,Domain,DomainMember,DramaFactory,Group>
      Parameters:
      iPrefix - the prefix to use for an initial line when printName is true with null treated as an empty string
      prefix - a prefix string (typically whitespace) to put at the start of each line other than the initial line that is printed when printName is true
      printName - requests printing the name of an object
      out - the output print writer
    • clone

      protected Object clone() throws CloneNotSupportedException
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • isInterned

      public boolean isInterned()
      Specified by:
      isInterned in interface NamedObjectOps
    • getObjectNamer

      protected Simulation getObjectNamer()
    • getName

      public final String getName()
      Specified by:
      getName in interface NamedObjectOps
    • delete

      public final boolean delete()
      Specified by:
      delete in interface NamedObjectOps
    • isDeleted

      public final boolean isDeleted()
      Specified by:
      isDeleted in interface NamedObjectOps
    • deletePending

      public final boolean deletePending()
      Specified by:
      deletePending in interface NamedObjectOps