TSK-646: Added equals and hash methods to TimeInterval
This commit is contained in:
parent
cc675e324b
commit
ff558b3a2a
|
@ -62,4 +62,42 @@ public class TimeInterval {
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((begin == null) ? 0 : begin.hashCode());
|
||||||
|
result = prime * result + ((end == null) ? 0 : end.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
TimeInterval other = (TimeInterval) obj;
|
||||||
|
if (begin == null) {
|
||||||
|
if (other.begin != null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (!begin.equals(other.begin)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (end == null) {
|
||||||
|
if (other.end != null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (!end.equals(other.end)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue