org.millscript.commons.xml.tokenizer
Class AbstractName

java.lang.Object
  extended by org.millscript.commons.xml.tokenizer.AbstractName
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, org.millscript.commons.alert.AlertDecorator, Name
Direct Known Subclasses:
NoNamespacesName, PrefixedName, UnprefixedName

public abstract class AbstractName
extends java.lang.Object
implements org.millscript.commons.alert.AlertDecorator, java.lang.Comparable, Name, java.io.Serializable

This class provides a Name implementation for prefixed, or namespace aware, names.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.millscript.commons.xml.api.Name
XML, XMLNS
 
Constructor Summary
AbstractName()
           
 
Method Summary
 int compareTo(java.lang.Object o)
           
 boolean equals(java.lang.Object obj)
          Returns true if the specified object is equal to this name.
 int hashCode()
          Returns the hash code for this name.
abstract  AbstractName setNamespace(org.millscript.commons.util.IMap<java.lang.String,java.lang.String> scope)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.millscript.commons.alert.AlertDecorator
decorate
 
Methods inherited from interface org.millscript.commons.xml.api.Name
getLocalName, getNamespace, getPrefix, getQName
 

Constructor Detail

AbstractName

public AbstractName()
Method Detail

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable
See Also:
Comparable.compareTo(java.lang.Object)

equals

public boolean equals(java.lang.Object obj)
Description copied from interface: Name
Returns true if the specified object is equal to this name. A Name is equal to any other Name if they have the same namespace and local name, ignoring any prefix.

The reasons behind ignoring the prefix derive from the Namespaces in XML specification, in which the prefix is ignored when comparing qualified names.

Specified by:
equals in interface Name
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare for equality with this name
Returns:
true if the specified object is equal to this name
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Description copied from interface: Name
Returns the hash code for this name. The hash code of a name is constructed from the namespace and local name, ignoring any prefix. As such the hash code a name is defined to be:

int result = 37; result += 37 * result + this.getNamespace().hashCode(); result += 37 * result + this.getLocalName().hashCode(); return result;

The reasons behind ignoring the prefix derive from the Namespaces in XML specification, in which the prefix is ignored when comparing qualified names.

Specified by:
hashCode in interface Name
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

setNamespace

public abstract AbstractName setNamespace(org.millscript.commons.util.IMap<java.lang.String,java.lang.String> scope)


Copyright © 2005-2007 Open World Ltd. All Rights Reserved.