Package ca.odell.glazedlists.impl.event

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


    /**
     * 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

    /**
     * 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

    /**
     * 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

TOP

Related Classes of ca.odell.glazedlists.impl.event.BlockSequence

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.