Package com.sun.sgs.impl.service.nodemap.affinity

Examples of com.sun.sgs.impl.service.nodemap.affinity.AffinitySet


        Collection<AffinityGroup> group1 = new HashSet<AffinityGroup>();
        HashSet<Identity> identitySet = new HashSet<Identity>();
        identitySet.add(new DummyIdentity("1"));
        identitySet.add(new DummyIdentity("2"));
        identitySet.add(new DummyIdentity("3"));
        AffinitySet a = new AffinitySet(1, gen, identitySet);
        group1.add(a);
        identitySet = new HashSet<Identity>();
        identitySet.add(new DummyIdentity("4"));
        identitySet.add(new DummyIdentity("5"));
        AffinitySet b = new AffinitySet(2, gen, identitySet);
        group1.add(b);

        double modularity =
            AffinityGroupGoodness.calcModularity(builder.getAffinityGraph(),
                                                 group1);
        Assert.assertEquals(0.22, modularity, .001);

        Collection<AffinityGroup> group2 = new HashSet<AffinityGroup>();
        identitySet = new HashSet<Identity>();
        identitySet.add(new DummyIdentity("1"));
        identitySet.add(new DummyIdentity("3"));
        a = new AffinitySet(3, gen, identitySet);
        group2.add(a);
        identitySet = new HashSet<Identity>();
        identitySet.add(new DummyIdentity("2"));
        identitySet.add(new DummyIdentity("4"));
        identitySet.add(new DummyIdentity("5"));
        b = new AffinitySet(4, gen, identitySet);
        group2.add(b);

        modularity =
            AffinityGroupGoodness.calcModularity(builder.getAffinityGraph(),
                                                 group2);
View Full Code Here


        Collection<AffinityGroup> group1 = new HashSet<AffinityGroup>();
        HashSet<Identity> identitySet = new HashSet<Identity>();
        identitySet.add(new DummyIdentity("1"));
        identitySet.add(new DummyIdentity("2"));
        identitySet.add(new DummyIdentity("3"));
        AffinitySet a = new AffinitySet(1, gen, identitySet);
        group1.add(a);
        identitySet = new HashSet<Identity>();
        identitySet.add(new DummyIdentity("4"));
        identitySet.add(new DummyIdentity("5"));
        AffinitySet b = new AffinitySet(2, gen, identitySet);
        group1.add(b);

        double modularity =
            AffinityGroupGoodness.calcModularity(builder.getAffinityGraph(),
                                                 group1);
        Assert.assertEquals(0.22, modularity, .001);

        Collection<AffinityGroup> group2 = new HashSet<AffinityGroup>();
        identitySet = new HashSet<Identity>();
        identitySet.add(new DummyIdentity("1"));
        identitySet.add(new DummyIdentity("3"));
        a = new AffinitySet(3, gen, identitySet);
        group2.add(a);
        identitySet = new HashSet<Identity>();
        identitySet.add(new DummyIdentity("2"));
        identitySet.add(new DummyIdentity("4"));
        identitySet.add(new DummyIdentity("5"));
        b = new AffinitySet(4, gen, identitySet);
       
        group2.add(b);

        modularity =
            AffinityGroupGoodness.calcModularity(builder.getAffinityGraph(),
View Full Code Here

        identitySet.add(new DummyIdentity("14"));
        identitySet.add(new DummyIdentity("17"));
        identitySet.add(new DummyIdentity("18"));
        identitySet.add(new DummyIdentity("20"));
        identitySet.add(new DummyIdentity("22"));
        AffinitySet a = new AffinitySet(1, gen, identitySet);
        groups.add(a);

        identitySet = new HashSet<Identity>();
        identitySet.add(new DummyIdentity("9"));
        identitySet.add(new DummyIdentity("10"));
        identitySet.add(new DummyIdentity("15"));
        identitySet.add(new DummyIdentity("16"));
        identitySet.add(new DummyIdentity("19"));
        identitySet.add(new DummyIdentity("21"));
        identitySet.add(new DummyIdentity("23"));
        identitySet.add(new DummyIdentity("24"));
        identitySet.add(new DummyIdentity("25"));
        identitySet.add(new DummyIdentity("26"));
        identitySet.add(new DummyIdentity("27"));
        identitySet.add(new DummyIdentity("28"));
        identitySet.add(new DummyIdentity("29"));
        identitySet.add(new DummyIdentity("30"));
        identitySet.add(new DummyIdentity("31"));
        identitySet.add(new DummyIdentity("32"));
        identitySet.add(new DummyIdentity("33"));
        identitySet.add(new DummyIdentity("34"));
        AffinitySet b = new AffinitySet(2, gen, identitySet);
        groups.add(b);

        double modularity =
            AffinityGroupGoodness.calcModularity(builder.getAffinityGraph(),
                                                 groups);
View Full Code Here

    @Test
    public void testModularityCalc() {
        final long gen = 1;
        AffinityGraphBuilder builder = new ZachBuilder();
        Collection<AffinityGroup> groups = new HashSet<AffinityGroup>();
        AffinitySet a = new AffinitySet(49, gen, new DummyIdentity("17"));
        groups.add(a);

        HashSet<Identity> identitySet = new HashSet<Identity>();
        identitySet.add(new DummyIdentity("1"));
        identitySet.add(new DummyIdentity("2"));
        identitySet.add(new DummyIdentity("3"));
        identitySet.add(new DummyIdentity("4"));
        identitySet.add(new DummyIdentity("5"));
        identitySet.add(new DummyIdentity("6"));
        identitySet.add(new DummyIdentity("7"));
        identitySet.add(new DummyIdentity("8"));
        identitySet.add(new DummyIdentity("9"));
        identitySet.add(new DummyIdentity("10"));
        identitySet.add(new DummyIdentity("11"));
        identitySet.add(new DummyIdentity("12"));
        identitySet.add(new DummyIdentity("13"));
        identitySet.add(new DummyIdentity("14"));
        identitySet.add(new DummyIdentity("15"));
        identitySet.add(new DummyIdentity("16"));
//        identitySet.add(new DummyIdentity("17"));
        identitySet.add(new DummyIdentity("18"));
        identitySet.add(new DummyIdentity("19"));
        identitySet.add(new DummyIdentity("20"));
        identitySet.add(new DummyIdentity("21"));
        identitySet.add(new DummyIdentity("22"));
        identitySet.add(new DummyIdentity("23"));
        identitySet.add(new DummyIdentity("24"));
        identitySet.add(new DummyIdentity("25"));
        identitySet.add(new DummyIdentity("26"));
        identitySet.add(new DummyIdentity("27"));
        identitySet.add(new DummyIdentity("28"));
        identitySet.add(new DummyIdentity("29"));
        identitySet.add(new DummyIdentity("30"));
        identitySet.add(new DummyIdentity("31"));
        identitySet.add(new DummyIdentity("32"));
        identitySet.add(new DummyIdentity("33"));
        identitySet.add(new DummyIdentity("34"));
        AffinitySet b = new AffinitySet(2, gen, identitySet);
        groups.add(b);

        double modularity =
            AffinityGroupGoodness.calcModularity(builder.getAffinityGraph(),
                                                 groups);
View Full Code Here

        {
            HashSet<Identity> identitySet = new HashSet<Identity>();
            identitySet.add(new DummyIdentity("1"));
            identitySet.add(new DummyIdentity("2"));
            identitySet.add(new DummyIdentity("3"));
            AffinitySet a = new AffinitySet(1, generation, identitySet);
            group1.add(a);
            identitySet = new HashSet<Identity>();
            identitySet.add(new DummyIdentity("4"));
            identitySet.add(new DummyIdentity("5"));
            AffinitySet b = new AffinitySet(2, generation, identitySet);
            group1.add(b);
        }
        Set<AffinityGroup> group2 = new HashSet<AffinityGroup>();
        {
            HashSet<Identity> identitySet = new HashSet<Identity>();
            identitySet.add(new DummyIdentity("6"));
            identitySet.add(new DummyIdentity("7"));
            AffinitySet a = new AffinitySet(1, generation, identitySet);
            group2.add(a);
            identitySet = new HashSet<Identity>();
            identitySet.add(new DummyIdentity("8"));
            identitySet.add(new DummyIdentity("9"));
            AffinitySet b = new AffinitySet(3, generation, identitySet);
           
            group2.add(b);
        }
        Set<AffinityGroup> group3 = new HashSet<AffinityGroup>();
        {
            HashSet<Identity> identitySet = new HashSet<Identity>();
            identitySet.add(new DummyIdentity("10"));
            identitySet.add(new DummyIdentity("11"));
            AffinitySet a = new AffinitySet(4, generation, identitySet);
            group3.add(a);
        }

        HashSet<TestLPAClient> clients = new HashSet<TestLPAClient>();
        TestLPAClient client1 = new TestLPAClient(server, 10, 10, 3, group1);
View Full Code Here

TOP

Related Classes of com.sun.sgs.impl.service.nodemap.affinity.AffinitySet

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.