/* This file is part of the algoviz@vt collection of algorithm visualizations. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this distribution. If not, see . */ package splayTree; import java.awt.*; /** * Just a drawable line * * @author Andy Street, alstreet@vt.edu * @version Feb 15, 2009 * */ public class Line { public int id = -1; public Location start, end; public Color color = Color.black; public boolean hideGoingForward = false; public boolean hideGoingBackward = false; public boolean goingForward = false; public Line(int id, Location start, Location end) { this(start, end); this.id = id; } public Line(Location start, Location end) { this.start = start; this.end = end; } /** * @param x * @param y * @param x2 * @param y2 */ public Line(int x, int y, int x2, int y2) { this(new Location(x, y), new Location(x2, y2)); } /** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object o) { if(!(o instanceof Line)) return false; Line other = (Line)o; return other.start.equals(start) && other.end.equals(end); } public String toString() { return "Line: " + start + " --> " + end; } }