Package com.betfair.platform.virtualheap.updates

Examples of com.betfair.platform.virtualheap.updates.UpdateBlock


    public void apply(HeapListener listener) {
        List<com.betfair.platform.virtualheap.updates.Update> updates = new ArrayList<com.betfair.platform.virtualheap.updates.Update>();
        for (UpdateAction ua : actions) {
            updates.add(ua.getHeapRepresentation());
        }
        listener.applyUpdate(new UpdateBlock(updates));
    }
View Full Code Here


    public void apply(HeapListener listener) {
        List<com.betfair.platform.virtualheap.updates.Update> updates = new ArrayList<com.betfair.platform.virtualheap.updates.Update>();
        for (UpdateAction ua : actions) {
            updates.add(ua.getHeapRepresentation());
        }
        listener.applyUpdate(new UpdateBlock(updates));
    }
View Full Code Here

    public void setNull() {
        Heap h = new MutableHeap("");
        h.beginUpdate();
        ScalarProjection<Integer> scalar = ProjectorFactory.intProjector.project(h.ensureRoot(NodeType.SCALAR));
        scalar.set(null);
        UpdateBlock block = h.endUpdate();

        assertEquals(1, block.list().size());
        assertTrue(block.list().get(0) instanceof InstallRoot);
    }
View Full Code Here

        Heap h = new MutableHeap("");
        h.beginUpdate();
        ScalarProjection<Integer> scalar = ProjectorFactory.intProjector.project(h.ensureRoot(NodeType.SCALAR));
        scalar.set(1);
        scalar.set(null);
        UpdateBlock block = h.endUpdate();

        assertEquals(3, block.list().size());
        assertTrue(block.list().get(0) instanceof InstallRoot);
        assertTrue(block.list().get(1) instanceof SetScalar);
        assertEquals(1, ((SetScalar) block.list().get(1)).getValue());
        assertTrue(block.list().get(2) instanceof SetScalar);
        assertEquals(null, ((SetScalar) block.list().get(2)).getValue());
    }
View Full Code Here

        Heap h = new MutableHeap("");
        h.beginUpdate();
        ScalarProjection<Integer> scalar = ProjectorFactory.intProjector.project(h.ensureRoot(NodeType.SCALAR));
        scalar.set(1);
        scalar.set(2);
        UpdateBlock block = h.endUpdate();

        assertEquals(3, block.list().size());
        assertTrue(block.list().get(0) instanceof InstallRoot);
        assertTrue(block.list().get(1) instanceof SetScalar);
        assertEquals(1, ((SetScalar) block.list().get(1)).getValue());
        assertTrue(block.list().get(2) instanceof SetScalar);
        assertEquals(2, ((SetScalar) block.list().get(2)).getValue());
    }
View Full Code Here

        // Diverge them
        to.randomUpdate(100);
        from.randomUpdate(100);

        // generate the diff
        UpdateBlock diff = HeapDiff.getHeapDiffFrom(from).to(to);

        // apply the diff
        from.update(diff);

        // test that the diff was accurate
View Full Code Here

        // given
        Heap to = new MutableHeap(null);
        Heap from = new MutableHeap(null);

        // when
        UpdateBlock block = HeapDiff.getHeapDiffFrom(from).to(to);

        // then
        assertTrue(block.list().isEmpty());
    }
View Full Code Here

        // Get two identical heaps
        RandomHeapBuilder to = new RandomHeapBuilder(1000);
        RandomHeapBuilder from = new RandomHeapBuilder(to.getAllUpdates());

        // when
        UpdateBlock block = HeapDiff.getHeapDiffFrom(from).to(to);

        // then
        assertTrue(block.list().isEmpty());
    }
View Full Code Here

        // given
        Heap to = new RandomHeapBuilder(1000);
        Heap from = new MutableHeap(null);

        // when
        UpdateBlock block = HeapDiff.getHeapDiffFrom(from).to(to);
        Heap result = new HeapBuilder(block);

        // then
        assertEquals(to, result);
    }
View Full Code Here

            System.out.println("Unconflated:");
            System.out.println(randomHeapBuilder.getAllUpdates());
            System.out.println();
        }

        UpdateBlock conflatedDeltas = conflater.conflate(randomHeapBuilder.getAllUpdates());

        if (print) {
            System.out.println("Conflated:");
            System.out.println(conflatedDeltas);
        }
View Full Code Here

TOP

Related Classes of com.betfair.platform.virtualheap.updates.UpdateBlock

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.