@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getNamespace() == null) ? 0 : getNamespace().hashCode()); return result; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof VertexRef)) return false; VertexRef ref = (VertexRef)obj; return getNamespace().equals(ref.getNamespace()) && getId().equals(ref.getId()); }
@Override public int compareTo(Ref o) { if (this.equals(o)) { return 0; } else { // Order by namespace, then ID if (this.getNamespace().equals(o.getNamespace())) { if (this.getId().equals(o.getId())) { // Shouldn't happen because equals() should return true throw new IllegalStateException("equals() was inaccurate in " + this.getClass().getName()); } else { return this.getId().compareTo(o.getId()); } } else { return this.getNamespace().compareTo(o.getNamespace()); } } }