/** * Determines whether this circle is adjacent to another. * * @param circle Circle we're comparing with. */ public boolean adjacentTo(AtroposCircle circle) { return (((Math.abs(this.height - circle.height()) == 1) && (this.leftDistance == circle.leftDistance())) || ((Math.abs(this.leftDistance - circle.leftDistance()) == 1) && (this.height == circle.height())) || ((Math.abs(this.height - circle.height()) == 1) && (this.rightDistance == circle.rightDistance()))); }
/** Main method for testing. */ public static void main(String[] args) { AtroposCircle circle = new AtroposCircle(0, 1, 2); System.out.println(circle.toString()); circle.color(RED); System.out.println(circle.toString()); }