Package bak.pcj.list

Examples of bak.pcj.list.IntList


    public IntArrayDequeBenchmark() {
        super(
            new IntListFactory() {
                public IntList create(int[] elements) {
                    IntList s = new IntArrayDeque(elements.length);
                    for (int i = 0; i < elements.length; i++)
                        s.add(elements[i]);
                    return s;
                }
            }
        );
    }
View Full Code Here


    // ---------------------------------------------------------------
    //      List methods
    // ---------------------------------------------------------------

    public String benchmarkAddMiddle(DataSet dataSet) {
        IntList c = (IntList)create(dataSet.get(0));
        int[] l = dataSet.get(0);
        int size = l.length;
        startTimer();
        for (int i = 0; i < SMALL_SIZE; i++) {
            c.add(size/2, l[i % l.length]);
            size++;
        }
        stopTimer();
        return SMALL_SIZE + " calls to add(int,int) at middle of list with " + l.length + " existing elements";
    }
View Full Code Here

        stopTimer();
        return SMALL_SIZE + " calls to add(int,int) at middle of list with " + l.length + " existing elements";
    }

    public String benchmarkAddBeginning(DataSet dataSet) {
        IntList c = (IntList)create(dataSet.get(0));
        int[] l = dataSet.get(0);
        int size = l.length;
        startTimer();
        for (int i = 0; i < SMALL_SIZE; i++) {
            c.add(0, l[i % l.length]);
            size++;
        }
        stopTimer();
        return SMALL_SIZE + " calls to add(int,int) at beginning of list with " + l.length + " existing elements";
    }
View Full Code Here

        stopTimer();
        return SMALL_SIZE + " calls to add(int,int) at beginning of list with " + l.length + " existing elements";
    }

    public String benchmarkRemoveMiddle(DataSet dataSet) {
        IntList c = (IntList)create(dataSet.get(0));
        int[] l = dataSet.get(0);
        int size = l.length;
        startTimer();
        for (int i = 0; i < SMALL_SIZE; i++) {
            if (size == 0) break;
            c.removeElementAt(size/2);
            size--;
        }
        stopTimer();
        return SMALL_SIZE + " calls to removeElementAt(int) at middle of list with " + l.length + " existing elements";
    }
View Full Code Here

        stopTimer();
        return SMALL_SIZE + " calls to removeElementAt(int) at middle of list with " + l.length + " existing elements";
    }

    public String benchmarkRemoveBeginning(DataSet dataSet) {
        IntList c = (IntList)create(dataSet.get(0));
        int[] l = dataSet.get(0);
        int size = l.length;
        startTimer();
        for (int i = 0; i < SMALL_SIZE; i++) {
            if (size == 0) break;
            c.removeElementAt(0);
            size--;
        }
        stopTimer();
        return SMALL_SIZE + " calls to removeElementAt(int) at beginning of list with " + l.length + " existing elements";
    }
View Full Code Here

        stopTimer();
        return SMALL_SIZE + " calls to removeElementAt(int) at beginning of list with " + l.length + " existing elements";
    }

    public String benchmarkRemoveEnd(DataSet dataSet) {
        IntList c = (IntList)create(dataSet.get(0));
        int[] l = dataSet.get(0);
        int size = l.length;
        startTimer();
        for (int i = 0; i < SMALL_SIZE; i++) {
            if (size == 0) break;
            c.removeElementAt(size-1);
            size--;
        }
        stopTimer();
        return SMALL_SIZE + " calls to removeElementAt(int) at end of list with " + l.length + " existing elements";
    }
View Full Code Here

    public IntArrayListBenchmark() {
        super(
            new IntListFactory() {
                public IntList create(int[] elements) {
                    IntList s = new IntArrayList(elements.length);
                    for (int i = 0; i < elements.length; i++)
                        s.add(elements[i]);
                    return s;
                }
            }
        );
    }
View Full Code Here

TOP

Related Classes of bak.pcj.list.IntList

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.