Package org.bzdev.bikeshare


package org.bzdev.bikeshare
Bike-sharing simulation package.

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:

UML diagram

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:

UML diagram

Similarly, the factories that configure domains and delay tables are shown in the following figure:

UML diagram

As mentioned in the top-level overview, the factories should be used in the following order or a similar order:

Regardless of the ordering, it must be such that objects are created before they are referenced, and some factories set or add parameters whose values are objects created by other factories:

Classes used to instrument a simulation

Classes used to instrument simulations can use instances of the classes shown in the following figure:

UML diagram

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.