Browse Source

Commented-out random-neighbour-picking code

main
Tony Garnock-Jones 11 months ago
parent
commit
4d922e3049
  1. 4
      src/test/java/org/syndicate_lang/actors/example/example2/Forwarder.java

4
src/test/java/org/syndicate_lang/actors/example/example2/Forwarder.java

@ -1,6 +1,7 @@
package org.syndicate_lang.actors.example.example2;
import java.util.List;
// import java.util.Random;
public class Forwarder implements IForwarder {
private final int _index;
@ -8,6 +9,7 @@ public class Forwarder implements IForwarder {
private final IForwarder _main;
private final int _nActors;
private final int _nRounds;
// private final Random _random;
public Forwarder(int index, List<IForwarder> actors, IForwarder main, int nActors, int nRounds) {
this._index = index;
@ -15,11 +17,13 @@ public class Forwarder implements IForwarder {
this._main = main;
this._nActors = nActors;
this._nRounds = nRounds;
// this._random = new Random();
}
@Override
public void handleMessage(int hopCount) {
int index = (this._index + 1) % this._nActors;
// int index = _random.nextInt(this._nActors);
IForwarder target = hopCount >= this._nRounds - 1 ? _main : this._actors.get(index);
target.handleMessage(hopCount + 1);
}

Loading…
Cancel
Save