Package memory.structure

Examples of memory.structure.BasicIndexedBipartiteSet


            worldPop();
        }
    }

    public final void createSharedBipartiteSet(int size) {
        booleanSet = new BasicIndexedBipartiteSet(this, size);
    }
View Full Code Here



    @Test(groups = "1s")
    public void test1() {
        IEnvironment env = new EnvironmentTrailing();
        BasicIndexedBipartiteSet set = new BasicIndexedBipartiteSet(env, 2);

        int b1 = set.add();
        int b2 = set.add();
        int b3 = set.add();
        int b4 = set.add();

        set.swap(b2);

        Assert.assertTrue(set.bundle(b1));
        Assert.assertFalse(set.bundle(b2));
        Assert.assertTrue(set.bundle(b3));
        Assert.assertTrue(set.bundle(b4));

        env.worldPush();
        set.swap(b3); // b3 is now fixed
        int b5 = set.add();

        Assert.assertTrue(set.bundle(b1));
        Assert.assertFalse(set.bundle(b2));
        Assert.assertFalse(set.bundle(b3));
        Assert.assertTrue(set.bundle(b4));
        Assert.assertTrue(set.bundle(b5));

        env.worldPush();

        set.swap(b1); // b1 is now fixed

        int b6 = set.add();
        set.swap(b6);

        Assert.assertFalse(set.bundle(b1));
        Assert.assertFalse(set.bundle(b2));
        Assert.assertFalse(set.bundle(b3));
        Assert.assertTrue(set.bundle(b4));
        Assert.assertTrue(set.bundle(b5));
        Assert.assertFalse(set.bundle(b6));

        // go back
        env.worldPop();
        Assert.assertTrue(set.bundle(b1));
        Assert.assertFalse(set.bundle(b2));
        Assert.assertFalse(set.bundle(b3));
        Assert.assertTrue(set.bundle(b4));
        Assert.assertTrue(set.bundle(b5));
        Assert.assertTrue(set.bundle(b6));

        env.worldPop();
        Assert.assertTrue(set.bundle(b1));
        Assert.assertFalse(set.bundle(b2));
        Assert.assertTrue(set.bundle(b3));
        Assert.assertTrue(set.bundle(b4));
        Assert.assertTrue(set.bundle(b5));
        Assert.assertTrue(set.bundle(b6));

        env.worldPop();
        Assert.assertTrue(set.bundle(b1));
        Assert.assertFalse(set.bundle(b2));
        Assert.assertTrue(set.bundle(b3));
        Assert.assertTrue(set.bundle(b4));
        Assert.assertTrue(set.bundle(b5));
        Assert.assertTrue(set.bundle(b6));

    }
View Full Code Here

TOP

Related Classes of memory.structure.BasicIndexedBipartiteSet

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.