org.onebusaway.transit_data_federation.services.realtime
Class BlockLocation

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

public class BlockLocation
extends Object

Vehicle position information for a particular block.

Author:
bdferris

Constructor Summary
BlockLocation()
           
 
Method Summary
 boolean areScheduleDeviationsSet()
           
 BlockTripEntry getActiveTrip()
           
 BlockTripInstance getActiveTripInstance()
           
 BlockInstance getBlockInstance()
           
 BlockStopTimeEntry 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 getDistanceAlongBlock()
          If the trip is not in service (see isInService()), this value will be Double.NaN.
 int getEffectiveScheduleTime()
          The effective schedule time measures the progress of the transit vehicle in serving the underlying schedule.
 double getLastKnownDistanceAlongBlock()
           
 CoordinatePoint getLastKnownLocation()
           
 double getLastKnownOrientation()
          In degrees, 0º is East, 90º is North, 180º is West, and 270º is South
 long getLastLocationUpdateTime()
           
 long getLastUpdateTime()
           
 CoordinatePoint getLocation()
           
 BlockStopTimeEntry getNextStop()
          The next upcoming stop to the current position of the transit vehicle among the stop times of the current trip.
 int getNextStopTimeOffset()
          The time offset, in seconds, from the next stop to the current position of the transit vehicle.
 double getOrientation()
          In degrees, 0º is East, 90º is North, 180º is West, and 270º is South
 EVehiclePhase getPhase()
           
 double getScheduledDistanceAlongBlock()
          If the trip is not in service (see isInService()), this value will be Double.NaN.
 double getScheduleDeviation()
          If no schedule deviation data is available, this value with be Double.NaN.
 ScheduleDeviationSamples getScheduleDeviations()
           
 String getStatus()
           
 long getTime()
           
 org.onebusaway.gtfs.model.AgencyAndId getVehicleId()
           
 boolean isDistanceAlongBlockSet()
          If the trip is non in service (see isInService(), this value with be false.
 boolean isInService()
           
 boolean isLastKnownDistanceAlongBlockSet()
           
 boolean isLastKnownOrientationSet()
           
 boolean isOrientationSet()
           
 boolean isPredicted()
          If real-time data is available in any form (schedule deviation, distanceAlongBlock, last known location) for this vehicle
 boolean isScheduledDistanceAlongBlockSet()
           
 boolean isScheduleDeviationSet()
           
 void setActiveTrip(BlockTripEntry activeTrip)
           
 void setBlockInstance(BlockInstance instance)
           
 void setClosestStop(BlockStopTimeEntry closestStop)
           
 void setClosestStopTimeOffset(int closestStopTimeOffset)
          See description in getClosestStopTimeOffset().
 void setDistanceAlongBlock(double distanceAlongBlock)
           
 void setEffectiveScheduleTime(int effectiveScheduleTime)
           
 void setInService(boolean inService)
           
 void setLastKnownDistanceAlongBlock(double lastKnownDistanceAlongBlock)
           
 void setLastKnownLocation(CoordinatePoint lastKnownLocation)
           
 void setLastKnownOrientation(double lastKnownOrientation)
           
 void setLastLocationUpdateTime(long lastLocationUpdateTime)
           
 void setLastUpdateTime(long lastUpdateTime)
           
 void setLocation(CoordinatePoint location)
           
 void setNextStop(BlockStopTimeEntry nextStop)
           
 void setNextStopTimeOffset(int nextStopTimeOffset)
          See getNextStopTimeOffset()
 void setOrientation(double orientation)
           
 void setPhase(EVehiclePhase phase)
           
 void setPredicted(boolean predicted)
           
 void setScheduledDistanceAlongBlock(double scheduledDistanceAlongBlock)
           
 void setScheduleDeviation(double scheduleDeviation)
           
 void setScheduleDeviations(ScheduleDeviationSamples scheduleDeviations)
           
 void setStatus(String status)
           
 void setTime(long time)
           
 void setVehicleId(org.onebusaway.gtfs.model.AgencyAndId vehicleId)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BlockLocation

public BlockLocation()
Method Detail

getTime

public long getTime()

setTime

public void setTime(long time)

getBlockInstance

public BlockInstance getBlockInstance()

setBlockInstance

public void setBlockInstance(BlockInstance instance)

getActiveTrip

public BlockTripEntry getActiveTrip()
Returns:
the active trip for the block

setActiveTrip

public void setActiveTrip(BlockTripEntry activeTrip)

getActiveTripInstance

public BlockTripInstance getActiveTripInstance()
Returns:
the active trip instance for the block location

isInService

public boolean isInService()
Returns:
true if the block trip is actively in service

setInService

public void setInService(boolean inService)

isScheduledDistanceAlongBlockSet

public boolean isScheduledDistanceAlongBlockSet()

getScheduledDistanceAlongBlock

public double getScheduledDistanceAlongBlock()
If the trip is not in service (see isInService()), this value will be Double.NaN.

Returns:
the scheduled distance traveled along the shape of the block, in meters

setScheduledDistanceAlongBlock

public void setScheduledDistanceAlongBlock(double scheduledDistanceAlongBlock)

getEffectiveScheduleTime

public int getEffectiveScheduleTime()
The effective schedule time measures the progress of the transit vehicle in serving the underlying schedule. effectiveScheduleTime = currentTime - scheduleDeviation

Returns:
time, in seconds

setEffectiveScheduleTime

public void setEffectiveScheduleTime(int effectiveScheduleTime)

isDistanceAlongBlockSet

public boolean isDistanceAlongBlockSet()
If the trip is non in service (see isInService(), this value with be false.

Returns:

getDistanceAlongBlock

public double getDistanceAlongBlock()
If the trip is not in service (see isInService()), this value will be Double.NaN. See isDistanceAlongBlockSet().

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

setDistanceAlongBlock

public void setDistanceAlongBlock(double distanceAlongBlock)

getLocation

public CoordinatePoint getLocation()
Returns:
the block position

setLocation

public void setLocation(CoordinatePoint location)

isOrientationSet

public boolean isOrientationSet()

getOrientation

public double getOrientation()
In degrees, 0º is East, 90º is North, 180º is West, and 270º is South


setOrientation

public void setOrientation(double orientation)

getClosestStop

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

getNextStop

public BlockStopTimeEntry getNextStop()
The next upcoming stop to the current position of the transit vehicle among the stop times of the current trip.

Returns:
the next stop time entry

setNextStop

public void setNextStop(BlockStopTimeEntry nextStop)

getNextStopTimeOffset

public int getNextStopTimeOffset()
The time offset, in seconds, from the next stop to the current position of the transit vehicle.

Returns:
time, in seconds

setNextStopTimeOffset

public void setNextStopTimeOffset(int nextStopTimeOffset)
See getNextStopTimeOffset()

Parameters:
nextStopTimeOffset -

getPhase

public EVehiclePhase getPhase()

setPhase

public void setPhase(EVehiclePhase phase)

getStatus

public String getStatus()

setStatus

public void setStatus(String status)

isPredicted

public boolean isPredicted()
If real-time data is available in any form (schedule deviation, distanceAlongBlock, last known location) 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 lastUpdateTime)

getLastLocationUpdateTime

public long getLastLocationUpdateTime()
Returns:
the time we last heard a location update from the bus (Unix-time)

setLastLocationUpdateTime

public void setLastLocationUpdateTime(long lastLocationUpdateTime)

isLastKnownDistanceAlongBlockSet

public boolean isLastKnownDistanceAlongBlockSet()

getLastKnownDistanceAlongBlock

public double getLastKnownDistanceAlongBlock()

setLastKnownDistanceAlongBlock

public void setLastKnownDistanceAlongBlock(double lastKnownDistanceAlongBlock)

getLastKnownLocation

public CoordinatePoint getLastKnownLocation()

setLastKnownLocation

public void setLastKnownLocation(CoordinatePoint lastKnownLocation)

isLastKnownOrientationSet

public boolean isLastKnownOrientationSet()

getLastKnownOrientation

public double getLastKnownOrientation()
In degrees, 0º is East, 90º is North, 180º is West, and 270º is South


setLastKnownOrientation

public void setLastKnownOrientation(double lastKnownOrientation)

isScheduleDeviationSet

public boolean isScheduleDeviationSet()
Returns:
true if we have schedule deviation data

getScheduleDeviation

public double getScheduleDeviation()
If no schedule deviation data is available, this value with 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)

areScheduleDeviationsSet

public boolean areScheduleDeviationsSet()

getScheduleDeviations

public ScheduleDeviationSamples getScheduleDeviations()

setScheduleDeviations

public void setScheduleDeviations(ScheduleDeviationSamples scheduleDeviations)

getVehicleId

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

setVehicleId

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

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012 OneBusAway. All Rights Reserved.