Class BikeShare

java.lang.Object
org.bzdev.bikeshare.BikeShare

public class BikeShare extends Object
Package configuration class. This class is a global configuration class that sets numerical values for trace levels (the default is for no tracing), and the domain priorities for the user and system hub domains (the defaults are 0 and 1 respectively). The priority for a user domain must be lower than that for a system domain. It also sets the minimum speed used by the StdDelayTable class.

To enable tracing, set the levels of interest to non-zero values (normally one should set all of them, with level1 < level2 < level3 < level4. The default domain priorities should be set to other values only if other communication domains are defined (e.g., if this simulation library is used in conjunction with other libraries).

  • Constructor Details

    • BikeShare

      public BikeShare()
  • Method Details

    • setTraceLevels

      public static void setTraceLevels(int level1, int level2, int level3, int level4) throws IllegalArgumentException
      Set trace levels explicitly. A level of -1 indicates that nothing will be displayed. Otherwise the level must be a non-negative integer. For the models in the org.bzdev.bikeshare package, the levels are used as follows:
      • For level1, the traced operations are the configuration of trip generators, starting and stopping of trip generators, and a hub balancer starting workers that run persistently.
      • For level2, the traced operations are
        • a BasicHubBalancer starting additional workers, noting when these workers cannot be scheduled and when a worker started successfully,
        • a StorageHub queuing a worker, unqueuing a worker, or delaying unqueuing until a worker becomes available.
      • For level3, the operations of a HubWorker at each hub are traced.
      • For level4, the bicycle trips are traced.
      Normally level1 < level2 < level3 < level4. The initial value for each of these levels is -1, indicating that nothing should be shown.
      Parameters:
      level1 - the first trace level
      level2 - the second trace level
      level3 - the third trace level
      level4 - the fourth trace level
      Throws:
      IllegalArgumentException - an argument was smaller than -1
    • setTraceLevels

      public static <T extends Enum<T>> void setTraceLevels(T level1, T level2, T level3, T level4)
      Set trace levels using enumerations. A level set to null indicates that nothing will be displayed. Otherwise the level must be an enumeration constant, with the constant's ordinal value providing the level. For the models in the org.bzdev.bikeshare package, the levels are used as follows:
      • For level1, the traced operations are the configuration of trip generators, starting and stopping of trip generators, and a hub balancer starting workers that run persistently.
      • For level2, the traced operations are
        • a BasicHubBalancer starting additional workers, noting when these workers cannot be scheduled and when a worker started successfully,
        • a StorageHub queuing a worker, unqueuing a worker, or delaying unqueuing until a worker becomes available.
      • For level3, the operations of a HubWorker at each hub are traced.
      • For level4, the bicycle trips are traced.
      Normally level1 < level2 < level3 < level4 where the comparison uses the enumerations' ordinal values.
      Type Parameters:
      T - the enumeration type used to name trace levels
      Parameters:
      level1 - the first trace level
      level2 - the second trace level
      level3 - the third trace level
      level4 - the fourth trace level
    • setPriorities

      public static void setPriorities(Integer usrPriority, Integer extPriority, Integer sysPriority) throws IllegalArgumentException
      Set domain priorities for hub domains. The values set will be used by constructors and the priorities of existing hub domains will not be changed when this method is used. It is intended for cases where multiple models are integrated to interoperate and
      Parameters:
      usrPriority - the priority for UsrDomain
      extPriority - the priority for ExtDomain
      sysPriority - the priority for SysDomain
      Throws:
      IllegalArgumentException - the usrPriority argument was not lower than the schedPriority argument, which should in turn be lower than the sysPriority argument.
    • setMinStdDelayTableSpeed

      public static void setMinStdDelayTableSpeed(double value)
      Set the minimum speed for the StdDelayTable class.
      Parameters:
      value - the speed in units of meters/second; 0.0 or a negative value to restore the default