diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/members/Client.java b/Workspace/core/src/main/java/com/pqt/core/entities/members/Client.java index 0d667489..980d0be3 100644 --- a/Workspace/core/src/main/java/com/pqt/core/entities/members/Client.java +++ b/Workspace/core/src/main/java/com/pqt/core/entities/members/Client.java @@ -1,6 +1,5 @@ package com.pqt.core.entities.members; -import java.io.Serializable; import java.util.Date; /** @@ -9,22 +8,14 @@ import java.util.Date; public class Client extends PqtMember{ private String address; - private Date lastUpdate; public Client() { super(-1, PqtMemberType.CLIENT); } - public Client(int id, String address) { + public Client(long id, String address) { super(id, PqtMemberType.CLIENT); this.address = address; - this.lastUpdate = new Date(); - } - - public Client(int id, String address, Date lastUpdate) { - super(id, PqtMemberType.CLIENT); - this.address = address; - this.lastUpdate = lastUpdate; } public String getAddress() { @@ -35,11 +26,18 @@ public class Client extends PqtMember{ this.address = address; } - public Date getLastUpdate() { - return lastUpdate; + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Client client = (Client) o; + + return address.equals(client.address) && id==client.id && type.equals(client.type); } - public void setLastUpdate(Date lastUpdate) { - this.lastUpdate = lastUpdate; + @Override + public int hashCode() { + return address.hashCode() + type.hashCode() + Integer.class.cast(id); } } diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/members/DataServer.java b/Workspace/core/src/main/java/com/pqt/core/entities/members/DataServer.java index 9804f487..ffa4dfda 100644 --- a/Workspace/core/src/main/java/com/pqt/core/entities/members/DataServer.java +++ b/Workspace/core/src/main/java/com/pqt/core/entities/members/DataServer.java @@ -1,12 +1,10 @@ package com.pqt.core.entities.members; -import java.io.Serializable; import java.util.Date; public class DataServer extends PqtMember{ private String address; - private Date lastUpdate; public DataServer() { super(-1, PqtMemberType.DATA_SERVER); @@ -15,15 +13,8 @@ public class DataServer extends PqtMember{ public DataServer(long id, String address) { super(id, PqtMemberType.DATA_SERVER); this.address = address; - this.lastUpdate = new Date(); } - public DataServer(long id, String address, Date lastUpdate) { - super(id, PqtMemberType.DATA_SERVER); - this.address = address; - this.lastUpdate = lastUpdate; - } - public String getAddress() { return address; } @@ -32,11 +23,4 @@ public class DataServer extends PqtMember{ this.address = address; } - public Date getLastUpdate() { - return lastUpdate; - } - - public void setLastUpdate(Date lastUpdate) { - this.lastUpdate = lastUpdate; - } } diff --git a/Workspace/core/src/main/java/com/pqt/core/entities/members/PqtMember.java b/Workspace/core/src/main/java/com/pqt/core/entities/members/PqtMember.java index 94399c6b..cc5cb4a9 100644 --- a/Workspace/core/src/main/java/com/pqt/core/entities/members/PqtMember.java +++ b/Workspace/core/src/main/java/com/pqt/core/entities/members/PqtMember.java @@ -6,8 +6,8 @@ import java.io.Serializable; public class PqtMember implements ILoggable, Serializable { - private long id; - private PqtMemberType type; + protected long id; + protected PqtMemberType type; public PqtMember() { }