@@ -0,0 +1,2437 @@
+package pl.edu.elka.models;%0A%0Aimport pl.edu.elka.raj.Main;%0A%0Aimport java.util.Date;%0Aimport java.util.StringTokenizer;%0A%0A/**%0A * Created by carol on 15/04/2016.%0A */%0Apublic class Message implements Comparable%3CMessage%3E %7B%0A%0A    public int compareTo(Message o) %7B%0A        if(o.getTimestamp().after(timestamp))%7B%0A            return -1;%0A        %7Delse if(o.getTimestamp().before(timestamp))%7B%0A            return 1;%0A        %7Delse%7B%0A            return 0;%0A        %7D%0A    %7D%0A%0A    public enum Type%7BREQUEST, REPLY, HANDSHAKE, ACKHANDSHAKE, ELECTION, ANSWER, COORDINATOR, WANTED, ACCEPT%7D;%0A    private Type type;%0A    private Date timestamp;%0A    private String from;%0A    private String to;%0A    private String info;%0A    private int ttl;%0A%0A    @Override%0A    public String toString() %7B%0A        return %22Type: %22 +type.toString() +%22. Timestamp: %22+timestamp.toString() +%22. To: %22+to+%22. From: %22+from;%0A    %7D%0A%0A    public int getTtl() %7B%0A        return ttl;%0A    %7D%0A%0A    public void setTtl(int ttl) %7B%0A        this.ttl = ttl;%0A    %7D%0A%0A    @Override%0A    public int hashCode() %7B%0A        int result = type.hashCode();%0A        result = 31 * result + timestamp.hashCode();%0A        result = 31 * result + from.hashCode();%0A        result = 31 * result + (to != null ? to.hashCode() : 0);%0A        return result;%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object o) %7B%0A        Message another = (Message)o;%0A        return o != null && to.equals(another.getTo()) && from.equals(another.getFrom()) && timestamp.equals(another.getTimestamp()) && type == another.getType();%0A    %7D%0A%0A    public Message(Type type, String from, String to, String info)%7B%0A        this.type = type;%0A        this.from = from;%0A        this.to = to;%0A        this.info = info;%0A        this.timestamp = new Date();%0A        this.ttl = Main.nodes.length;%0A%0A    %7D%0A%0A    public String getFrom() %7B%0A        return from;%0A    %7D%0A%0A    public void setFrom(String from) %7B%0A        this.from = from;%0A    %7D%0A%0A    public Date getTimestamp() %7B%0A        return timestamp;%0A    %7D%0A%0A    public void setTimestamp(Date timestamp) %7B%0A        this.timestamp = timestamp;%0A    %7D%0A%0A    public String getTo() %7B%0A        return to;%0A    %7D%0A%0A    public void setTo(String to) %7B%0A        this.to = to;%0A    %7D%0A%0A    public Type getType() %7B%0A        return type;%0A    %7D%0A%0A    public void setType(Type type) %7B%0A        this.type = type;%0A    %7D%0A%0A    public String getInfo() %7B%0A        return info;%0A    %7D%0A%0A    public void setInfo(String info) %7B%0A        this.info = info;%0A    %7D%0A%0A%7D%0A

Create Messages.java