@Override
    public boolean equals(Object obj) {
        if (obj instanceof DrawableSegment) {
            DrawableSegment d = (DrawableSegment) obj;
            if (this.x1 == d.x1 && this.x2 == d.x2 && this.y1 == d.y1 && this.y2 == d.y2 && this.color.equals(d.color)
                    && this.brushWidth == d.brushWidth) {
                return true;
            }
        }
        return false;
    }