m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/messages')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/GossipGirlMessage.java25
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/InitiateGossipMessage.java11
2 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/GossipGirlMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/GossipGirlMessage.java
new file mode 100644
index 0000000..705d64a
--- /dev/null
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/GossipGirlMessage.java
@@ -0,0 +1,25 @@
+package pl.edu.mimuw.cloudatlas.agent.messages;
+
+import pl.edu.mimuw.cloudatlas.agent.modules.Module;
+import pl.edu.mimuw.cloudatlas.agent.modules.ModuleType;
+
+public abstract class GossipGirlMessage extends AgentMessage {
+ public enum Type {
+ INITIATE
+ }
+
+ private Type type;
+
+ public GossipGirlMessage(String messageId, long timestamp, Type type) {
+ super(messageId, ModuleType.GOSSIP, timestamp);
+ this.type = type;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public void callMe(Module module) throws InterruptedException, Module.InvalidMessageType {
+ module.handleTyped(this);
+ }
+}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/InitiateGossipMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/InitiateGossipMessage.java
new file mode 100644
index 0000000..d216d59
--- /dev/null
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/InitiateGossipMessage.java
@@ -0,0 +1,11 @@
+package pl.edu.mimuw.cloudatlas.agent.messages;
+
+import pl.edu.mimuw.cloudatlas.agent.modules.ModuleType;
+
+public class InitiateGossipMessage extends GossipGirlMessage {
+ private long nextGossipId = 0;
+
+ public InitiateGossipMessage(String messageId, long timestamp) {
+ super(messageId, timestamp, Type.INITIATE);
+ }
+}