Class HubDataAdapter

All Implemented Interfaces:
EventListener, HubDataListener

public class HubDataAdapter extends ScriptListenerAdapter implements HubDataListener
Adapter for hub-data listeners. This class provides a default implementation for the method specified by HubDataListener 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 method is provided by a scripting-language object with a method that has the same names as the method defined by this class. If a method is missing, the call will succeed but no action will be performed.
  • Constructor Details

    • HubDataAdapter

      public HubDataAdapter()
      Constructor.
    • HubDataAdapter

      public HubDataAdapter(ExpressionParser.ESPObject scriptObject)
      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 HubDataAdapter(ScriptingContext,Object) with a null first argument.

      Parameters:
      scriptObject - the scripting-language object implementing the listener interface for this adapter.
    • HubDataAdapter

      public HubDataAdapter(ScriptingContext sc, Object scriptObject)
      Constructor given a scripting context and script object.
      Parameters:
      sc - the scripting context for this adapter
      scriptObject - the scripting-language object implementing the listener interface for this adapter.
  • Method Details

    • hubChanged

      public void hubChanged(Hub hub, int bikeCount, boolean newBikeCount, int overflowCount, boolean newOverflowCount, double time, long ticks)
      Description copied from interface: HubDataListener
      Notify this listener that a hub's counts changed. This listener is intended for instrumentation purposes.
      Specified by:
      hubChanged in interface HubDataListener
      Parameters:
      hub - the hub that changed
      bikeCount - the new bike count
      newBikeCount - true if the bicycle count has changed during the event that invoked this listener; false otherwise
      overflowCount - the new overflow count
      newOverflowCount - true if the overflow count has changed during the event that invoked this listener; false otherwise
      time - the simulation time at which this method was called
      ticks - the simulation time in units of ticks at which this method was called