X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FPoint.java;h=e7c77c03c7c782d1f5a167ff92dfc4eb47b3ce8d;hb=refs%2Fheads%2Fbug%2FJAL-3487-splash-JS;hp=af6a6348a904ab49840b258e9bc58d6cd4a40309;hpb=2cc3a62e1ae63428db854af668e963f1b23af553;p=jalview.git diff --git a/src/jalview/datamodel/Point.java b/src/jalview/datamodel/Point.java index af6a634..e7c77c0 100644 --- a/src/jalview/datamodel/Point.java +++ b/src/jalview/datamodel/Point.java @@ -17,4 +17,55 @@ public final class Point y = yVal; z = zVal; } + + /** + * toString for convenience of inspection in debugging or logging + */ + @Override + public String toString() + { + return String.format("[%f, %f, %f]", x, y, z); + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = prime * result + Float.floatToIntBits(x); + result = prime * result + Float.floatToIntBits(y); + result = prime * result + Float.floatToIntBits(z); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (obj == null) + { + return false; + } + if (getClass() != obj.getClass()) + { + return false; + } + Point other = (Point) obj; + if (Float.floatToIntBits(x) != Float.floatToIntBits(other.x)) + { + return false; + } + if (Float.floatToIntBits(y) != Float.floatToIntBits(other.y)) + { + return false; + } + if (Float.floatToIntBits(z) != Float.floatToIntBits(other.z)) + { + return false; + } + return true; + } }