// Source code example for "A Practical Introduction // to Data Structures and Algorithm Analysis" // by Clifford A. Shaffer, Prentice Hall, 1998. // Copyright 1998 by Clifford A. Shaffer public class DElem { // An element with a 2D or 3D key // For spatial data strutures tests // It does not implement Elem because its key // field and key access method are a bit different private int[] coord; public DElem(int x, int y) { coord = new int[2]; coord[0] = x; coord[1] = y; } public DElem(int x, int y, int z) { coord = new int[3]; coord[0] = x; coord[1] = y; coord[2] = z; } public int key(int dim) { return coord[dim]; } public int[] coord() { return coord; } public boolean equalKey(int[] that) { for (int i=0; i