@Test public void testRegisterTask() { AtomicBoolean ab = new AtomicBoolean(); network.registerTask(() -> ab.set(true), 100, n0); network.runMs(99); Assert.assertFalse(ab.get()); network.runMs(1); Assert.assertTrue(ab.get()); Assert.assertEquals(0, network.msgs.size()); }
public void registerTask(final Runnable task, int startAt, TN fromNode) { Task<TN> sw = new Task<>(task); msgs.addMsg(new Envelope.SingleDestEnvelope<>(sw, fromNode, fromNode, time, startAt)); }
Network { public void registerTask(final Runnable task, int startAt, TN fromNode) { Task<TN> sw = new Task<>(task); msgs.addMsg(new Envelope.SingleDestEnvelope<>(sw, fromNode, fromNode, time, startAt)); } }
Network { public void registerTask(final Runnable task, int startAt, TN fromNode) { Task<TN> sw = new Task<>(task); msgs.addMsg(new Envelope.SingleDestEnvelope<>(sw, fromNode, fromNode, time, startAt)); }  }
Network { public void registerTask(final Runnable task, int startAt, TN fromNode) { Task<TN> sw = new Task<>(task); msgs.addMsg(new Envelope.SingleDestEnvelope<>(sw, fromNode, fromNode, time, startAt)); }  static BitSet chooseBadNodes(Random rd, int nodeCount, int nodesDown); BitSet getDeadNodes(); TN getNodeById(int id); TN getFirstLiveNode(); void printSpeedDistribution(int segmentCt); @SuppressWarnings("UnusedReturnValue") Network<TN> setMsgDiscardTime(int l); void run(int seconds); void runH(int hours); boolean runMs(int ms); void sendAll(Message<? extends TN> m, int sendTime, TN fromNode); void sendAll(Message<? extends TN> m, TN fromNode); void send(Message<? extends TN> m, TN fromNode, List<TN> dests); void send(Message<? extends TN> m, TN fromNode, TN toNode); void send(Message<? extends TN> mc, int sendTime, TN fromNode, TN toNode); void sendArriveAt(Message<? extends TN> mc, int arriveAt, TN fromNode, TN toNode); boolean hasMessage(); void send(Message<? extends TN> m, int sendTime, TN fromNode, List<? extends Node> dests); void send(
      Message<? extends TN> m,
      int sendTime,
      TN fromNode,
      List<? extends Node> dests,
      int delaysBetweenMessage); static int getPseudoRandom(int nodeId, int randomSeed); void registerTask(final Runnable task, int startAt, TN fromNode); void registerPeriodicTask(final Runnable task, int startAt, int period, TN fromNode); void registerPeriodicTask(
      final Runnable task, int startAt, int period, TN fromNode, Condition c); void registerConditionalTask(
      final Runnable task,
      int startAt,
      int duration,
      TN fromNode,
      Condition startIf,
      Condition repeatIf); void addNode(TN node); List<TN> liveNodes(); Network<TN> setNetworkLatency(int[] distribProp, int[] distribVal); Network<TN> setNetworkLatency(NetworkLatency networkLatency); void printNetworkLatency(); void partition(float part); void endPartition(); }
Network { public void registerTask(final Runnable task, int startAt, TN fromNode) { Task<TN> sw = new Task<>(task); msgs.addMsg(new Envelope.SingleDestEnvelope<>(sw, fromNode, fromNode, time, startAt)); }  static BitSet chooseBadNodes(Random rd, int nodeCount, int nodesDown); BitSet getDeadNodes(); TN getNodeById(int id); TN getFirstLiveNode(); void printSpeedDistribution(int segmentCt); @SuppressWarnings("UnusedReturnValue") Network<TN> setMsgDiscardTime(int l); void run(int seconds); void runH(int hours); boolean runMs(int ms); void sendAll(Message<? extends TN> m, int sendTime, TN fromNode); void sendAll(Message<? extends TN> m, TN fromNode); void send(Message<? extends TN> m, TN fromNode, List<TN> dests); void send(Message<? extends TN> m, TN fromNode, TN toNode); void send(Message<? extends TN> mc, int sendTime, TN fromNode, TN toNode); void sendArriveAt(Message<? extends TN> mc, int arriveAt, TN fromNode, TN toNode); boolean hasMessage(); void send(Message<? extends TN> m, int sendTime, TN fromNode, List<? extends Node> dests); void send(
      Message<? extends TN> m,
      int sendTime,
      TN fromNode,
      List<? extends Node> dests,
      int delaysBetweenMessage); static int getPseudoRandom(int nodeId, int randomSeed); void registerTask(final Runnable task, int startAt, TN fromNode); void registerPeriodicTask(final Runnable task, int startAt, int period, TN fromNode); void registerPeriodicTask(
      final Runnable task, int startAt, int period, TN fromNode, Condition c); void registerConditionalTask(
      final Runnable task,
      int startAt,
      int duration,
      TN fromNode,
      Condition startIf,
      Condition repeatIf); void addNode(TN node); List<TN> liveNodes(); Network<TN> setNetworkLatency(int[] distribProp, int[] distribVal); Network<TN> setNetworkLatency(NetworkLatency networkLatency); void printNetworkLatency(); void partition(float part); void endPartition(); final MessageStorage msgs; final List<ConditionalTask<TN>> conditionalTasks; final List<TN> allNodes; final Random rd; public NetworkLatency networkLatency; public int time; }