Skip to content
Snippets Groups Projects
Commit 35e9d4e5 authored by Luca Keidel's avatar Luca Keidel
Browse files

Cleaned up Wallet

parent cab5c42c
No related branches found
No related tags found
1 merge request!3Preliminary result of the software
...@@ -16,7 +16,7 @@ import java.util.List; ...@@ -16,7 +16,7 @@ import java.util.List;
public class Main { public class Main {
private static int numberOfWallets = 1; private static int numberOfWallets = 2;
private static ActorSystem cSystem; private static ActorSystem cSystem;
......
...@@ -49,12 +49,12 @@ public class WalletImpl extends AbstractWallet { ...@@ -49,12 +49,12 @@ public class WalletImpl extends AbstractWallet {
@Override @Override
public void onReceive(Object message) { public void onReceive(Object message) {
//log(getSender().path().name() + " invokes " + getSelf().path().name() + " to do " + message.getClass().getSimpleName()); log(getSender().path().name() + " invokes " + getSelf().path().name() + " to do " + message.getClass().getSimpleName());
if (message instanceof ActionInvokeRevive) { if (message instanceof ActionInvokeRevive) {
((ActionInvokeRevive) message).doAction(this); ((ActionInvokeRevive) message).doAction(this);
} }
if (!isActive && !(message instanceof ActionInvokeRevive)) return; if (!isActive && !(message instanceof ActionInvokeRevive)) return;
//System.out.println(message);
if (message instanceof ClientAction) { if (message instanceof ClientAction) {
((ClientAction) message).doAction(this); ((ClientAction) message).doAction(this);
} }
...@@ -67,13 +67,7 @@ public class WalletImpl extends AbstractWallet { ...@@ -67,13 +67,7 @@ public class WalletImpl extends AbstractWallet {
if (gui != null) { if (gui != null) {
gui.setAddress(getAddress()); gui.setAddress(getAddress());
} }
String path = "akka.tcp://Core@127.0.0.1:1234/user/Main";
//System.out.println(getContext().provider().getExternalAddressFor(getSelf().path().address()));
//log("my address should be "+getAddress());
//log(""+preKnownNeighbour);
//knownNeighbors.put(getName(),getSelf());
//System.out.println(knownNeighbors);
if (preKnownNeighbour != null) { if (preKnownNeighbour != null) {
addKnownNeighbor(preKnownNeighbourName, preKnownNeighbour); addKnownNeighbor(preKnownNeighbourName, preKnownNeighbour);
preKnownNeighbour.tell(new ActionJoin(), getSelf()); preKnownNeighbour.tell(new ActionJoin(), getSelf());
...@@ -83,8 +77,6 @@ public class WalletImpl extends AbstractWallet { ...@@ -83,8 +77,6 @@ public class WalletImpl extends AbstractWallet {
preKnownNeighbour.tell(aja, getSelf()); preKnownNeighbour.tell(aja, getSelf());
} }
//setAmount(100);
//remoteSuperVisorActor.tell(new ServerActionJoin(name), getSelf());
} }
@Override @Override
...@@ -159,7 +151,7 @@ public class WalletImpl extends AbstractWallet { ...@@ -159,7 +151,7 @@ public class WalletImpl extends AbstractWallet {
@Override @Override
public boolean addKnownNeighbor(String key, ActorRef value) { public boolean addKnownNeighbor(String key, ActorRef value) {
System.out.println(key + " is newNeighbor of " + name + "?" + !getKnownNeighbors().containsKey(key)); log(key + " is newNeighbor of " + name + "?" + !getKnownNeighbors().containsKey(key));
if (getKnownNeighbors().containsKey(key) || key.equals(name)) { if (getKnownNeighbors().containsKey(key) || key.equals(name)) {
return false; return false;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment