Examples of SnapTreeMap


Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     * floorKey returns preceding element
     */
    public void testFloorKey() {
        SnapTreeMap q = map5();
        Object e1 = q.floorKey(three);
        assertEquals(three, e1);

        Object e2 = q.floorKey(six);
        assertEquals(five, e2);

        Object e3 = q.floorKey(one);
        assertEquals(one, e3);

        Object e4 = q.floorKey(zero);
        assertNull(e4);
    }
View Full Code Here

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     * ceilingKey returns next element
     */
    public void testCeilingKey() {
        SnapTreeMap q = map5();
        Object e1 = q.ceilingKey(three);
        assertEquals(three, e1);

        Object e2 = q.ceilingKey(zero);
        assertEquals(one, e2);

        Object e3 = q.ceilingKey(five);
        assertEquals(five, e3);

        Object e4 = q.ceilingKey(six);
        assertNull(e4);
    }
View Full Code Here

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     * pollFirstEntry returns entries in order
     */
    public void testPollFirstEntry() {
        SnapTreeMap map = map5();
        Map.Entry e = map.pollFirstEntry();
        assertEquals(one, e.getKey());
        assertEquals("A", e.getValue());
        e = map.pollFirstEntry();
        assertEquals(two, e.getKey());
        map.put(one, "A");
        e = map.pollFirstEntry();
        assertEquals(one, e.getKey());
        assertEquals("A", e.getValue());
        e = map.pollFirstEntry();
        assertEquals(three, e.getKey());
        map.remove(four);
        e = map.pollFirstEntry();
        assertEquals(five, e.getKey());
        try {
            e.setValue("A");
            shouldThrow();
        } catch (UnsupportedOperationException success) {}
        e = map.pollFirstEntry();
        assertNull(e);
    }
View Full Code Here

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     * pollLastEntry returns entries in order
     */
    public void testPollLastEntry() {
        SnapTreeMap map = map5();
        Map.Entry e = map.pollLastEntry();
        assertEquals(five, e.getKey());
        assertEquals("E", e.getValue());
        e = map.pollLastEntry();
        assertEquals(four, e.getKey());
        map.put(five, "E");
        e = map.pollLastEntry();
        assertEquals(five, e.getKey());
        assertEquals("E", e.getValue());
        e = map.pollLastEntry();
        assertEquals(three, e.getKey());
        map.remove(two);
        e = map.pollLastEntry();
        assertEquals(one, e.getKey());
        try {
            e.setValue("E");
            shouldThrow();
        } catch (UnsupportedOperationException success) {}
        e = map.pollLastEntry();
        assertNull(e);
    }
View Full Code Here

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     *   size returns the correct values
     */
    public void testSize() {
        SnapTreeMap map = map5();
        SnapTreeMap empty = new SnapTreeMap();
        assertEquals(0, empty.size());
        assertEquals(5, map.size());
    }
View Full Code Here

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     * toString contains toString of elements
     */
    public void testToString() {
        SnapTreeMap map = map5();
        String s = map.toString();
        for (int i = 1; i <= 5; ++i) {
            assertTrue(s.indexOf(String.valueOf(i)) >= 0);
        }
    }
View Full Code Here

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     * get(null) of nonempty map throws NPE
     */
    public void testGet_NullPointerException() {
        try {
            SnapTreeMap c = map5();
            c.get(null);
            shouldThrow();
        } catch (NullPointerException success) {}
    }
View Full Code Here

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     * containsKey(null) of nonempty map throws NPE
     */
    public void testContainsKey_NullPointerException() {
        try {
            SnapTreeMap c = map5();
            c.containsKey(null);
            shouldThrow();
        } catch (NullPointerException success) {}
    }
View Full Code Here

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     * containsValue(null) throws NPE
     */
    public void testContainsValue_NullPointerException() {
        try {
            SnapTreeMap c = new SnapTreeMap();
            c.containsValue(null);
            shouldThrow();
        } catch (NullPointerException success) {}
    }
View Full Code Here

Examples of edu.stanford.ppl.concurrent.SnapTreeMap

    /**
     * put(null,x) throws NPE
     */
    public void testPut1_NullPointerException() {
        try {
            SnapTreeMap c = map5();
            c.put(null, "whatever");
            shouldThrow();
        } catch (NullPointerException success) {}
    }
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.