Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- * @author Tomaz Lavieri
- */
- public class Point3D {
- private final long x;
- private final long y;
- private final long z;
- public Point3D() {
- x = 0;
- y = 0;
- z = 0;
- }
- public Point3D(long x, long y, long z) {
- this.x = x;
- this.y = y;
- this.z = z;
- }
- public long getX() {
- return x;
- }
- public long getY() {
- return y;
- }
- public long getZ() {
- return z;
- }
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final Point3D other = (Point3D) obj;
- if (this.x != other.x) {
- return false;
- }
- if (this.y != other.y) {
- return false;
- }
- if (this.z != other.z) {
- return false;
- }
- return true;
- }
- @Override
- public int hashCode() {
- int hash = 5;
- hash = -7 * hash + (int)this.x;
- hash = 2 * hash + (int)this.y;
- hash = 3 * hash + (int)this.z;
- return hash;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment