Package org.bzdev.bikeshare
This package, which is based on the drama package (org.bzdev.drama), provides classes that can be used to simulate a bike-sharing system. The class hierarchy can be partitioned into three sections:
- The classes used to run a simulation.
- The classes used to configure a simulation (i.e., factory classes)
- The classes used to instrument a simulation.
Classes used to run a simulation
The classes used during the execution of a simulation, excluding any instrumentation, are shown in the following figure:
Classes used to configure a simulation
Factory classes are used to configure simulations by creating simulation objects. The factories that create actors are shown in the following figure:
Similarly, the factories that configure domains and delay tables are shown in the following figure:
As mentioned in the top-level overview, the factories should be used in the following order or a similar order:
-
ExtDomainFactory
. -
UsrDomainFactory
. -
SysDomainFactory
. -
BasicHubBalancerFactory
. -
HubFactory
. -
StorageHubFactory
. -
HubWorkerFactory
. -
StdDelayTableFactory
. -
SchedDelayTableFactory
- subclasses of
TripGeneratorFactory
:
UsrDomainFactory
has a parameter that is an external domain (the default is null, which is a legal value).-
BasicHubBalancerFactory
has a parameter whose value is a system domain. -
HubFactory
has parameters whose values are a user domain and a system domain. -
StorageHubFactory
has parameters whose values are a system domain and a list of hubs. -
HubWorkerFactory
has parameters whose values are a system domain, and a storage hub. -
StdDelayTableFactory
andSchedDelayTableFactory
have parameters whose values are hub domains and hubs. -
BasicTripGenFactory
andBurstTripGenFactory
has parameters whose values are hubs.
Classes used to instrument a simulation
Classes used to instrument simulations can use instances of the classes shown in the following figure:
For simulations written totally in Java, one could use the interfaces directly although using the adapters may be more convenient in cases were only a subset of the methods for the corresponding interface are used to record or process various events. In this case, when the adapters are used, one would typically use their zero-argument constructors and provide custom implementations for whatever methods are useful. For simulations that are written in a scripting language there are two options:
- Create Java classes that implement the listeners or extend the adapters.
- Use the two argument constructors for the adapters and provide
a scripting-language object that implements the adapters'
behavior (in this case, when scrunner is used, the first
argument for an adapter's constructor will be the predefined
variable
scripting
and the second argument will be a scripting-language object whose methods provide the implementation for the methods defined by the corresponding listener.
-
ClassDescriptionAbstractExtDomainFactory<Obj extends ExtDomain>Abstract Factory for creating external domains.AbstractHubFactory<Obj extends Hub>Abstract factory for creating hubs.AbstractSysDomainFactory<Obj extends SysDomain>Abstract Factory for creating system domains.AbstractUsrDomainFactory<Obj extends UsrDomain>Abstract Factory for creating user domains.AbstrBasicHubBalancerFactory<Obj extends BasicHubBalancer>Abstract factory for instances of BasicHubBalander and any subclasses.AbstrBasicTripGenFactory<Obj extends BasicTripGenerator>Abstract factory for BasicTripGenerator.AbstrBurstTripGenFactory<Obj extends BurstTripGenerator>Abstract factory for BurstTripGenerator.AbstrHubWorkerFactory<Obj extends HubWorker>Abstract factory for instances of HubWorker.AbstrRoundTripGenFactory<Obj extends RoundTripGenerator>Abstract factory for RoundTripGenerator.AbstrSchedDelayTblFactory<Obj extends SchedDelayTable>Abstract factory for delay tables used for determining the time for scheduled trips between hubs.AbstrStdDelayTblFactory<Obj extends StdDelayTable>Abstract factory for delay tables used for determining the time for unscheduled trips between hubs.AbstrStorageHubFactory<Obj extends StorageHub>Abstract factory class for a storage hub.Basic hub balancer class.Factory for creating instances of BasicHubBalancerFactory.Trip generator trips between two hubs given Poisson traffic, A specified number of bicycles per trip, a starting hub and a set of destination hubs, the probabilities for using a given destination, and the probabilities for each destination of using the overflow area.Factory for creating instances of BasicTripGenFactory.Package configuration class.Trip generator for trips that occur in bursts.Factory for creating instances of BurstTripGenFactory.Base class for delay tables.DelayTableFactory<Obj extends DelayTable>Abstract factory for delay tables.Class providing a user domain.Factory for creating instances of ExtDomainFactory.Class modeling a hub.Message representing a trip.Base class for hub balancers.HubBalancerFactory<Obj extends HubBalancer>Base factory for hub balancers.Condition class for tracking the status of a set of hubs A hub condition keeps track of sets of hubs that have more bicycles at a hub's preferred location than the value of the hub's upper trigger.Adapter for hub-data listeners.Hub data listener interface.Base class for hub domains.HubDomainFactory<Obj extends HubDomain>Base factory for hub domains.Factory for creating instances of HubFactory.Hub listener interface.Class representing a hub worker.Interface for classes that generate a traversal order for hubs.Enumeration listing the Worker modes.Adapter for hub-worker listeners.Factory for creating instances of HubWorkerFactory.Data listener class for hub workers.Trip generator trips between two hubs given Poisson traffic, A specified number of bicycles per trip, a starting hub and a set of destination hubs, the probabilities for using a given destination, and the probabilities for each destination of using the overflow area.Factory for creating instances of RoundTripGenFactory.Class representing a delay table for scheduled trips between hubs.Factory for creating instances of SchedDelayTableFactory.Factory for delay tables used for determining the time for unscheduled trips between hubs.Factory for creating instances of StdDelayTableFactory.Class representing a storage hub.Factory for creating instances of StorageHubFactory.Class providing a system domain.Factory for creating instances of SysDomainFactory.Adapter for trip-data listeners.Data listener for trip generators.Trip generator class.TripGeneratorFactory<Obj extends TripGenerator>Base class for trip generator factories.Class providing a user domain.Factory for creating instances of UsrDomainFactory.