|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xml.dtm.ref.ExpandedNameTable
public class 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.
Nested Class Summary | |
---|---|
private static class |
ExpandedNameTable.HashEntry
Inner class which represents a hash table entry. |
Field Summary | |
---|---|
static int |
ATTRIBUTE
|
static int |
CDATA_SECTION
|
static int |
COMMENT
|
static int |
DOCUMENT
|
static int |
DOCUMENT_FRAGMENT
|
static int |
DOCUMENT_TYPE
|
static int |
ELEMENT
|
static int |
ENTITY
|
static int |
ENTITY_REFERENCE
|
(package private) ExtendedType |
hashET
Workspace for lookup. |
private int |
m_capacity
The capacity of the hash table, i.e. |
private static ExtendedType[] |
m_defaultExtendedTypes
The array to store the default extended types. |
private ExtendedType[] |
m_extendedTypes
Array of extended types for this document |
private static int |
m_initialCapacity
The initial capacity of the hash table. |
private static int |
m_initialSize
The initial size of the m_extendedTypes array |
private static float |
m_loadFactor
The default load factor of the Hashtable. |
private int |
m_nextType
Next available extended type |
private ExpandedNameTable.HashEntry[] |
m_table
The internal array to store the hash entries. |
private int |
m_threshold
The threshold of the hash table, which is equal to capacity * loadFactor. |
static int |
NAMESPACE
|
static int |
NOTATION
|
static int |
PROCESSING_INSTRUCTION
|
static int |
TEXT
|
Constructor Summary | |
---|---|
ExpandedNameTable()
Create an expanded name table. |
Method Summary | |
---|---|
int |
getExpandedTypeID(int type)
Given a type, return an expanded name ID.Any additional nodes that are created that have this expanded name will use this ID. |
int |
getExpandedTypeID(java.lang.String namespace,
java.lang.String localName,
int type)
Given an expanded name represented by namespace, local name and node type, return an ID. |
int |
getExpandedTypeID(java.lang.String namespace,
java.lang.String localName,
int type,
boolean searchOnly)
Given an expanded name represented by namespace, local name and node type, return an ID. |
ExtendedType[] |
getExtendedTypes()
Return the array of extended types |
java.lang.String |
getLocalName(int ExpandedNameID)
Given an expanded-name ID, return the local name part. |
int |
getLocalNameID(int ExpandedNameID)
Given an expanded-name ID, return the local name ID. |
java.lang.String |
getNamespace(int ExpandedNameID)
Given an expanded-name ID, return the namespace URI part. |
int |
getNamespaceID(int ExpandedNameID)
Given an expanded-name ID, return the namespace URI ID. |
int |
getSize()
Return the size of the ExpandedNameTable |
short |
getType(int ExpandedNameID)
Given an expanded-name ID, return the local name ID. |
private void |
initExtendedTypes()
Initialize the vector of extended types with the basic DOM node types. |
private void |
rehash()
Increases the capacity of and internally reorganizes the hashtable, in order to accommodate and access its entries more efficiently. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private ExtendedType[] m_extendedTypes
private static int m_initialSize
private int m_nextType
public static final int ELEMENT
public static final int ATTRIBUTE
public static final int TEXT
public static final int CDATA_SECTION
public static final int ENTITY_REFERENCE
public static final int ENTITY
public static final int PROCESSING_INSTRUCTION
public static final int COMMENT
public static final int DOCUMENT
public static final int DOCUMENT_TYPE
public static final int DOCUMENT_FRAGMENT
public static final int NOTATION
public static final int NAMESPACE
ExtendedType hashET
private static ExtendedType[] m_defaultExtendedTypes
private static float m_loadFactor
private static int m_initialCapacity
private int m_capacity
private int m_threshold
private ExpandedNameTable.HashEntry[] m_table
Constructor Detail |
---|
public ExpandedNameTable()
Method Detail |
---|
private void initExtendedTypes()
public int getExpandedTypeID(java.lang.String namespace, java.lang.String localName, int type)
namespace
- The namespacelocalName
- The local nametype
- The node type
public int getExpandedTypeID(java.lang.String namespace, java.lang.String localName, int type, boolean searchOnly)
If searchOnly is true, we will return -1 if the name is not found in the table, otherwise the name is added to the table and the expanded name id of the new entry is returned.
namespace
- The namespacelocalName
- The local nametype
- The node typesearchOnly
- If it is true, we will only search for the expanded name.
-1 is return is the name is not found.
private void rehash()
public int getExpandedTypeID(int type)
public java.lang.String getLocalName(int ExpandedNameID)
ExpandedNameID
- an ID that represents an expanded-name.
public final int getLocalNameID(int ExpandedNameID)
ExpandedNameID
- an ID that represents an expanded-name.
public java.lang.String getNamespace(int ExpandedNameID)
ExpandedNameID
- an ID that represents an expanded-name.
public final int getNamespaceID(int ExpandedNameID)
ExpandedNameID
- an ID that represents an expanded-name.
public final short getType(int ExpandedNameID)
ExpandedNameID
- an ID that represents an expanded-name.
public int getSize()
public ExtendedType[] getExtendedTypes()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |