[Minor] Code cleanup

This commit is contained in:
Robert von Burg 2023-04-04 17:20:57 +02:00
parent 3cce0a7e9a
commit 4aec95eb93
Signed by: eitch
GPG Key ID: 75DB9C85C74331F7
4 changed files with 32 additions and 7 deletions

View File

@ -142,15 +142,10 @@ public abstract class AbstractStrolchElement implements StrolchElement {
@Override
public boolean equals(Object obj) {
if (this == obj) {
if (this == obj)
return true;
}
if (obj == null) {
if (obj == null || getClass() != obj.getClass())
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
AbstractStrolchElement other = (AbstractStrolchElement) obj;
if (this.id == null) {
return other.id == null;

View File

@ -292,6 +292,16 @@ public class Order extends AbstractStrolchRootElement implements StrolchRootElem
return visitor.visitOrder(this);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
Order o = (Order) obj;
return this.type.equals(o.type) && this.id.equals(o.id);
}
@Override
public String toString() {

View File

@ -380,6 +380,16 @@ public class Resource extends AbstractStrolchRootElement implements StrolchRootE
return visitor.visitResource(this);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
Resource r = (Resource) obj;
return this.type.equals(r.type) && this.id.equals(r.id);
}
@Override
public String toString() {

View File

@ -766,6 +766,16 @@ public class Activity extends AbstractStrolchRootElement
return this;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
Activity a = (Activity) obj;
return this.parent == a.parent && this.type.equals(a.type) && this.id.equals(a.id);
}
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();