org.onebusaway.transit_data_federation.services.blocks
Class ScheduledBlockLocation

java.lang.Object
  extended by org.onebusaway.transit_data_federation.services.blocks.ScheduledBlockLocation

public class ScheduledBlockLocation
extends Object


Constructor Summary
ScheduledBlockLocation()
           
 
Method Summary
 BlockTripEntry getActiveTrip()
          Should never be null, even if the trip is not in service.
 BlockStopTimeEntry getClosestStop()
           
 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 block.
 double getDistanceAlongBlock()
           
 CoordinatePoint getLocation()
           
 BlockStopTimeEntry getNextStop()
           
 int getNextStopTimeOffset()
           
 double getOrientation()
          In degrees, 0º is East, 90º is North, 180º is West, and 270º is South
 int getScheduledTime()
           
 int getStopTimeIndex()
           
 boolean isInService()
          A scheduled block location can exist but not be considered "in service" in the following cases: 1) The scheduled block location is requested for a scheduled time that is before the official start time of the block.
 void setActiveTrip(BlockTripEntry activeTrip)
           
 void setClosestStop(BlockStopTimeEntry closestStop)
           
 void setClosestStopTimeOffset(int closestStopTimeOffset)
           
 void setDistanceAlongBlock(double distanceAlongBlock)
           
 void setInService(boolean inService)
           
 void setLocation(CoordinatePoint location)
           
 void setNextStop(BlockStopTimeEntry nextStop)
           
 void setNextStopTimeOffset(int nextStopTimeOffset)
           
 void setOrientation(double orientation)
           
 void setScheduledTime(int scheduledTime)
           
 void setStopTimeIndex(int stopTimeIndex)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScheduledBlockLocation

public ScheduledBlockLocation()
Method Detail

getActiveTrip

public BlockTripEntry getActiveTrip()
Should never be null, even if the trip is not in service. In the case of out of service before the start of the block, the active trip will be the first trip of the block. For out of service at the end of the block, it will be the last trip of the block.

Returns:
the currently active trip

setActiveTrip

public void setActiveTrip(BlockTripEntry activeTrip)

getScheduledTime

public int getScheduledTime()
Returns:
the scheduled time of the current trip in seconds

setScheduledTime

public void setScheduledTime(int scheduledTime)

getLocation

public CoordinatePoint getLocation()

setLocation

public void setLocation(CoordinatePoint location)

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)

getDistanceAlongBlock

public double getDistanceAlongBlock()

setDistanceAlongBlock

public void setDistanceAlongBlock(double distanceAlongBlock)

getClosestStop

public BlockStopTimeEntry getClosestStop()

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 block. 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)

getNextStop

public BlockStopTimeEntry getNextStop()

setNextStop

public void setNextStop(BlockStopTimeEntry nextStop)

getNextStopTimeOffset

public int getNextStopTimeOffset()

setNextStopTimeOffset

public void setNextStopTimeOffset(int nextStopTimeOffset)

isInService

public boolean isInService()
A scheduled block location can exist but not be considered "in service" in the following cases: 1) The scheduled block location is requested for a scheduled time that is before the official start time of the block. If the scheduled time is after the end time of the block, then the scheduled block location should not exist. 2) The scheduled block location is requested for a distance along block that is beyond the last stop in the block, but not yet to the end of the block's shape.

Returns:
true if the vehicle is considered "in service" at this scheduled location

setInService

public void setInService(boolean inService)

getStopTimeIndex

public int getStopTimeIndex()
Returns:
the index into the block config's list of stop times that was used to find the scheduled block location

setStopTimeIndex

public void setStopTimeIndex(int stopTimeIndex)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012 OneBusAway. All Rights Reserved.