*/
public String toString() {
return (impl.toString());
}
/**
* Determines whether obj is syntactically equal to this compound name.
* If obj is null or not a CompoundName, false is returned.
* Two compound names are equal if each component in one is "equal"
* to the corresponding component in the other.
*<p>
* Equality is also defined in terms of the syntax of this compound name.
* The default implementation of CompoundName uses the syntax properties
* jndi.syntax.ignorecase and jndi.syntax.trimblanks when comparing
* two components for equality. If case is ignored, two strings
* with the same sequence of characters but with different cases
* are considered equal. If blanks are being trimmed, leading and trailing
* blanks are ignored for the purpose of the comparison.
*<p>
* Both compound names must have the same number of components.
*<p>
* Implementation note: Currently the syntax properties of the two compound
* names are not compared for equality. They might be in the future.
*
* @param obj The possibly null object to compare against.
* @return true if obj is equal to this compound name, false otherwise.
* @see #compareTo(java.lang.Object obj)
*/
public boolean equals(Object obj) {
// %%% check syntax too?
return (obj != null &&
obj instanceof CompoundName &&
impl.equals(((CompoundName)obj).impl));
}
/**
* Computes the hash code of this compound name.
* The hash code is the sum of the hash codes of the "canonicalized"
* forms of individual components of this compound name.
* Each component is "canonicalized" according to the
* compound name's syntax before its hash code is computed.
* For a case-insensitive name, for example, the uppercased form of
* a name has the same hash code as its lowercased equivalent.
*
* @return An int representing the hash code of this name.
*/
public int hashCode() {
return impl.hashCode();
}
/**
* Creates a copy of this compound name.
* Changes to the components of this compound name won't
* affect the new copy and vice versa.
* The clone and this compound name share the same syntax.
*
* @return A non-null copy of this compound name.
*/
public Object clone() {
return (new CompoundName(getAll(), mySyntax));
}
/**
* Compares this CompoundName with the specified Object for order.
* Returns a
* negative integer, zero, or a positive integer as this Name is less
* than, equal to, or greater than the given Object.
* <p>
* If obj is null or not an instance of CompoundName, ClassCastException
* is thrown.
* <p>
* See equals() for what it means for two compound names to be equal.
* If two compound names are equal, 0 is returned.
*<p>
* Ordering of compound names depend on the syntax of the compound name.
* By default, they follow lexicographical rules for string comparison
* with the extension that this applies to all the components in the
* compound name and that comparison of individual components is
* affected by the jndi.syntax.ignorecase and jndi.syntax.trimblanks
* properties, identical to how they affect equals().
* If this compound name is "lexicographically" lesser than obj,
* a negative number is returned.
* If this compound name is "lexicographically" greater than obj,
* a positive number is returned.
*<p>
* Implementation note: Currently the syntax properties of the two compound
* names are not compared when checking order. They might be in the future.
* @param obj The non-null object to compare against.
* @return a negative integer, zero, or a positive integer as this Name
* is less than, equal to, or greater than the given Object.
* @exception ClassCastException if obj is not a CompoundName.
* @see #equals(java.lang.Object)
*/
public int compareTo(Object obj) {
if (!(obj instanceof CompoundName)) {
throw new ClassCastException("Not a CompoundName");
}
return impl.compareTo(((CompoundName)obj).impl);
}
=3= |