Package org.onebusaway.transit_data_federation.services.blocks

Examples of org.onebusaway.transit_data_federation.services.blocks.ScheduledBlockLocation


  }

  @Test
  public void test01() {

    ScheduledBlockLocation position = _service.getScheduledBlockLocationFromScheduledTime(
        _blockConfig, time(10, 00));

    assertEquals(_tripA, position.getActiveTrip());
    assertEquals(_stopTimeA, position.getClosestStop());
    assertEquals(0, position.getClosestStopTimeOffset());
    assertNull(position.getPreviousStop());
    assertEquals(_stopTimeA, position.getNextStop());
    assertEquals(0, position.getNextStopTimeOffset());
    assertEquals(200.0, position.getDistanceAlongBlock(), 0.0);
    assertEquals(_stopA.getStopLat(), position.getLocation().getLat(), 1e-6);
    assertEquals(_stopA.getStopLon(), position.getLocation().getLon(), 1e-6);
    assertEquals(356.6, position.getOrientation(), 0.1);
    assertEquals(time(10, 00), position.getScheduledTime());
    assertTrue(position.isInService());
    assertEquals(0, position.getStopTimeIndex());

    position = _service.getScheduledBlockLocationFromDistanceAlongBlock(
        _blockConfig, 200.0);

    assertEquals(_tripA, position.getActiveTrip());
    assertEquals(_stopTimeA, position.getClosestStop());
    assertEquals(0, position.getClosestStopTimeOffset());
    assertNull(position.getPreviousStop());
    assertEquals(_stopTimeA, position.getNextStop());
    assertEquals(0, position.getNextStopTimeOffset());
    assertEquals(200.0, position.getDistanceAlongBlock(), 0.0);
    assertEquals(_stopA.getStopLat(), position.getLocation().getLat(), 1e-6);
    assertEquals(_stopA.getStopLon(), position.getLocation().getLon(), 1e-6);
    assertEquals(356.6, position.getOrientation(), 0.1);
    assertEquals(time(10, 00), position.getScheduledTime());
    assertTrue(position.isInService());
    assertEquals(0, position.getStopTimeIndex());
  }
View Full Code Here


  }

  @Test
  public void test02() {

    ScheduledBlockLocation position = _service.getScheduledBlockLocationFromScheduledTime(
        _blockConfig, time(10, 02));

    assertEquals(_tripA, position.getActiveTrip());
    assertEquals(_stopTimeA, position.getClosestStop());
    assertEquals(-120, position.getClosestStopTimeOffset());
    assertEquals(_stopTimeA, position.getPreviousStop());
    assertEquals(_stopTimeB, position.getNextStop());
    assertEquals(480, position.getNextStopTimeOffset());
    assertEquals(320.0, position.getDistanceAlongBlock(), 0.0);
    assertEquals(47.668651, position.getLocation().getLat(), 1e-6);
    assertEquals(-122.385467, position.getLocation().getLon(), 1e-6);
    assertEquals(2.4, position.getOrientation(), 0.1);
    assertEquals(time(10, 02), position.getScheduledTime());
    assertTrue(position.isInService());
    assertEquals(1, position.getStopTimeIndex());

    position = _service.getScheduledBlockLocationFromDistanceAlongBlock(
        _blockConfig, 320.0);

    assertEquals(_tripA, position.getActiveTrip());
    assertEquals(_stopTimeA, position.getClosestStop());
    assertEquals(-120, position.getClosestStopTimeOffset());
    assertEquals(_stopTimeA, position.getPreviousStop());
    assertEquals(_stopTimeB, position.getNextStop());
    assertEquals(480, position.getNextStopTimeOffset());
    assertEquals(320.0, position.getDistanceAlongBlock(), 0.0);
    assertEquals(47.668651, position.getLocation().getLat(), 1e-6);
    assertEquals(-122.385467, position.getLocation().getLon(), 1e-6);
    assertEquals(2.4, position.getOrientation(), 0.1);
    assertEquals(time(10, 02), position.getScheduledTime());
    assertTrue(position.isInService());
    assertEquals(1, position.getStopTimeIndex());
  }
View Full Code Here

    if( scheduledBlockLocationA.getScheduledTime() == scheduledBlockLocationB.getScheduledTime() )
      return 0;

    boolean inOrder = scheduledBlockLocationA.getScheduledTime() <= scheduledBlockLocationB.getScheduledTime();

    ScheduledBlockLocation from = inOrder ? scheduledBlockLocationA
        : scheduledBlockLocationB;
    ScheduledBlockLocation to = inOrder ? scheduledBlockLocationB
        : scheduledBlockLocationA;

    int delta = to.getScheduledTime() - from.getScheduledTime();

    BlockStopTimeEntry fromStop = from.getNextStop();
    BlockStopTimeEntry toStop = to.getNextStop();

    int slack = toStop.getAccumulatedSlackTime()
        - fromStop.getAccumulatedSlackTime();

    int slackFrom = computeSlackToNextStop(from);
View Full Code Here

  }

  @Test
  public void testHint02() {

    ScheduledBlockLocation position = _service.getScheduledBlockLocationFromScheduledTime(
        _blockConfig, time(10, 12));

    ScheduledBlockLocation next = _service.getScheduledBlockLocationFromScheduledTime(
        position, time(10, 12));
    assertEquals(time(10, 12), next.getScheduledTime());
    assertEquals(800, next.getDistanceAlongBlock(), 0.0);
    assertEquals(1, next.getStopTimeIndex());

    next = _service.getScheduledBlockLocationFromScheduledTime(position,
        time(10, 17));
    assertEquals(time(10, 17), next.getScheduledTime());
    assertEquals(960, next.getDistanceAlongBlock(), 0.0);
    assertEquals(2, next.getStopTimeIndex());

  }
View Full Code Here

  }

  @Test
  public void test00() {

    ScheduledBlockLocation a = new ScheduledBlockLocation();
    a.setScheduledTime(time(10, 05));
    a.setNextStop(_stopTimes.get(1));

    ScheduledBlockLocation b = new ScheduledBlockLocation();
    b.setScheduledTime(time(10, 07));
    b.setNextStop(_stopTimes.get(1));

    int t = ScheduledBlockLocationLibrary.computeTravelTimeBetweenLocations(a,
        b);

    assertEquals(time(0, 2), t);
View Full Code Here

  }

  @Test
  public void test01() {

    ScheduledBlockLocation a = new ScheduledBlockLocation();
    a.setScheduledTime(time(10, 05));
    a.setNextStop(_stopTimes.get(1));

    ScheduledBlockLocation b = new ScheduledBlockLocation();
    b.setScheduledTime(time(10, 11));
    b.setNextStop(_stopTimes.get(1));

    int t = ScheduledBlockLocationLibrary.computeTravelTimeBetweenLocations(a,
        b);

    assertEquals(time(0, 5), t);
View Full Code Here

  }

  @Test
  public void test02() {

    ScheduledBlockLocation a = new ScheduledBlockLocation();
    a.setScheduledTime(time(10, 05));
    a.setNextStop(_stopTimes.get(1));

    ScheduledBlockLocation b = new ScheduledBlockLocation();
    b.setScheduledTime(time(10, 17));
    b.setNextStop(_stopTimes.get(2));

    int t = ScheduledBlockLocationLibrary.computeTravelTimeBetweenLocations(a,
        b);

    assertEquals(time(0, 7), t);
View Full Code Here

  }

  @Test
  public void test03() {

    ScheduledBlockLocation a = new ScheduledBlockLocation();
    a.setScheduledTime(time(10, 05));
    a.setNextStop(_stopTimes.get(1));

    ScheduledBlockLocation b = new ScheduledBlockLocation();
    b.setScheduledTime(time(10, 23));
    b.setNextStop(_stopTimes.get(2));

    int t = ScheduledBlockLocationLibrary.computeTravelTimeBetweenLocations(a,
        b);

    assertEquals(time(0, 10), t);
View Full Code Here

  }

  @Test
  public void test04() {

    ScheduledBlockLocation a = new ScheduledBlockLocation();
    a.setScheduledTime(time(10, 11));
    a.setNextStop(_stopTimes.get(1));

    ScheduledBlockLocation b = new ScheduledBlockLocation();
    b.setScheduledTime(time(10, 12));
    b.setNextStop(_stopTimes.get(1));

    int t = ScheduledBlockLocationLibrary.computeTravelTimeBetweenLocations(a,
        b);

    assertEquals(time(0, 0), t);
View Full Code Here

  }

  @Test
  public void test05() {

    ScheduledBlockLocation a = new ScheduledBlockLocation();
    a.setScheduledTime(time(10, 11));
    a.setNextStop(_stopTimes.get(1));

    ScheduledBlockLocation b = new ScheduledBlockLocation();
    b.setScheduledTime(time(10, 17));
    b.setNextStop(_stopTimes.get(2));

    int t = ScheduledBlockLocationLibrary.computeTravelTimeBetweenLocations(a,
        b);

    assertEquals(time(0, 2), t);
View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data_federation.services.blocks.ScheduledBlockLocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.