package biosim; import java.awt.Point; /** * This is a simple class to store points, * direction vectors, etc. in 2-D space. It * provides no functionality whatsoever, other * than the convenience of packaging two variables * inside one object. */ public class XYPair { public double x; public double y; /** * Construct an XYPair from the given values. */ public XYPair(double x, double y) { this.x = x; this.y = y; } /** * Construct an XYPair from the given values. */ public XYPair(int x, int y) { this.x = (double) x; this.y = (double) y; } /** * The default constructor initializes both * x and y to 0.0. */ public XYPair() { this(0.0, 0.0); } /** * Essentially a copy constructor. Creates a * new XYPair with the same values as those of its * argument. */ public XYPair(XYPair other) { x = other.x; y = other.y; } public Point asPoint() { return new Point((int) x, (int) y); } }