@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Segment other = (Segment) obj; if (!getOuterType().equals(other.getOuterType())) return false; if (this.style == null) { if (other.style != null) return false; } else if (!this.style.equals(other.style)) return false; if (this.text == null) { if (other.text != null) return false; } else if (!this.text.equals(other.text)) return false; return true; }