/*
* Maze
* Copyright (C) 2000 Paul Davis, pdavis@lpccomp.bc.ca
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/**
* A 3D co-ordinate.
*/
public class Coordinate3D {
int x,y,z;
/**
* Create a new 3D co-ordinate.
* @param x The x co-ordinate.
* @param y The x co-ordinate.
* @param z The x co-ordinate.
*/
public Coordinate3D(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
/**
* Create a new 3D co-ordinate from an existing one.
* @param other The 3D co-ordinate to copy from.
*/
public Coordinate3D(Coordinate3D other) {
this.x = other.x;
this.y = other.y;
this.z = other.z;
}
/**
* Get a String representation of the co-ordinate.
* @return A String of the form Coordinate3D[x,y,z].
*/
public String toString() {
StringBuffer s = new StringBuffer();
s.append("Coordinate3D[");
s.append(x);
s.append(',');
s.append(y);
s.append(',');
s.append(z);
s.append(']');
return s.toString();
}
/**
* Test equality with another 3D co-ordinate.
* @param other The 3D co-ordinate to compare to.
* @return True if they are the same co-ordinates.
*/
public boolean equals(Object other) {
if ( ! (other instanceof Coordinate3D) )
return false;
Coordinate3D c = (Coordinate3D)other;
if ( x == c.x && y == c.y && z == c.z )
return true;
return false;
}
}