org.onebusaway.transit_data_federation.services.realtime
Class TripLocation

java.lang.Object
  extended by org.onebusaway.transit_data_federation.services.realtime.TripLocation

public class TripLocation
extends Object

Vehicle location information for a particular trip.

Author:
bdferris

Constructor Summary
TripLocation()
           
 
Method Summary
 StopTimeEntry getClosestStop()
          The closest stop to the current position of the transit vehicle among the stop times of the current trip.
 int getClosestStopTimeOffset()
          The time offset, in seconds, from the closest stop to the current position of the transit vehicle among the stop times of the current trip.
 double getDistanceAlongTrip()
          Note that this value could potentially be negative or larger than the total length of the trip's shape if we are tracking its location along a block before or after the trip.
 CoordinatePoint getLastKnownLocation()
           
 long getLastUpdateTime()
           
 CoordinatePoint getLocation()
           
 double getScheduleDeviation()
          If schedule deviation information is not available, this value will be Double.NaN.
 long getServiceDate()
           
 TripEntry getTrip()
           
 org.onebusaway.gtfs.model.AgencyAndId getVehicleId()
           
 boolean hasDistanceAlongTrip()
           
 boolean hasScheduleDeviation()
           
 boolean isInService()
          Note that a trip may be considered in service even if the vehicle isn't actively serving the trip segment if the parent block is in service.
 boolean isPredicted()
          If real-time data is available in any form for this vehicle
 void setClosestStop(StopTimeEntry closestStop)
           
 void setClosestStopTimeOffset(int closestStopTimeOffset)
          See description in getClosestStopTimeOffset().
 void setDistanceAlongRoute(double distanceAlongRoute)
           
 void setInService(boolean inService)
           
 void setLastKnownLocation(CoordinatePoint lastKnownLocation)
           
 void setLastUpdateTime(long time)
           
 void setLocation(CoordinatePoint location)
           
 void setPredicted(boolean predicted)
           
 void setScheduleDeviation(double scheduleDeviation)
           
 void setServiceDate(long serviceDate)
           
 void setTrip(TripEntry trip)
           
 void setVehicleId(org.onebusaway.gtfs.model.AgencyAndId vehicleId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TripLocation

public TripLocation()
Method Detail

getTrip

public TripEntry getTrip()

setTrip

public void setTrip(TripEntry trip)

getServiceDate

public long getServiceDate()

setServiceDate

public void setServiceDate(long serviceDate)

isInService

public boolean isInService()
Note that a trip may be considered in service even if the vehicle isn't actively serving the trip segment if the parent block is in service.

Returns:
true if the trip is actively in service

setInService

public void setInService(boolean inService)

getLocation

public CoordinatePoint getLocation()
Returns:
the trip location

setLocation

public void setLocation(CoordinatePoint location)

hasDistanceAlongTrip

public boolean hasDistanceAlongTrip()
Returns:
true if getDistanceAlongTrip() is set

getDistanceAlongTrip

public double getDistanceAlongTrip()
Note that this value could potentially be negative or larger than the total length of the trip's shape if we are tracking its location along a block before or after the trip. If this value is not set, the value will be Double.NaN.

Returns:
the distance traveled along the shape of the route, in meters

setDistanceAlongRoute

public void setDistanceAlongRoute(double distanceAlongRoute)

getClosestStop

public StopTimeEntry getClosestStop()
The closest stop to the current position of the transit vehicle among the stop times of the current trip.

Returns:
the closest stop time entry

setClosestStop

public void setClosestStop(StopTimeEntry closestStop)

getClosestStopTimeOffset

public int getClosestStopTimeOffset()
The time offset, in seconds, from the closest stop to the current position of the transit vehicle among the stop times of the current trip. If the number is positive, the stop is coming up. If negative, the stop has already been passed.

Returns:
time, in seconds

setClosestStopTimeOffset

public void setClosestStopTimeOffset(int closestStopTimeOffset)
See description in getClosestStopTimeOffset().

Parameters:
closestStopTimeOffset - the time offset from the closest stop, in seconds

isPredicted

public boolean isPredicted()
If real-time data is available in any form for this vehicle

Returns:
true if real-time is available

setPredicted

public void setPredicted(boolean predicted)

getLastUpdateTime

public long getLastUpdateTime()
Returns:
the time we last heard from the bus (Unix-time)

setLastUpdateTime

public void setLastUpdateTime(long time)

getLastKnownLocation

public CoordinatePoint getLastKnownLocation()

setLastKnownLocation

public void setLastKnownLocation(CoordinatePoint lastKnownLocation)

hasScheduleDeviation

public boolean hasScheduleDeviation()
Returns:
true if getScheduleDeviation() is set

getScheduleDeviation

public double getScheduleDeviation()
If schedule deviation information is not available, this value will be Double.NaN.

Returns:
schedule deviation, in seconds, (+deviation is late, -deviation is early)

setScheduleDeviation

public void setScheduleDeviation(double scheduleDeviation)
Parameters:
scheduleDeviation - schedule deviation, in seconds, (+deviation is late, -deviation is early)

getVehicleId

public org.onebusaway.gtfs.model.AgencyAndId getVehicleId()

setVehicleId

public void setVehicleId(org.onebusaway.gtfs.model.AgencyAndId vehicleId)


Copyright © 2011 OneBusAway. All Rights Reserved.