X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FPoint.java;h=3e57e4cea05cdbb8edd4fd67cf8359d77189d2af;hb=b26fefd329b60deb2025aa28cdbaae30bfb58382;hp=f1de8a1ac722d8471866e8b13204a3ade2fdfe78;hpb=b04c79d1a830aa7ae7b88b2a5ddd07c9216c826f;p=jalview.git diff --git a/src/jalview/datamodel/Point.java b/src/jalview/datamodel/Point.java index f1de8a1..3e57e4c 100644 --- a/src/jalview/datamodel/Point.java +++ b/src/jalview/datamodel/Point.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.datamodel; /** @@ -26,4 +46,46 @@ public final class Point { 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; + } }