Examples of FixedSizeBitSet


Examples of org.jgroups.util.FixedSizeBitSet

        index=set.nextSetBit(63);
        assert index == 63 : "expected 63 but got " + index;
    }

    public static void testNextSetBit2() {
        FixedSizeBitSet set=new FixedSizeBitSet(64);
        set.set(0);
        int index=set.nextSetBit(0);
        assert index == 0 : "expected 0 but got " + index;
    }
View Full Code Here

Examples of org.jgroups.util.FixedSizeBitSet

    }



    public static void testNextClearBit() {
        FixedSizeBitSet set=new FixedSizeBitSet(64);
        int index=set.nextClearBit(0);
        assert index == 0 : "expected 0 but got " + index;

        set.set(62); set.set(63);
        index=set.nextClearBit(62);
        assert index == -1;
    }
View Full Code Here

Examples of org.jgroups.util.FixedSizeBitSet

    }



    public static void testNextSetAndClearBitOutOfRangeIndex() {
        FixedSizeBitSet set=new FixedSizeBitSet(64);
        for(int num: new int[]{64, 120}) {
            int index=set.nextSetBit(num);
            assert index == -1;
            index=set.nextClearBit(num);
            assert index == -1;
        }
    }
View Full Code Here

Examples of org.jgroups.util.FixedSizeBitSet

        }
    }


    public static void testLargeSet() {
        FixedSizeBitSet set=new FixedSizeBitSet(1500);
        Set<Integer> sorted_set=new TreeSet<Integer>();
        for(int i=0; i < 500; i++) {
            int num=(int)Util.random(1499);
            sorted_set.add(num);
        }

        for(int num: sorted_set)
            set.set(num);

        int num_set=sorted_set.size();
        System.out.println("set " + num_set + " bits");
        assert set.cardinality() == num_set;
    }
View Full Code Here

Examples of org.jgroups.util.FixedSizeBitSet

        assert set.cardinality() == 0;
        assert set.set(4) && set.cardinality() == 1;
    }

    public static void testSetMultiple() {
        FixedSizeBitSet set=new FixedSizeBitSet(10);
        set.set(4, 7);
        assert set.cardinality() == 4;
        assert set.get(4) && set.get(7);
        set.set(8,9);
        assert set.cardinality() == 6;

        set=new FixedSizeBitSet(260);
        set.set(2,5);
        set.set(30,230);
        assert set.cardinality() == 205;
        assert set.get(30) && set.get(230);
        System.out.println("set = " + set);

        set=new FixedSizeBitSet(10);
        set.set(5,5);
        assert set.cardinality() == 1 && set.get(5);
    }
View Full Code Here

Examples of org.jgroups.util.FixedSizeBitSet

        set.set(5,5);
        assert set.cardinality() == 1 && set.get(5);
    }

    public static void testClear() {
        FixedSizeBitSet set=new FixedSizeBitSet(10);
        set.set(0, 9);
        assert set.cardinality() == 10;
        set.clear(0);
        assert set.cardinality() == 9;
        set.clear(9);
        assert set.cardinality() == 8;
        assert !set.get(9);
        set.clear(5); set.clear(6);
        System.out.println("set = " + set);
        assert set.cardinality() == 6;
    }
View Full Code Here

Examples of org.jgroups.util.FixedSizeBitSet

        System.out.println("set = " + set);
        assert set.cardinality() == 6;
    }

    public static void testClearMultiple() {
        FixedSizeBitSet set=new FixedSizeBitSet(10);
        set.set(0, 9);
        assert set.cardinality() == 10;
        set.clear(0, 0);
        assert set.cardinality() == 9;
        set.clear(0,1);
        assert set.cardinality() == 8;
        set.clear(6,9);
        assert set.cardinality() == 4;
    }
View Full Code Here

Examples of org.jgroups.util.FixedSizeBitSet

        set.clear(6,9);
        assert set.cardinality() == 4;
    }

    public static void testClearMultiple2() {
        FixedSizeBitSet set=new FixedSizeBitSet(10);
        set.set(0, 9);
        set.clear(5,8);
        assert set.cardinality() == 6;
    }
View Full Code Here

Examples of org.jgroups.util.FixedSizeBitSet

        set.clear(5,8);
        assert set.cardinality() == 6;
    }

    public static void testClearMultiple3() {
        FixedSizeBitSet set=new FixedSizeBitSet(1000);
        set.set(0, 999);
        assert set.cardinality() == 1000;
        set.clear(100, 900);
        assert set.cardinality() == 199;
    }
View Full Code Here

Examples of org.jgroups.util.FixedSizeBitSet

        assert set.cardinality() == 199;
    }


    public static void testClearMultiple4() {
        FixedSizeBitSet set=new FixedSizeBitSet(1000);
        set.set(0, 999);
        assert set.cardinality() == 1000;
        set.clear(300, 999);
        assert set.cardinality() == 300;
    }
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.