Package com.android.dx.util

Examples of com.android.dx.util.BitIntSet


     */
    private void addInterfence(int newReg, int oldReg) {
        newRegInterference.ensureCapacity(newReg + 1);

        while (newReg >= newRegInterference.size()) {
            newRegInterference.add(new BitIntSet(newReg +1));
        }

        oldRegInterference.mergeInterferenceSet(
                oldReg, newRegInterference.get(newReg));
    }
View Full Code Here


import java.util.NoSuchElementException;

public class _BitIntSet extends TestCase {
    public void test_basic() {
        BitIntSet set = new BitIntSet(32);

        assertEquals(0, set.elements());

        set.add(0);
        set.add(1);
        set.add(31);

        assertTrue(set.has(0));
        assertTrue(set.has(1));
        assertTrue(set.has(31));

        assertEquals(3, set.elements());

        assertFalse(set.has(2));
        assertFalse(set.has(7));
        assertFalse(set.has(30));
    }
View Full Code Here

        assertFalse(set.has(7));
        assertFalse(set.has(30));
    }

    public void test_iterator() {
        BitIntSet set = new BitIntSet(32);

        set.add(0);
        set.add(0);
        set.add(1);
        set.add(1);
        set.add(31);
        set.add(31);

        IntIterator iter = set.iterator();

        assertTrue(iter.hasNext());
        assertEquals(iter.next(), 0);
        assertTrue(iter.hasNext());
        assertEquals(iter.next(), 1);
View Full Code Here

            // exception excepted
        }
    }

    public void test_remove() {
        BitIntSet set = new BitIntSet(32);

        set.add(0);
        set.add(1);
        set.add(31);

        assertTrue(set.has(0));
        assertTrue(set.has(1));
        assertTrue(set.has(31));

        assertFalse(set.has(2));
        assertFalse(set.has(7));
        assertFalse(set.has(30));

        set.remove(0);

        assertFalse(set.has(0));

        assertTrue(set.has(1));
        assertTrue(set.has(31));
    }
View Full Code Here

    /**
     * Tests the auto-expansion of the set
     */
    public void test_expand() {
        BitIntSet set = new BitIntSet(32);
        int[] values = {0, 1, 31, 32, 128};

        for (int i = 0; i < values.length; i++) {
            set.add(values[i]);
        }

        IntIterator iter = set.iterator();

        for (int i = 0; i < values.length; i++) {
            assertTrue(iter.hasNext());
            assertEquals(values[i], iter.next());
        }
View Full Code Here

        }
        assertFalse(iter.hasNext());
    }

    public void test_merge() {
        BitIntSet setA = new BitIntSet(32);
        int[] valuesA = {0, 1, 31};

        for (int i = 0; i < valuesA.length; i++) {
            setA.add(valuesA[i]);
        }

        BitIntSet setB = new BitIntSet(32);
        int[] valuesB = {0, 5, 6, 8, 31};

        for (int i = 0; i < valuesB.length; i++) {
            setB.add(valuesB[i]);
        }

        setA.merge(setB);

        for (int i = 0; i < valuesA.length; i++) {
View Full Code Here

            assertTrue(setA.has(valuesB[i]));
        }
    }

    public void test_mergeWithListIntSet() {
        BitIntSet setA = new BitIntSet(32);
        int[] valuesA = {0, 1, 31};

        for (int i = 0; i < valuesA.length; i++) {
            setA.add(valuesA[i]);
        }

        ListIntSet setB = new ListIntSet();
        int[] valuesB = {0, 5, 6, 8, 31};

        for (int i = 0; i < valuesB.length; i++) {
            setB.add(valuesB[i]);
        }

        setA.merge(setB);

        for (int i = 0; i < valuesA.length; i++) {
            assertTrue(setA.has(valuesA[i]));
        }

        for (int i = 0; i < valuesB.length; i++) {
            assertTrue(setA.has(valuesB[i]));
        }
    }
View Full Code Here

            assertTrue(setA.has(valuesB[i]));
        }
    }

    public void test_mergeAndExpand() {
        BitIntSet setA = new BitIntSet(32);
        int[] valuesA = {0, 1, 31};

        for (int i = 0; i < valuesA.length; i++) {
            setA.add(valuesA[i]);
        }

        BitIntSet setB = new BitIntSet(32);
        int[] valuesB = {0, 5, 6, 32, 127};

        for (int i = 0; i < valuesB.length; i++) {
            setB.add(valuesB[i]);
        }

        setA.merge(setB);

        for (int i = 0; i < valuesA.length; i++) {
View Full Code Here

            assertTrue(setA.has(valuesB[i]));
        }
    }

    public void test_toString() {
        BitIntSet set = new BitIntSet(32);

        assertEquals(set.toString(), "{}");

        set.add(1);

        assertEquals(set.toString(), "{1}");

        set.add(2);

        assertEquals(set.toString(), "{1, 2}");
    }
View Full Code Here

        for (int i = 0; i < valuesA.length; i++) {
            setA.add(valuesA[i]);
        }

        BitIntSet setB = new BitIntSet(129);
        int[] valuesB = {0, 5, 6, 32, 127,128};

        for (int i = 0; i < valuesB.length; i++) {
            setB.add(valuesB[i]);
        }

        setA.merge(setB);

        for (int i = 0; i < valuesA.length; i++) {
View Full Code Here

TOP

Related Classes of com.android.dx.util.BitIntSet

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.