@Test public void testInit() { Assert.assertEquals(6, n0.levels.size()); Assert.assertEquals(0, n0.levels.get(0).peers.size()); Assert.assertEquals(1, n0.levels.get(1).peers.size()); Assert.assertEquals(2, n0.levels.get(2).peers.size()); Assert.assertEquals(4, n0.levels.get(3).peers.size()); Assert.assertEquals(8, n0.levels.get(4).peers.size()); Assert.assertEquals(16, n0.levels.get(5).peers.size()); Assert.assertEquals(1, n0.levels.get(1).peers.get(0).nodeId); Assert.assertEquals(1, n0.levels.get(0).verifiedSignatures.cardinality()); Assert.assertEquals(0, n0.levels.get(1).verifiedSignatures.cardinality()); Assert.assertEquals(0, n0.levels.get(2).verifiedSignatures.cardinality()); Assert.assertEquals(0, n0.levels.get(3).verifiedSignatures.cardinality()); Assert.assertEquals(0, n0.levels.get(4).verifiedSignatures.cardinality()); Assert.assertEquals(0, n0.levels.get(5).verifiedSignatures.cardinality()); }
public void init() { for (int i = 0; i < params.nodeCount; i++) { final GSFNode n = new GSFNode(); network.addNode(n); } for (int setDown = 0; setDown < params.nodesDown; ) { int down = network.rd.nextInt(params.nodeCount); Node n = network.allNodes.get(down); if (!n.isDown() && down != 1) { n.stop(); setDown++; } } for (GSFNode n : network.allNodes) { if (!n.isDown()) { n.initLevel(); network.registerPeriodicTask(n::doCycle, 1, params.periodDurationMs, n); network.registerConditionalTask( n::checkSigs, 1, n.nodePairingTime, n, () -> !n.toVerify.isEmpty(), () -> !n.done); } } }
GSFSignature implements Protocol { public void init() { for (int i = 0; i < params.nodeCount; i++) { final GSFNode n = new GSFNode(); network.addNode(n); } for (int setDown = 0; setDown < params.nodesDown; ) { int down = network.rd.nextInt(params.nodeCount); Node n = network.allNodes.get(down); if (!n.isDown() && down != 1) { n.stop(); setDown++; } } for (GSFNode n : network.allNodes) { if (!n.isDown()) { n.initLevel(); network.registerPeriodicTask(n::doCycle, 1, params.periodDurationMs, n); network.registerConditionalTask( n::checkSigs, 1, n.nodePairingTime, n, () -> !n.toVerify.isEmpty(), () -> !n.done); } } } }
GSFSignature implements Protocol { public void init() { for (int i = 0; i < params.nodeCount; i++) { final GSFNode n = new GSFNode(); network.addNode(n); } for (int setDown = 0; setDown < params.nodesDown; ) { int down = network.rd.nextInt(params.nodeCount); Node n = network.allNodes.get(down); if (!n.isDown() && down != 1) { n.stop(); setDown++; } } for (GSFNode n : network.allNodes) { if (!n.isDown()) { n.initLevel(); network.registerPeriodicTask(n::doCycle, 1, params.periodDurationMs, n); network.registerConditionalTask( n::checkSigs, 1, n.nodePairingTime, n, () -> !n.toVerify.isEmpty(), () -> !n.done); } } } GSFSignature(GSFSignatureParameters params); }
GSFSignature implements Protocol { public void init() { for (int i = 0; i < params.nodeCount; i++) { final GSFNode n = new GSFNode(); network.addNode(n); } for (int setDown = 0; setDown < params.nodesDown; ) { int down = network.rd.nextInt(params.nodeCount); Node n = network.allNodes.get(down); if (!n.isDown() && down != 1) { n.stop(); setDown++; } } for (GSFNode n : network.allNodes) { if (!n.isDown()) { n.initLevel(); network.registerPeriodicTask(n::doCycle, 1, params.periodDurationMs, n); network.registerConditionalTask( n::checkSigs, 1, n.nodePairingTime, n, () -> !n.toVerify.isEmpty(), () -> !n.done); } } } GSFSignature(GSFSignatureParameters params); @Override String toString(); @Override GSFSignature copy(); void init(); @Override Network<GSFNode> network(); static void drawImgs(); static void sigsPerTime(); static void main(String... args); }
GSFSignature implements Protocol { public void init() { for (int i = 0; i < params.nodeCount; i++) { final GSFNode n = new GSFNode(); network.addNode(n); } for (int setDown = 0; setDown < params.nodesDown; ) { int down = network.rd.nextInt(params.nodeCount); Node n = network.allNodes.get(down); if (!n.isDown() && down != 1) { n.stop(); setDown++; } } for (GSFNode n : network.allNodes) { if (!n.isDown()) { n.initLevel(); network.registerPeriodicTask(n::doCycle, 1, params.periodDurationMs, n); network.registerConditionalTask( n::checkSigs, 1, n.nodePairingTime, n, () -> !n.toVerify.isEmpty(), () -> !n.done); } } } GSFSignature(GSFSignatureParameters params); @Override String toString(); @Override GSFSignature copy(); void init(); @Override Network<GSFNode> network(); static void drawImgs(); static void sigsPerTime(); static void main(String... args);  }