com.ctc.wstx.sr
Class ElemAttrs

java.lang.Object
  extended by com.ctc.wstx.sr.ElemAttrs

public final class ElemAttrs
extends java.lang.Object

Container class that is constructed with enough raw attribute information, to be able to lazily construct full attribute objects, to be accessed via Iterator, or fully-qualified name.

Implementation note: code for using Map-like structure is unfortunately cut'n pasted from AttributeCollector. Problem with refactoring is that it's 90% the same code, but not 100%.

Although instances of this class are constructed by stream readers, it is actually used by element event objects.


Constructor Summary
ElemAttrs(java.lang.String[] rawAttrs, int defOffset)
          Method called to create "short" attribute list; list that has only few entries, and can thus be searched for attributes using linear search, without using any kind of Map structure.
ElemAttrs(java.lang.String[] rawAttrs, int defOffset, int[] attrMap, int hashSize, int spillEnd)
          Method called to create "long" attribute list; list that has a few entries, and efficient access by fully-qualified name should not be done by linear search.
 
Method Summary
 int findIndex(javax.xml.namespace.QName name)
           
 int getFirstDefaultOffset()
           
 java.lang.String[] getRawAttrs()
           
 boolean isDefault(int ix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElemAttrs

public ElemAttrs(java.lang.String[] rawAttrs,
                 int defOffset)
Method called to create "short" attribute list; list that has only few entries, and can thus be searched for attributes using linear search, without using any kind of Map structure.

Currently the limit is 4 attributes; 1, 2 or 3 attribute lists are considered short, 4 or more 'long'.

Parameters:
rawAttrs - Array that contains 4 Strings for each attribute; localName, URI, prefix, value. Can be used to lazily construct structure(s) needed to return Iterator for accessing all attributes.
defOffset - Index of the first default attribute, if any; number of all attributes if none

ElemAttrs

public ElemAttrs(java.lang.String[] rawAttrs,
                 int defOffset,
                 int[] attrMap,
                 int hashSize,
                 int spillEnd)
Method called to create "long" attribute list; list that has a few entries, and efficient access by fully-qualified name should not be done by linear search.

Parameters:
rawAttrs - Array that contains 4 Strings for each attribute; localName, URI, prefix, value. Can be used to lazily construct structure(s) needed to return Iterator for accessing all attributes.
Method Detail

getRawAttrs

public java.lang.String[] getRawAttrs()

findIndex

public int findIndex(javax.xml.namespace.QName name)

getFirstDefaultOffset

public int getFirstDefaultOffset()

isDefault

public boolean isDefault(int ix)