org.apache.xml.dtm.ref

## Class ExpandedNameTable

- java.lang.Object
- - org.apache.xml.dtm.ref.ExpandedNameTable

-     public class ExpandedNameTable
      extends java.lang.Object

  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
    Modifier and Type | Field and Description
    --- | ---
    `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`
    `static int` | `NAMESPACE`
    `static int` | `NOTATION`
    `static int` | `PROCESSING_INSTRUCTION`
    `static int` | `TEXT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExpandedNameTable()` Create an expanded name table.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ELEMENT

          public static final int ELEMENT

      See Also:
        Constant Field Values

    - #### ATTRIBUTE

          public static final int ATTRIBUTE

      See Also:
        Constant Field Values

    - #### TEXT

          public static final int TEXT

      See Also:
        Constant Field Values

    - #### CDATA_SECTION

          public static final int CDATA_SECTION

      See Also:
        Constant Field Values

    - #### ENTITY_REFERENCE

          public static final int ENTITY_REFERENCE

      See Also:
        Constant Field Values

    - #### ENTITY

          public static final int ENTITY

      See Also:
        Constant Field Values

    - #### PROCESSING_INSTRUCTION

          public static final int PROCESSING_INSTRUCTION

      See Also:
        Constant Field Values

    - #### COMMENT

          public static final int COMMENT

      See Also:
        Constant Field Values

    - #### DOCUMENT

          public static final int DOCUMENT

      See Also:
        Constant Field Values

    - #### DOCUMENT_TYPE

          public static final int DOCUMENT_TYPE

      See Also:
        Constant Field Values

    - #### DOCUMENT_FRAGMENT

          public static final int DOCUMENT_FRAGMENT

      See Also:
        Constant Field Values

    - #### NOTATION

          public static final int NOTATION

      See Also:
        Constant Field Values

    - #### NAMESPACE

          public static final int NAMESPACE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ExpandedNameTable

          public ExpandedNameTable()

      Create an expanded name table.

  - ### Method Detail

    - #### getExpandedTypeID

          public 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. 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 namespace
        `localName` - The local name
        `type` - The node type
      Returns:
        the expanded-name id of the node.

    - #### getExpandedTypeID

          public 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. 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.

      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.

      Parameters:
        `namespace` - The namespace
        `localName` - The local name
        `type` - The node type
        `searchOnly` - If it is true, we will only search for the expanded name. -1 is return is the name is not found.
      Returns:
        the expanded-name id of the node.

    - #### getExpandedTypeID

          public 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.
      Returns:
        the expanded-name id of the node.

    - #### getLocalName

          public java.lang.String getLocalName(int ExpandedNameID)

      Given an expanded-name ID, return the local name part.
      Parameters:
        `ExpandedNameID` - an ID that represents an expanded-name.
      Returns:
        String Local name of this node, or null if the node has no name.

    - #### 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.

    - #### getNamespace

          public java.lang.String getNamespace(int ExpandedNameID)

      Given an expanded-name ID, return the namespace URI part.
      Parameters:
        `ExpandedNameID` - an ID that represents an expanded-name.
      Returns:
        String URI value of this node's namespace, or null if no namespace was resolved.

    - #### 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.

    - #### getSize

          public int getSize()

      Return the size of the ExpandedNameTable
      Returns:
        The size of the ExpandedNameTable

    - #### getExtendedTypes

          public ExtendedType[] getExtendedTypes()

      Return the array of extended types
      Returns:
        The array of extended types

Copyright © 2023 Apache XML Project. All Rights Reserved.