diff options
Diffstat (limited to 'sources/events/implementations')
| -rw-r--r-- | sources/events/implementations/MessageReceiveEvent.java | 46 | ||||
| -rw-r--r-- | sources/events/implementations/ProtocolEvent.java | 55 |
2 files changed, 0 insertions, 101 deletions
diff --git a/sources/events/implementations/MessageReceiveEvent.java b/sources/events/implementations/MessageReceiveEvent.java deleted file mode 100644 index d5c1416..0000000 --- a/sources/events/implementations/MessageReceiveEvent.java +++ /dev/null @@ -1,46 +0,0 @@ -package events.implementations; - -import core.VSMessage; -import core.VSProcess; -import events.VSEvent; -import protocols.VSProtocol; - -public class MessageReceiveEvent extends VSEvent { - private VSMessage message; - - public MessageReceiveEvent(VSMessage message) { - this.message = message; - } - - protected void onInit() { - setClassname(getClass().toString()); - } - - public void onStart() { - String eventName = message.getName(); - String protocolClassname = message.getProtocolClassname(); - - process.updateLamportTime(message.getLamportTime()+1); - process.updateVectorTime(message.getVectorTime()); - - Object protocolObj = null; - - if (process.objectExists(protocolClassname)) - protocolObj = process.getObject(protocolClassname); - - StringBuffer buffer = new StringBuffer(); - buffer.append(prefs.getString("lang.message.recv")); - buffer.append("; "); - buffer.append(message);; - - if (protocolObj == null) { - logg(buffer.toString()); - - } else { - final VSProtocol protocol = (VSProtocol) protocolObj; - logg(buffer.toString()); - protocol.onMessageRecv(message); - } - - } -} diff --git a/sources/events/implementations/ProtocolEvent.java b/sources/events/implementations/ProtocolEvent.java deleted file mode 100644 index 6b21d8c..0000000 --- a/sources/events/implementations/ProtocolEvent.java +++ /dev/null @@ -1,55 +0,0 @@ -package events.implementations; - -import core.VSProcess; -import events.*; -import protocols.VSProtocol; - -public class ProtocolEvent extends VSEvent { - private String protocolClassname; - private boolean isClientProtocol; /* true = client, false = server */ - private boolean isProtocolActivation; /* true = activate, false = deactivate */ - - protected void onInit() { - setClassname(getClass().toString()); - } - - public void isClientProtocol(boolean isClientProtocol) { - this.isClientProtocol = isClientProtocol; - } - - public boolean isClientProtocol() { - return isClientProtocol; - } - - public void isProtocolActivation(boolean isProtocolActivation) { - this.isProtocolActivation = isProtocolActivation; - } - - public boolean isProtocolActivation() { - return isProtocolActivation; - } - - public void setProtocolClassname(String protocolClassname) { - this.protocolClassname = protocolClassname; - } - - public void onStart() { - VSProtocol protocol = process.getProtocolObject(protocolClassname); - - if (isClientProtocol) - protocol.isClient(isProtocolActivation); - - else - protocol.isServer(isProtocolActivation); - - StringBuffer buffer = new StringBuffer(); - buffer.append(VSRegisteredEvents.getShortname(protocolClassname)); - buffer.append(" "); - buffer.append(isClientProtocol - ? prefs.getString("lang.client") : prefs.getString("lang.server")); - buffer.append(" "); - buffer.append(isProtocolActivation - ? prefs.getString("lang.activated") : prefs.getString("lang.deactivated")); - logg(buffer.toString()); - } -} |
