@Test public void testCopy() { String nb = RegistryNodeBuilders.name(RegistryNodeBuilders.Location.RANDOM, true, 0); String nl = NetworkLatency.NetworkLatencyByDistanceWJitter.class.getSimpleName(); P2PFlood p1 = new P2PFlood(new P2PFlood.P2PFloodParameters(2000, 10, 50, 1, 1, 10, 30, nb, nl)); P2PFlood p2 = p1.copy(); p1.init(); p1.network().runMs(1000); p2.init(); p2.network().runMs(1000); for (P2PFlood.P2PFloodNode n1 : p1.network().allNodes) { P2PFlood.P2PFloodNode n2 = p2.network().getNodeById(n1.nodeId); Assert.assertNotNull(n2); Assert.assertEquals(n1.doneAt, n2.doneAt); Assert.assertEquals(n1.isDown(), n2.isDown()); Assert.assertEquals(n1.getMsgReceived(-1).size(), n2.getMsgReceived(-1).size()); Assert.assertEquals(n1.x, n2.x); Assert.assertEquals(n1.y, n2.y); Assert.assertEquals(n1.peers, n2.peers); } }
@Override public P2PFlood copy() { return new P2PFlood(params); }
P2PFlood implements Protocol { @Override public P2PFlood copy() { return new P2PFlood(params); } }
P2PFlood implements Protocol { @Override public P2PFlood copy() { return new P2PFlood(params); } P2PFlood(P2PFloodParameters params); }
P2PFlood implements Protocol { @Override public P2PFlood copy() { return new P2PFlood(params); } P2PFlood(P2PFloodParameters params); @Override String toString(); @Override P2PFlood copy(); void init(); @Override Network<P2PFloodNode> network(); static void time(); static void main(String... args); }
P2PFlood implements Protocol { @Override public P2PFlood copy() { return new P2PFlood(params); } P2PFlood(P2PFloodParameters params); @Override String toString(); @Override P2PFlood copy(); void init(); @Override Network<P2PFloodNode> network(); static void time(); static void main(String... args);  }