Package ptolemy.backtrack.util.java.util

Examples of ptolemy.backtrack.util.java.util.Map


     @param args
     */
    public static void main(String[] args) throws Exception {
        String className = args[0];
        Class mapClass = MapTest1.class.getClassLoader().loadClass(className);
        Map map = (Map) mapClass.newInstance();
        int iteration = 20;

        // Test clear() function.
        for (int i = 0; i < iteration; i++) {
            map.put(new Integer(i), new Integer(iteration - i));
        }

        long handle1 = map.$GET$CHECKPOINT().createCheckpoint();
        map.clear();
        map.$GET$CHECKPOINT().rollback(handle1, true);
        System.out.println(map);

        // Test keySet() and clear() of the key set.
        for (int i = 0; i < iteration; i++) {
            map.put(new Integer(i), new Integer(iteration - i));
        }

        long handle2 = map.$GET$CHECKPOINT().createCheckpoint();
        map.keySet().clear();
        map.$GET$CHECKPOINT().rollback(handle2, true);
        System.out.println(map);

        // Test entrySet() and clear() of the entry set.
        for (int i = 0; i < iteration; i++) {
            map.put(new Integer(i), new Integer(iteration - i));
        }

        long handle3 = map.$GET$CHECKPOINT().createCheckpoint();
        map.entrySet().clear();
        map.$GET$CHECKPOINT().rollback(handle2, true);
        System.out.println(map);

        // Test removal with iterator().
        for (int i = 0; i < iteration; i++) {
            map.put(new Integer(i), new Integer(iteration - i));
        }

        long handle4 = map.$GET$CHECKPOINT().createCheckpoint();
        Iterator iterator = map.keySet().iterator();

        while (iterator.hasNext()) {
            iterator.next();
            iterator.remove();
        }

        map.$GET$CHECKPOINT().rollback(handle2, true);
        System.out.println(map);
    }
View Full Code Here


     @param args
     */
    public static void main(String[] args) throws Exception {
        String className = args[0];
        Class mapClass = MapTest1.class.getClassLoader().loadClass(className);
        Map map = (Map) mapClass.newInstance();
        int iteration = 20;
        long[] handles = new long[iteration];

        for (int i = 0; i < iteration; i++) {
            handles[i] = map.$GET$CHECKPOINT().createCheckpoint();
            map.put(new Integer(i), new Integer(iteration - i));
        }

        System.out.println(map);

        for (int i = iteration - 1; i >= 0; i--) {
            map.$GET$CHECKPOINT().rollback(handles[i], true);
            System.out.println(map);
        }
    }
View Full Code Here

     @param args
     */
    public static void main(String[] args) throws Exception {
        String className = args[0];
        Class mapClass = MapTest1.class.getClassLoader().loadClass(className);
        Map map = (Map) mapClass.newInstance();
        int iteration = 20;
        long[] handles = new long[iteration];

        for (int i = 0; i < iteration; i++) {
            map.put(new Integer(i), new Integer(iteration - i));
        }

        for (int i = 0; i < iteration; i++) {
            handles[i] = map.$GET$CHECKPOINT().createCheckpoint();
            map.remove(new Integer(i));
        }

        System.out.println(map);

        for (int i = iteration - 1; i >= 0; i--) {
            map.$GET$CHECKPOINT().rollback(handles[i], true);
            System.out.println(map);
        }
    }
View Full Code Here

TOP

Related Classes of ptolemy.backtrack.util.java.util.Map

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.