To use the library, the jar file libbikeshr.jar (which should be installed in the same directory as libbzdev.jar) should be added to the class path in addition to libbzdev.jar. When scrunner is used, libbzdev.jar is automatically included.
-classpath /usr/share/java/libbikeshr.jar:/usr/share/java/libbzdev.jar
(/usr/share/java
is the standard location for java
libraries on Debian Linux systems). Additional class path components
will be needed as well (e.g., to find a main program).
--codebase .../libbikeshr.jar
will add the library to the
path when the libbikeshr.jar file is installed in the same directory
as the libbzdev.jar file. This is the most convenient way of creating
an animation using a scripting language as the path name for the library
is short (the directory "..." is replaced with the directory containing
the libbzdev.jar file).
The corresponding ESP script isscripting.importClasses("org.bzdev.bikeshare", ["HubDataAdapter", "TripDataAdapter"]); scripting.importClass("org.bzdev.drama.DramaSimulation"); scripting.importClass("org.bzdev.util.units.MKS"); // Import whatever random number generators are desired. scripting.importClass("org.bzdev.math.rv.GaussianRV"); // 1000.0 is the number of simulation ticks per second and can // be changed as desired. sim = new DramaSimulation(scripting, 1000.0); simff = sim.createFactory("org.bzdev.devqsim.SimFunctionTwoFactory"); sim.createFactories("org.bzdev.bikeshare", { edf: "ExtDomainFactory", udf: "UsrDomainFactory", sdf: "SysDomainFactory", hbf: "BasicHubBalancerFactory", hf: "HubFactory", shf: "StorageHubFactory", hwf: "HubWorkerFactory", stdtf: "StdDelayTableFactory", schedtf: "SchedDelayTableFactory", btgf: "BasicTripGenFactory" });
The line containingimport (org.bzdev.bikeshare, [HubDataAdapter, TripDataAdapter]); import (org.bzdev.drama.DramaSimulation); import (org.bzdev.util.units.MKS); // Import whatever random number generators are desired. import (org.bzdev.math.rv.GaussianRV); // 1000.0 is the number of simulation ticks per second and can // be changed as desired. var sim = new DramaSimulation(scripting, 1000.0); var simff = sim.createFactory("org.bzdev.devqsim.SimFunctionTwoFactory"); sim.createFactories("org.bzdev.bikeshare", { edf: "ExtDomainFactory", udf: "UsrDomainFactory", sdf: "SysDomainFactory", hbf: "BasicHubBalancerFactory", hf: "HubFactory", shf: "StorageHubFactory", hwf: "HubWorkerFactory", stdtf: "StdDelayTableFactory", schedtf: "SchedDelayTableFactory", btgf: "BasicTripGenFactory" }); ###
###
is needed if any following statements
use one of the factories defined by calling the createFactories
method. It is not needed if those statements appear in a separate file.
The factories should be used in the order listed above, or a similar
order, due to the following dependencies:
UsrHubDomainFactory
can specify a parent domain that
will typically be an instance of ExtDomain.
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
and
SchedDelayTableFactory
parameters whose values are
hub domains and hubs
BasicTripGenFactory
has parameters whose values are
hubs. This class may optionally have a parameter whose value is
an instance of org.bzdev.devqsim.SimFunctionTwo
.