< prev index next >

jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/DTMDefaultBase.java

Print this page




 920    * really like doing so, and would love to have an excuse not to...)
 921    *
 922    * %OPT% Performance is critical for this operation.
 923    *
 924    * %REVIEW% Should this be exposed at the package/public layers?
 925    *
 926    * @param nodeHandle (external representation of node)
 927    * @return nodeIdentity Internal offset to this node's records.
 928    * */
 929   final public int makeNodeIdentity(int nodeHandle)
 930   {
 931     if(NULL==nodeHandle) return NULL;
 932 
 933     if(m_mgrDefault!=null)
 934     {
 935       // Optimization: use the DTMManagerDefault's fast DTMID-to-offsets
 936       // table.  I'm not wild about this solution but this operation
 937       // needs need extreme speed.
 938 
 939       int whichDTMindex=nodeHandle>>>DTMManager.IDENT_DTM_NODE_BITS;
 940 
 941       // %REVIEW% Wish I didn't have to perform the pre-test, but
 942       // someone is apparently asking DTMs whether they contain nodes
 943       // which really don't belong to them. That's probably a bug
 944       // which should be fixed, but until it is:
 945       if(m_mgrDefault.m_dtms[whichDTMindex]!=this)
 946         return NULL;
 947       else
 948         return
 949           m_mgrDefault.m_dtm_offsets[whichDTMindex]
 950           | (nodeHandle & DTMManager.IDENT_NODE_DEFAULT);
 951     }
 952 
 953     int whichDTMid=m_dtmIdent.indexOf(nodeHandle & DTMManager.IDENT_DTM_DEFAULT);
 954     return (whichDTMid==NULL)
 955       ? NULL
 956       : (whichDTMid << DTMManager.IDENT_DTM_NODE_BITS)
 957       + (nodeHandle & DTMManager.IDENT_NODE_DEFAULT);
 958   }
 959 
 960 
 961   /**
 962    * Given a node handle, get the handle of the node's first child.
 963    * If not yet resolved, waits for more nodes to be added to the document and
 964    * tries again.
 965    *
 966    * @param nodeHandle int Handle of the node.
 967    * @return int DTM node-number of first child, or DTM.NULL to indicate none exists.




 920    * really like doing so, and would love to have an excuse not to...)
 921    *
 922    * %OPT% Performance is critical for this operation.
 923    *
 924    * %REVIEW% Should this be exposed at the package/public layers?
 925    *
 926    * @param nodeHandle (external representation of node)
 927    * @return nodeIdentity Internal offset to this node's records.
 928    * */
 929   final public int makeNodeIdentity(int nodeHandle)
 930   {
 931     if(NULL==nodeHandle) return NULL;
 932 
 933     if(m_mgrDefault!=null)
 934     {
 935       // Optimization: use the DTMManagerDefault's fast DTMID-to-offsets
 936       // table.  I'm not wild about this solution but this operation
 937       // needs need extreme speed.
 938 
 939       int whichDTMindex=nodeHandle>>>DTMManager.IDENT_DTM_NODE_BITS;








 940       return
 941         m_mgrDefault.m_dtm_offsets[whichDTMindex]
 942         | (nodeHandle & DTMManager.IDENT_NODE_DEFAULT);
 943     }
 944 
 945     int whichDTMid=m_dtmIdent.indexOf(nodeHandle & DTMManager.IDENT_DTM_DEFAULT);
 946     return (whichDTMid==NULL)
 947       ? NULL
 948       : (whichDTMid << DTMManager.IDENT_DTM_NODE_BITS)
 949       + (nodeHandle & DTMManager.IDENT_NODE_DEFAULT);
 950   }
 951 
 952 
 953   /**
 954    * Given a node handle, get the handle of the node's first child.
 955    * If not yet resolved, waits for more nodes to be added to the document and
 956    * tries again.
 957    *
 958    * @param nodeHandle int Handle of the node.
 959    * @return int DTM node-number of first child, or DTM.NULL to indicate none exists.


< prev index next >