Examples of BlockSequence


Examples of ca.odell.glazedlists.impl.event.BlockSequence

    /**
     * Test if simple changes to the linear blocks work as expected.
     */
    public void testSimpleChanges() {
        BlockSequence listBlocks = new BlockSequence();
        listBlocks.insert(0, 2);
        listBlocks.insert(4, 6);
        listBlocks.delete(8, 10);
        listBlocks.delete(10, 12);
        listBlocks.update(12, 14);
        listBlocks.update(16, 18);

        BlockSequence.Iterator iterator = listBlocks.iterator();
        assertNext(0, ListEvent.INSERT, iterator);
        assertNext(1, ListEvent.INSERT, iterator);
        assertNext(4, ListEvent.INSERT, iterator);
        assertNext(5, ListEvent.INSERT, iterator);
        assertNext(8, ListEvent.DELETE, iterator);
View Full Code Here

Examples of ca.odell.glazedlists.impl.event.BlockSequence

    /**
     * Test if combining changes to the linear blocks work as expected.
     */
    public void testCombiningChanges() {
        BlockSequence listBlocks = new BlockSequence();
        listBlocks.insert(0, 2);
        listBlocks.insert(2, 4);
        listBlocks.delete(4, 6);
        listBlocks.delete(4, 6);
        listBlocks.delete(4, 6);
        listBlocks.update(4, 6);
        listBlocks.update(6, 8);
        listBlocks.delete(8, 10);
        listBlocks.insert(8, 10);
        listBlocks.update(10, 12);

        BlockSequence.Iterator iterator = listBlocks.iterator();
        assertNext(0, ListEvent.INSERT, iterator);
        assertNext(1, ListEvent.INSERT, iterator);
        assertNext(2, ListEvent.INSERT, iterator);
        assertNext(3, ListEvent.INSERT, iterator);
        assertNext(4, ListEvent.DELETE, iterator);
View Full Code Here

Examples of ca.odell.glazedlists.impl.event.BlockSequence

    /**
     * Test if linear blocks returns false appropriately when changes are
     * out of order.
     */
    public void testOutOfOrder() {
        BlockSequence listBlocks;

        listBlocks = new BlockSequence();
        assertTrue(listBlocks.insert(0, 2));
        assertTrue(listBlocks.insert(2, 3));
        assertFalse(listBlocks.insert(2, 3));

        listBlocks = new BlockSequence();
        assertTrue(listBlocks.delete(2, 4));
        assertTrue(listBlocks.delete(2, 3));
        assertFalse(listBlocks.delete(1, 2));

        listBlocks = new BlockSequence();
        assertTrue(listBlocks.update(2, 4));
        assertTrue(listBlocks.update(4, 5));
        assertFalse(listBlocks.update(4, 5));

        listBlocks = new BlockSequence();
        assertTrue(listBlocks.insert(2, 4));
        assertFalse(listBlocks.update(3, 4));

        listBlocks = new BlockSequence();
        assertTrue(listBlocks.insert(2, 4));
        assertFalse(listBlocks.delete(3, 4));

        listBlocks = new BlockSequence();
        assertTrue(listBlocks.update(2, 4));
        assertFalse(listBlocks.delete(3, 4));

        listBlocks = new BlockSequence();
        assertTrue(listBlocks.update(2, 4));
        assertFalse(listBlocks.insert(3, 4));

        listBlocks = new BlockSequence();
        assertTrue(listBlocks.delete(2, 4));
        assertTrue(listBlocks.insert(2, 4));
        listBlocks = new BlockSequence();
        assertTrue(listBlocks.delete(2, 4));
        assertFalse(listBlocks.insert(1, 2));

        listBlocks = new BlockSequence();
        assertTrue(listBlocks.delete(2, 4));
        assertTrue(listBlocks.update(2, 4));
        listBlocks = new BlockSequence();
        assertTrue(listBlocks.delete(2, 4));
        assertFalse(listBlocks.update(1, 2));
    }
View Full Code Here

Examples of ca.odell.glazedlists.impl.event.BlockSequence

    /**
     * Test we can iterate the BlockSequence one block at a time.
     */
    public void testIterateByBlocks() {
        BlockSequence listBlocks = new BlockSequence();
        listBlocks.insert(0, 2);
        listBlocks.insert(2, 4);
        listBlocks.delete(4, 6);
        listBlocks.delete(4, 6);
        listBlocks.delete(4, 6);
        listBlocks.update(4, 6);
        listBlocks.update(6, 8);
        listBlocks.delete(8, 10);
        listBlocks.insert(8, 10);
        listBlocks.update(10, 12);

        BlockSequence.Iterator iterator = listBlocks.iterator();
        assertNextBlock(0, 4, ListEvent.INSERT, iterator);
        assertNextBlock(4, 10, ListEvent.DELETE, iterator);
        assertNextBlock(4, 8, ListEvent.UPDATE, iterator);
        assertNextBlock(8, 10, ListEvent.DELETE, iterator);
        assertNextBlock(8, 10, ListEvent.INSERT, iterator);
View Full Code Here

Examples of info.riemannhypothesis.crypto.tools.BlockSequence

    String path = "/Users/MarkusSchepke/Downloads/video-task.mp4";
    File file = new File(path);

    FileInputStream fileInputStream = new FileInputStream(file);

    BlockSequence blocks = new BlockSequence(1024, fileInputStream, (int) file.length());
    VideoHash videoHash = new VideoHash();

    // System.out.println("Beginning of the file: " +
    // bytes.toHexString().substring(0, 100));
    System.out.println("Hash: " + videoHash.hash(blocks).toHexString());
View Full Code Here

Examples of info.riemannhypothesis.crypto.tools.BlockSequence

    String cipher = "f20bdba6ff29eed7b046d1df9fb7000058b1ffb4210a580f748b4ac714c001bd4a61044426fb515dad3f21f18aa577c0bdf302936266926ff37dbf7035d5eeb4";
    final byte blockLength = 16;
    ByteSequence bytes = ByteSequence.fromHexString(cipher);
    ByteSequence plain = ByteSequence.EMPTY_SEQUENCE;
    BlockSequence blocks = new BlockSequence(blockLength, bytes);

    for (int i = 1; i < blocks.length(); i++) {
      ByteSequence iv = blocks.blockAt(i - 1);
      ByteSequence block = blocks.blockAt(i);
      boolean lastBlock = (i == blocks.length() - 1);
      try {
        ByteSequence plainBlock = decryptBlock(iv, block);
        if (lastBlock) {
          byte paddingLength = plainBlock
              .byteAt(plainBlock.length() - 1);
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.blocks.BlockSequence

  }

  @Override
  public String toString() {

    BlockSequence first = _sequences.get(0);
    BlockConfigurationEntry blockConfig = first.getBlockConfig();
    BlockEntry block = blockConfig.getBlock();
    List<BlockStopTimeEntry> bsts = first.getStopTimes();
    BlockStopTimeEntry firstBst = bsts.get(0);
    BlockStopTimeEntry lastBst = bsts.get(bsts.size() - 1);
    StopEntry fromStop = firstBst.getStopTime().getStop();
    StopEntry toStop = lastBst.getStopTime().getStop();
    return "BlockSequenceIndex [ex: block=" + block.getId() + " fromStop="
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.blocks.BlockSequence

      BlockConfigurationEntry... blocks) {

    List<BlockStopTimeEntry> stopTimes = blocks[0].getStopTimes();
    List<BlockSequence> sequences = new ArrayList<BlockSequence>();
    for (BlockConfigurationEntry blockConfig : blocks) {
      BlockSequence sequence = new BlockSequence(blockConfig, 0,
          stopTimes.size());
      sequences.add(sequence);
    }

    return _factory.createSequenceIndexForGroupOfBlockSequences(sequences);
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.blocks.BlockSequence

  }

  @Override
  public int getArrivalTimeForIndex(int index) {
    List<BlockSequence> sequences = _index.getSequences();
    BlockSequence sequence = sequences.get(index);
    return sequence.getArrivalTimeForIndex(_offset);
  }
View Full Code Here

Examples of org.onebusaway.transit_data_federation.impl.blocks.BlockSequence

  }

  @Override
  public int getDepartureTimeForIndex(int index) {
    List<BlockSequence> sequences = _index.getSequences();
    BlockSequence sequence = sequences.get(index);
    return sequence.getDepartureTimeForIndex(_offset);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.