1 package Map; 2 19 public class ConnectedPointImpl 20 extends ConnectedPoint 21 { 22 public ConnectedPointImpl() {} 23 24 public ConnectedPointImpl(int a_x, int a_y, String a_label, Point[] a_connected_points) { 25 x = a_x; 26 y = a_y; 27 label = a_label; 28 connected_points = a_connected_points; 29 } 30 31 39 public void print () { 40 System.out.println("Derived Point is [" + label + ": (" + x + ", " + y + ")]"); 41 if (connected_points.length > 0) { 42 System.out.println("Connected to:"); 43 for (int i = 0; i < connected_points.length; i++) { 44 System.out.print("\t"); 45 connected_points[i].print(); 46 } 47 } 48 } 49 50 58 public void add_connection ( 59 Point p 60 ) { 61 Point[] connected = new Point[connected_points.length + 1]; 62 if (connected_points.length > 0) { 63 System.arraycopy(connected_points, 0, connected, 0, connected_points.length); 64 } 65 66 connected[connected_points.length] = p; 67 connected_points = connected; 68 } 69 70 } 71 | Popular Tags |