Package com.ctc.wstx.dtd
Class LargePrefixedNameSet
- java.lang.Object
-
- com.ctc.wstx.dtd.PrefixedNameSet
-
- com.ctc.wstx.dtd.LargePrefixedNameSet
-
public final class LargePrefixedNameSet extends PrefixedNameSet
Implementation ofPrefixedNameSet
suitable for storing large number of entries; basically anything above trivially small sets (4 or less).Notes about usage:
- All Strings contained in
PrefixedName
instances are assumed interned, so that equality comparison can be done (both for values stored and keys used) - It is assumed that sets are never empty, ie. always contain at least one entry.
- It is assumed that caller has ensured that there are no duplicates in the set -- this data structure does no further validation.
- All Strings contained in
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
LargePrefixedNameSet.Bucket
-
Field Summary
Fields Modifier and Type Field Description (package private) LargePrefixedNameSet.Bucket[]
mBuckets
Secondary (spill) area, in which keys whose hash values collide with primary ones are added.(package private) static int
MIN_HASH_AREA
Let's not bother creating tiny hash areas; should seldom be a problem as smaller sets are usually created using different impl.(package private) PrefixedName[]
mNames
Primary hash area in which NameKeys are added.(package private) boolean
mNsAware
-
Constructor Summary
Constructors Constructor Description LargePrefixedNameSet(boolean nsAware, PrefixedName[] names)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendNames(java.lang.StringBuilder sb, java.lang.String sep)
Method called by debug/error handling code, to get a list of all names contained.boolean
contains(PrefixedName name)
boolean
hasMultiple()
-
Methods inherited from class com.ctc.wstx.dtd.PrefixedNameSet
toString, toString
-
-
-
-
Field Detail
-
MIN_HASH_AREA
static final int MIN_HASH_AREA
Let's not bother creating tiny hash areas; should seldom be a problem as smaller sets are usually created using different impl. class.- See Also:
- Constant Field Values
-
mNsAware
final boolean mNsAware
-
mNames
final PrefixedName[] mNames
Primary hash area in which NameKeys are added. Sized to be the smallest power of two bigger than number of entries; but at least 4 (it doesn't make sense to create smaller arrays)
-
mBuckets
final LargePrefixedNameSet.Bucket[] mBuckets
Secondary (spill) area, in which keys whose hash values collide with primary ones are added. Number of buckets is 1/4 of number of primary entries,
-
-
Constructor Detail
-
LargePrefixedNameSet
public LargePrefixedNameSet(boolean nsAware, PrefixedName[] names)
-
-
Method Detail
-
hasMultiple
public boolean hasMultiple()
- Specified by:
hasMultiple
in classPrefixedNameSet
- Returns:
- True if set contains more than one entry; false if not (empty or has one)
-
contains
public boolean contains(PrefixedName name)
- Specified by:
contains
in classPrefixedNameSet
- Returns:
- True if the set contains specified name; false if not.
-
appendNames
public void appendNames(java.lang.StringBuilder sb, java.lang.String sep)
Method called by debug/error handling code, to get a list of all names contained.- Specified by:
appendNames
in classPrefixedNameSet
-
-