java.lang.Object
org.bzdev.scripting.ScriptListenerAdapter
org.bzdev.bikeshare.HubWorkerAdapter
- All Implemented Interfaces:
EventListener
,HubWorkerListener
Adapter for hub-worker listeners.
This class provides default implementations for the
methods specified by HubWorkerListener and allows the
listener to be implemented in a scripting language.
For use in Java code, one should override the methods of
this class. For use in a scripting environment, the
implementation of the methods is provided by a scripting-language
object whose methods include ones that the same names as the methods of
this class. If a method is missing, the call will succeed but no
action will be performed.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bzdev.scripting.ScriptListenerAdapter
ScriptListenerAdapter.ScriptMethodException
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.HubWorkerAdapter
(ScriptingContext sc, Object scriptObject) Constructor given a scripting context and script object.HubWorkerAdapter
(ExpressionParser.ESPObject scriptObject) Constructor with only a script object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
changedCount
(HubWorker worker, double time, long ticks, Hub hub, int oldcount, int newcount) Indicate that a worker's bicycle count changed.void
Indicate that a worker left a storage-hub queue.void
enteredHub
(HubWorker worker, double time, long ticks, Hub hub) Indicate that a worker entered a hub.void
fixingOverflows
(HubWorker worker, double time, long ticks, Hub hub) Indicated that a worker started to remove bicycles from the overflow area.void
fixingPreferred
(HubWorker worker, double time, long ticks, Hub hub) Indicate that a worker started to handle the preferred area.void
Indicate that a worker left a hub.void
Indicate that a worker joined a queue.Methods inherited from class org.bzdev.scripting.ScriptListenerAdapter
callScriptMethod
-
Constructor Details
-
HubWorkerAdapter
public HubWorkerAdapter()Constructor. -
HubWorkerAdapter
Constructor with only a script object. This creates an adapter for use with the ESP scripting language.Note: This is equivalent to using the constructor
HubWorkerAdapter(ScriptingContext,Object)
with a null first argument.- Parameters:
scriptObject
- the scripting-language object implementing the listener interface for this adapter.
-
HubWorkerAdapter
Constructor given a scripting context and script object.- Parameters:
sc
- the scripting context for this adapterscriptObject
- the scripting-language object implementing the listener interface for this adapter.
-
-
Method Details