Package org.onebusaway.transit_data_federation.services.blocks

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


    assertEquals(6, allIndices.size());

    List<BlockStopTimeIndex> indices = grep(allIndices, aid("a"),
        serviceIds(lsids("s1"), lsids()));
    assertEquals(1, indices.size());
    BlockStopTimeIndex index = indices.get(0);
    assertEquals(15, index.getStopTimes().size());
    assertEquals(bcA.getStopTimes().get(0), index.getStopTimes().get(0));
    assertEquals(bcB.getStopTimes().get(0), index.getStopTimes().get(1));
    assertEquals(bcA.getStopTimes().get(3), index.getStopTimes().get(2));
    assertEquals(bcF.getStopTimes().get(0), index.getStopTimes().get(3));
    assertEquals(bcC.getStopTimes().get(0), index.getStopTimes().get(4));
    assertEquals(bcA.getStopTimes().get(4), index.getStopTimes().get(5));
    assertEquals(bcE.getStopTimes().get(0), index.getStopTimes().get(6));
    assertEquals(bcB.getStopTimes().get(3), index.getStopTimes().get(7));
    assertEquals(bcC.getStopTimes().get(3), index.getStopTimes().get(8));
    assertEquals(bcB.getStopTimes().get(4), index.getStopTimes().get(9));
    assertEquals(bcC.getStopTimes().get(4), index.getStopTimes().get(10));
    assertEquals(bcF.getStopTimes().get(3), index.getStopTimes().get(11));
    assertEquals(bcF.getStopTimes().get(4), index.getStopTimes().get(12));
    assertEquals(bcE.getStopTimes().get(3), index.getStopTimes().get(13));
    assertEquals(bcE.getStopTimes().get(4), index.getStopTimes().get(14));

    indices = grep(allIndices, aid("a"), serviceIds(lsids("s1", "s2"), lsids()));
    assertEquals(1, indices.size());
    index = indices.get(0);
    assertEquals(3, index.getStopTimes().size());
    assertEquals(bcD.getStopTimes().get(0), index.getStopTimes().get(0));
    assertEquals(bcD.getStopTimes().get(3), index.getStopTimes().get(1));
    assertEquals(bcD.getStopTimes().get(4), index.getStopTimes().get(2));

    indices = grep(allIndices, aid("b"), serviceIds(lsids("s1"), lsids()));
    assertEquals(1, indices.size());
    index = indices.get(0);
    assertEquals(8, index.getStopTimes().size());
    assertEquals(bcA.getStopTimes().get(1), index.getStopTimes().get(0));
    assertEquals(bcB.getStopTimes().get(1), index.getStopTimes().get(1));
    assertEquals(bcC.getStopTimes().get(1), index.getStopTimes().get(2));
    assertEquals(bcA.getStopTimes().get(5), index.getStopTimes().get(3));
    assertEquals(bcF.getStopTimes().get(1), index.getStopTimes().get(4));
    assertEquals(bcE.getStopTimes().get(1), index.getStopTimes().get(5));
    assertEquals(bcC.getStopTimes().get(5), index.getStopTimes().get(6));
    assertEquals(bcB.getStopTimes().get(5), index.getStopTimes().get(7));

    indices = grep(allIndices, aid("b"), serviceIds(lsids("s1", "s2"), lsids()));
    assertEquals(1, indices.size());
    index = indices.get(0);
    assertEquals(2, index.getStopTimes().size());
    assertEquals(bcD.getStopTimes().get(1), index.getStopTimes().get(0));
    assertEquals(bcD.getStopTimes().get(5), index.getStopTimes().get(1));

    indices = grep(allIndices, aid("c"), serviceIds(lsids("s1"), lsids()));
    assertEquals(1, indices.size());
    index = indices.get(0);
    assertEquals(5, index.getStopTimes().size());
    assertEquals(bcA.getStopTimes().get(2), index.getStopTimes().get(0));
    assertEquals(bcB.getStopTimes().get(2), index.getStopTimes().get(1));
    assertEquals(bcC.getStopTimes().get(2), index.getStopTimes().get(2));
    assertEquals(bcF.getStopTimes().get(2), index.getStopTimes().get(3));
    assertEquals(bcE.getStopTimes().get(2), index.getStopTimes().get(4));

    indices = grep(allIndices, aid("c"), serviceIds(lsids("s1", "s2"), lsids()));
    assertEquals(1, indices.size());
    index = indices.get(0);
    assertEquals(1, index.getStopTimes().size());
    assertEquals(bcD.getStopTimes().get(2), index.getStopTimes().get(0));
  }
View Full Code Here


    stopTime.setShapePointIndex(0);

    BlockStopTimeEntry blockStopTime = Mockito.mock(BlockStopTimeEntry.class);
    Mockito.when(blockStopTime.getStopTime()).thenReturn(stopTime);

    BlockStopTimeIndex index = Mockito.mock(BlockStopTimeIndex.class);
    Mockito.when(index.getStopTimes()).thenReturn(Arrays.asList(blockStopTime));

    List<BlockStopTimeIndex> indices = Arrays.asList(index);
    Mockito.when(_blockIndexService.getStopTimeIndicesForStop(stopEntry)).thenReturn(
        indices);
View Full Code Here

    Mockito.when(blockStopTimeA.getStopTime()).thenReturn(stopTimeA);

    BlockStopTimeEntry blockStopTimeB = Mockito.mock(BlockStopTimeEntry.class);
    Mockito.when(blockStopTimeB.getStopTime()).thenReturn(stopTimeB);

    BlockStopTimeIndex index = Mockito.mock(BlockStopTimeIndex.class);
    Mockito.when(index.getStopTimes()).thenReturn(
        Arrays.asList(blockStopTimeA, blockStopTimeB));

    List<BlockStopTimeIndex> indices = Arrays.asList(index);
    Mockito.when(_blockIndexService.getStopTimeIndicesForStop(stopEntry)).thenReturn(
        indices);
View Full Code Here

    for (BlockConfigurationEntry blockConfig : blocks) {
      trips.add(blockConfig.getTrips().get(0));
    }

    BlockTripIndex blockIndex = _factory.createTripIndexForGroupOfBlockTrips(trips);
    BlockStopTimeIndex index = BlockStopTimeIndex.create(blockIndex, 0);
    _stop.addStopTimeIndex(index);

    Mockito.when(_blockIndexService.getStopTimeIndicesForStop(_stop)).thenReturn(
        _stop.getStopTimeIndices());
  }
View Full Code Here

      List<List<BlockStopTimeEntry>> groupedStopTimes = BlockLibrary.createStrictlyOrderedGroups(
          stopTimes, _blockStopTimeLooseComparator,
          _blockStopTimeStrictComparator);

      for (List<BlockStopTimeEntry> group : groupedStopTimes) {
        BlockStopTimeIndex index = createBlockStopTimeIndexForGroup(group);
        allIndices.add(index);
      }
    }

    return allIndices;
View Full Code Here

      stopIndices[i] = blockStopTime.getBlockSequence();
      interval = ServiceInterval.extend(interval, stopTime.getArrivalTime(),
          stopTime.getDepartureTime());
    }

    return new BlockStopTimeIndex(blockConfigs, stopIndices, interval);
  }
View Full Code Here

TOP

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

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.