Top Description Fields Constructors Methods
com.ctc.wstx.sr

public final Class ElemAttrs

extends Object
Class Inheritance
Imports
javax.xml.namespace.QName

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.

Field Summary

Modifier and TypeField and Description
private final int
private final int[]
private final int
private final int
mDefaultOffset

Raw offset (in mRawAttrs) of the first attribute instance that was created through default value expansion.

private final String[]
mRawAttrs

Array that contains 4 Strings for each attribute; localName, URI, prefix, value.

private static final int

Constructor Summary

AccessConstructor and Description
public
ElemAttrs(String[]
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.
rawAttrs
,
int
Index of the first default attribute, if any; number of all attributes if none
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.

public
ElemAttrs(String[]
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.
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

Modifier and TypeMethod and Description
public int
private final int
findMapIndex(String nsURI, String localName)

Note

this method is very similar to com.ctc.wstx.sr.AttributeCollector#getAttrValue; basically most of it was cut'n pasted.

public int
public String[]
public boolean
isDefault(int ix)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mAttrHashSizeback to summary
private final int mAttrHashSize
mAttrMapback to summary
private final int[] mAttrMap
mAttrSpillEndback to summary
private final int mAttrSpillEnd
mDefaultOffsetback to summary
private final int mDefaultOffset

Raw offset (in mRawAttrs) of the first attribute instance that was created through default value expansion.

mRawAttrsback to summary
private final String[] mRawAttrs

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.

OFFSET_NS_URIback to summary
private static final int OFFSET_NS_URI

Constructor Detail

ElemAttrsback to summary
public ElemAttrs(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:String[]

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:int

Index of the first default attribute, if any; number of all attributes if none

ElemAttrsback to summary
public ElemAttrs(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:String[]

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

findIndexback to summary
public int findIndex(QName name)
findMapIndexback to summary
private final int findMapIndex(String nsURI, String localName)

Note

this method is very similar to com.ctc.wstx.sr.AttributeCollector#getAttrValue; basically most of it was cut'n pasted. Would be nice to refactor, but it's bit hard to do that since data structures are not 100% identical (mostly attribute storage, not Map structure itself).

getFirstDefaultOffsetback to summary
public int getFirstDefaultOffset()
getRawAttrsback to summary
public String[] getRawAttrs()
isDefaultback to summary
public boolean isDefault(int ix)