Class TripDataAdapter

java.lang.Object
org.bzdev.scripting.ScriptListenerAdapter
org.bzdev.bikeshare.TripDataAdapter
All Implemented Interfaces:
TripDataListener

public class TripDataAdapter extends ScriptListenerAdapter implements TripDataListener
Adapter for trip-data listeners. This class provides default implementations for the methods specified by TripDataListener 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.
  • Constructor Details

    • TripDataAdapter

      public TripDataAdapter()
      Constructor.
    • TripDataAdapter

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

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

      public TripDataAdapter(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

    • tripStarted

      public void tripStarted(long tripID, double time, long ticks, Hub hub, HubDomain d)
      Description copied from interface: TripDataListener
      Indicate that a trip has started.
      Specified by:
      tripStarted in interface TripDataListener
      Parameters:
      tripID - the ID for a trip;
      time - the simulation time in double-precision units
      ticks - the simulation time in ticks
      hub - the hub at which this event occurred
      d - the HubDomain that determined the travel time for the trip
    • tripPauseStart

      public void tripPauseStart(long tripID, double time, long ticks, Hub hub)
      Description copied from interface: TripDataListener
      Indicates that the start of an interval during which a trip paused at an intermediate hub.
      Specified by:
      tripPauseStart in interface TripDataListener
      Parameters:
      tripID - the ID for a trip;
      time - the simulation time in double-precision units
      ticks - the simulation time in ticks
      hub - the hub at which this event occurred
    • tripPauseEnd

      public void tripPauseEnd(long tripID, double time, long ticks, Hub hub, HubDomain d)
      Description copied from interface: TripDataListener
      Indicates that the end of an interval during which a trip paused at an intermediate hub.
      Specified by:
      tripPauseEnd in interface TripDataListener
      Parameters:
      tripID - the ID for a trip;
      time - the simulation time in double-precision units
      ticks - the simulation time in ticks
      hub - the hub at which this event occurred
      d - the HubDomain that determined the travel time for the trip
    • tripEnded

      public void tripEnded(long tripID, double time, long ticks, Hub hub)
      Description copied from interface: TripDataListener
      Indicate that a trip has ended.
      Specified by:
      tripEnded in interface TripDataListener
      Parameters:
      tripID - the ID for a trip;
      time - the simulation time in double-precision units
      ticks - the simulation time in ticks
      hub - the hub at which this event occurred
    • tripFailedAtStart

      public void tripFailedAtStart(long tripID, double time, long ticks, Hub hub)
      Description copied from interface: TripDataListener
      Indicate that a trip has failed to start. This can occur if a hub does not have a sufficient number of bicycles available.
      Specified by:
      tripFailedAtStart in interface TripDataListener
      Parameters:
      tripID - the ID for a trip;
      time - the simulation time in double-precision units
      ticks - the simulation time in ticks
      hub - the hub at which this event occurred
    • tripFailedMidstream

      public void tripFailedMidstream(long tripID, double time, long ticks, Hub hub)
      Description copied from interface: TripDataListener
      Indicate that a trip has failed to complete. This can occur if a hub does not have a sufficient number of bicycles available at an intermediate hop (e.g., for intermodal trips).

      Note: the class BasicTripGenerator does not call this method.

      Specified by:
      tripFailedMidstream in interface TripDataListener
      Parameters:
      tripID - the ID for a trip;
      time - the simulation time in double-precision units
      ticks - the simulation time in ticks
      hub - the hub at which this event occurred