Class ExpandedNameTable

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

public class ExpandedNameTable extends 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
    Description
    static final int
     
    static final int
     
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an expanded name table.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    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(String namespace, String localName, int type)
    Given an expanded name represented by namespace, local name and node type, return an ID.
    int
    getExpandedTypeID(String ns, String lName, int type, boolean searchOnly)
    Given an expanded name represented by namespace, local name and node type, return an ID.
    final int
    getLocalNameID(int ExpandedNameID)
    Given an expanded-name ID, return the local name ID.
    final int
    getNamespaceID(int ExpandedNameID)
    Given an expanded-name ID, return the namespace URI ID.
    final short
    getType(int ExpandedNameID)
    Given an expanded-name ID, return the local name ID.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • ExpandedNameTable

      public ExpandedNameTable()
      Create an expanded name table.
  • Method Details

    • getExpandedTypeID

      public int getExpandedTypeID(String namespace, 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(String ns, String lName, 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:
      ns - The namespace
      lName - 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.
      Parameters:
      type - the given 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.