Skip to content
Snippets Groups Projects
Commit c7c80093 authored by Kim Kern's avatar Kim Kern
Browse files

change randomNeighbors such that it works both with gephi and without

parent 82f306ee
No related tags found
No related merge requests found
...@@ -182,15 +182,19 @@ public abstract class AbstractWallet extends AbstractNode implements Serializabl ...@@ -182,15 +182,19 @@ public abstract class AbstractWallet extends AbstractNode implements Serializabl
overlayNeighbours.add(wallet); overlayNeighbours.add(wallet);
} }
//TODO: ????!??? @Override
/*@Override
public ActorRef getRandomNeighbor() { public ActorRef getRandomNeighbor() {
List<ActorRef> neighbors = new ArrayList<>(overlayNeighbours); List<ActorRef> neighbors;
if (overlayNeighbours != null && !overlayNeighbours.isEmpty()) {
neighbors = new ArrayList<>(overlayNeighbours);
} else {
neighbors = new ArrayList<>(getKnownNeighbors().values());
}
if (getExcludedNeighbors().size() < neighbors.size()) { if (getExcludedNeighbors().size() < neighbors.size()) {
neighbors.removeAll(getExcludedNeighbors()); neighbors.removeAll(getExcludedNeighbors());
} }
Random rand = new Random(); Random rand = new Random();
int index = rand.nextInt(neighbors.size()); int index = rand.nextInt(neighbors.size());
return neighbors.get(index); return neighbors.get(index);
}*/ }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment