@Override
	public int compareTo(ThreeDimCoordinate coord) {
		final int BEFORE = -1;
	    final int EQUAL = 0;
	    final int AFTER = 1;
		
		if (coord == null)
			return AFTER;
		
		if (this.getX() == coord.getX() && this.getY() == coord.getY() && this.getZ() == coord.getZ())
			return EQUAL;
		
		if (this.getZ() == coord.getZ()) {
			if (this.getY() == coord.getY()) {
				return Integer.valueOf(this.getX()).compareTo(Integer.valueOf(coord.getX()));
			}
			else if (this.getY() < coord.getY()) {
				return BEFORE;
			}
			return AFTER;
		}
		else if (this.getZ() < coord.getZ()) {
			return BEFORE;
		}
		return AFTER;
	}