@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; IdItemPathSegment other = (IdItemPathSegment) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; }
public boolean equals(Object obj, boolean allowUnqualified, boolean allowDifferentPrefixes) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } NameItemPathSegment other = (NameItemPathSegment) obj; if (allowUnqualified) { if (!allowDifferentPrefixes) { throw new UnsupportedOperationException("It is not possible to disallow different prefixes while allowing unqualified names"); } return QNameUtil.match(name, other.name); } else { if (!name.equals(other.name)) { // compares namespace and local part return false; } // in order to differentiate between x:name and name (when x is undefined) we will compare the prefixes as well if (!allowDifferentPrefixes && !normalizedPrefix(name).equals(normalizedPrefix(other.name))) { return false; } return true; } }
public boolean equals(Object obj, boolean allowUnqualified, boolean allowDifferentPrefixes) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } VariableItemPathSegment other = (VariableItemPathSegment) obj; if (allowUnqualified) { if (!allowDifferentPrefixes) { throw new UnsupportedOperationException("It is not possible to disallow different prefixes while allowing unqualified names"); } return QNameUtil.match(name, other.name); } else { if (!name.equals(other.name)) { // compares namespace and local part return false; } // in order to differentiate between x:name and name (when x is undefined) we will compare the prefixes as well if (!allowDifferentPrefixes && !normalizedPrefix(name).equals(normalizedPrefix(other.name))) { return false; } return true; } }