java.lang.Object
org.bzdev.devqsim.SimObject
org.bzdev.drama.generic.GenericSimObject<S,A,C,D,DM,F,G>
org.bzdev.drama.generic.GenericTaskObject<S,A,C,D,DM,F,G>
org.bzdev.drama.generic.GenericDomain<DramaSimulation,Actor,Condition,Domain,DomainMember,DramaFactory,Group>
org.bzdev.drama.Domain
org.bzdev.bikeshare.HubDomain
- All Implemented Interfaces:
Comparable<Domain>
,CondObserver<Condition,
,Domain> NamedObjectOps
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 Summary
ConstructorsModifierConstructorDescriptionprotected
HubDomain
(DramaSimulation sim, String name, boolean intern, int priority) Constructor.protected
HubDomain
(DramaSimulation sim, String name, boolean intern, Domain parent, int priority) Constructor with a parent domain. -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
clone()
final boolean
delete()
final boolean
double
estimateDelay
(double time, Hub hub1, Hub hub2, int n) Estimate the delay for travel between two hubs given a starting time.double
estimateDelay
(Hub hub1, Hub hub2, int n) Estimate the delay for travel between two hubs.protected abstract CommDomainType
Get this object's communication domain type.double
Get the delay for travel between two hubs given a starting time.double
Get the delay for travel between two hubs.Get the delay table.final String
getName()
protected Simulation
Get a user domain's parent, provided it is an instance of HubDomain.final boolean
boolean
void
printConfiguration
(String iPrefix, String prefix, boolean printName, PrintWriter out) Print the configuration for an instance of HubDomain.Methods inherited from class org.bzdev.drama.Domain
getMsgForwardingInfo, setMessageForwardingInfo
Methods inherited from class org.bzdev.drama.generic.GenericDomain
actorSet, actorSetSize, addCommDomainTypeSet, addCondition, canDelete, communicationMatch, communicationMatch, communicationMatch, communicationMatch, communicationMatch, communicationMatch, communicationMatch, communicationMatchByDomain, communicationMatchByDomain, communicationMatchByDomain, communicationMatchByDomain, communicationMatchByDomainAncestor, communicationMatchByDomainAncestor, communicationMatchByDomainAncestor, communicationMatchByDomainAncestor, compareTo, conditionSet, configureAsCommunicationDomain, configureAsCommunicationDomain, configureAsCommunicationDomain, containsActor, containsDomainMember, containsGroup, createCommDomainInfo, domainMemberSet, getCommDomainType, getCommDomainTypeSet, getConditionChangeQMode, getCondObserverImpl, getDelay, getDelay, getDelay, getDelay, getMessageFilter, getMessageFilter, getMessageFilter, getMessageFilter, getMFI, getParent, getPriority, groupSet, groupSetSize, hasCondition, isCommunicationDomain, onChildAdd, onChildRemove, onDelete, onJoinedDomain, onJoinedDomain, onLeftDomain, onLeftDomain, removeCondition, setConditionChangeQMode, setMessageForwardingInfo
Methods inherited from class org.bzdev.drama.generic.GenericTaskObject
cancelDefaultCall, cancelDefaultTask, defaultCall, defaultTask, scheduleDefaultCall, scheduleDefaultTask, scheduleDefaultTask
Methods inherited from class org.bzdev.drama.generic.GenericSimObject
getSimulation, printState
Methods inherited from class org.bzdev.devqsim.SimObject
addSimulationListener, addTraceSet, bindCallable, bindCallable, bindCallable, bindCallable, bindRunnable, bindRunnable, bindRunnable, bindRunnable, callableObject, callableScript, callScriptFunction, callScriptMethod, clearTraceSets, evalScript, getEventListenerList, getScriptObject, getTraceSets, printConfiguration, printConfiguration, printConfiguration, printConfiguration, printConfiguration, printConfiguration, printState, printState, printState, printState, printState, printState, putScriptObject, removeSimulationListener, removeTraceSet, runnableObject, runnableScript, scheduleCall, scheduleCall, scheduleCall, scheduleCall, scheduleCallObject, scheduleScript, scheduleTask, scheduleTask, scheduleTask, scheduleTask, scheduleTaskObject, scheduleTaskScript, startImmediateTask, startImmediateTask, trace, trace, unscheduledTaskThread, unscheduledTaskThread, update, update, usesTraceSet
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bzdev.obnaming.NamedObjectOps
delete, deletePending, getName, isDeleted, isInterned
-
Constructor Details
-
HubDomain
Constructor.- Parameters:
sim
- the simulationname
- the name of this objectintern
- true if this object should be interned in the simulation's name table; false otherwisepriority
- the priority for this domain
-
HubDomain
Constructor with a parent domain.- Parameters:
sim
- the simulationname
- the name of this objectintern
- true if this object should be interned in the simulation's name table; false otherwiseparent
- the parent domainpriority
- the priority for this domain
-
-
Method Details
-
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
andSysDomain
use different communication-domain types, while this class is expected to be a communication domain.- Returns:
- this domain's communication-domain type
-
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
-
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
Print the configuration for an instance of HubDomain. The documentation for methodSimObject.printConfiguration(String,String,boolean,java.io.PrintWriter)
contains a description of how this method is used and how to override it. The methodGenericActor.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 classGenericDomain<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 stringprefix
- a prefix string (typically whitespace) to put at the start of each line other than the initial line that is printed when printName is trueprintName
- requests printing the name of an objectout
- the output print writer
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
isInterned
public boolean isInterned()- Specified by:
isInterned
in interfaceNamedObjectOps
-
getObjectNamer
-
getName
- Specified by:
getName
in interfaceNamedObjectOps
-
delete
public final boolean delete()- Specified by:
delete
in interfaceNamedObjectOps
-
isDeleted
public final boolean isDeleted()- Specified by:
isDeleted
in interfaceNamedObjectOps
-
deletePending
public final boolean deletePending()- Specified by:
deletePending
in interfaceNamedObjectOps
-