import java.awt.Color; /** * Ordered and Colored Integers. */ public class OCInteger implements IColored, IOrdered { private int _value; private Color _color = Color.blue; /** * @param value * @param color */ public OCInteger(int value, Color color) { _value = value; _color = color; } public int compare(IOrdered ocInt) { OCInteger rhs = (OCInteger)ocInt; Color thisColor = _color; Color thatColor = rhs._color; _color = Color.white; rhs._color = _color; try { Thread.sleep(200); } catch(Exception e) {} rhs._color =thatColor; _color = thisColor; return _value < rhs._value? IOrdered.LESS: _value > rhs._value? IOrdered.GREATER: IOrdered.EQUAL; } public int getValue() { return _value; } public void setColor(Color color) { _color = color; } public Color getColor() { return _color; } }