Class ExpandedNameTable
java.lang.Object
org.htmlunit.xpath.xml.dtm.ref.ExpandedNameTable
This is a default implementation of a table that manages mappings from expanded names to
expandedNameIDs.
%OPT% The performance of the getExpandedTypeID() method is very important to DTM building. To get the best performance out of this class, we implement a simple hash algorithm directly into this class, instead of using the inefficient java.util.Hashtable. The code for the get and put operations are combined in getExpandedTypeID() method to share the same hash calculation code. We only need to implement the rehash() interface which is used to expand the hash table.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetExpandedTypeID(String namespace, String localName, int type) Given an expanded name represented by namespace, local name and node type, return an ID.final intgetLocalNameID(int expandedNameID) Given an expanded-name ID, return the local name ID.final intgetNamespaceID(int expandedNameID) Given an expanded-name ID, return the namespace URI ID.final shortgetType(int expandedNameID) Given an expanded-name ID, return the local name ID.
-
Field Details
-
ELEMENT
public static final int ELEMENT- See Also:
-
ATTRIBUTE
public static final int ATTRIBUTE- See Also:
-
NAMESPACE
public static final int NAMESPACE- See Also:
-
-
Constructor Details
-
ExpandedNameTable
public ExpandedNameTable()Create an expanded name table.
-
-
Method Details
-
getExpandedTypeID
Given an expanded name represented by namespace, local name and node type, return an ID. If the expanded-name does not exist in the internal tables, the entry will be created, and the ID will be returned. Any additional nodes that are created that have this expanded name will use this ID.- Parameters:
namespace- The namespacelocalName- The local nametype- The node type- Returns:
- the expanded-name id of the node.
-
getLocalNameID
public final int getLocalNameID(int expandedNameID) Given an expanded-name ID, return the local name ID.- Parameters:
expandedNameID- an ID that represents an expanded-name.- Returns:
- The id of this local name.
-
getNamespaceID
public final int getNamespaceID(int expandedNameID) Given an expanded-name ID, return the namespace URI ID.- Parameters:
expandedNameID- an ID that represents an expanded-name.- Returns:
- The id of this namespace.
-
getType
public final short getType(int expandedNameID) Given an expanded-name ID, return the local name ID.- Parameters:
expandedNameID- an ID that represents an expanded-name.- Returns:
- The id of this local name.
-