Commented-out random-neighbour-picking code
This commit is contained in:
parent
c2c80215d4
commit
4d922e3049
|
@ -1,6 +1,7 @@
|
||||||
package org.syndicate_lang.actors.example.example2;
|
package org.syndicate_lang.actors.example.example2;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
// import java.util.Random;
|
||||||
|
|
||||||
public class Forwarder implements IForwarder {
|
public class Forwarder implements IForwarder {
|
||||||
private final int _index;
|
private final int _index;
|
||||||
|
@ -8,6 +9,7 @@ public class Forwarder implements IForwarder {
|
||||||
private final IForwarder _main;
|
private final IForwarder _main;
|
||||||
private final int _nActors;
|
private final int _nActors;
|
||||||
private final int _nRounds;
|
private final int _nRounds;
|
||||||
|
// private final Random _random;
|
||||||
|
|
||||||
public Forwarder(int index, List<IForwarder> actors, IForwarder main, int nActors, int nRounds) {
|
public Forwarder(int index, List<IForwarder> actors, IForwarder main, int nActors, int nRounds) {
|
||||||
this._index = index;
|
this._index = index;
|
||||||
|
@ -15,11 +17,13 @@ public class Forwarder implements IForwarder {
|
||||||
this._main = main;
|
this._main = main;
|
||||||
this._nActors = nActors;
|
this._nActors = nActors;
|
||||||
this._nRounds = nRounds;
|
this._nRounds = nRounds;
|
||||||
|
// this._random = new Random();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(int hopCount) {
|
public void handleMessage(int hopCount) {
|
||||||
int index = (this._index + 1) % this._nActors;
|
int index = (this._index + 1) % this._nActors;
|
||||||
|
// int index = _random.nextInt(this._nActors);
|
||||||
IForwarder target = hopCount >= this._nRounds - 1 ? _main : this._actors.get(index);
|
IForwarder target = hopCount >= this._nRounds - 1 ? _main : this._actors.get(index);
|
||||||
target.handleMessage(hopCount + 1);
|
target.handleMessage(hopCount + 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue