Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
Woodstox 6.4.0 - Source Code Files
Woodstox 6.4.0 Source Code Files are provided at the Woodstox GitHub Website.
You can download them from the "src/main/java" folder.
You can also browse Woodstox Source Code files below:
✍: FYIcenter
⏎ com/ctc/wstx/dtd/LargePrefixedNameSet.java
package com.ctc.wstx.dtd; import java.util.Iterator; import java.util.TreeSet; import com.ctc.wstx.util.PrefixedName; /** * Implementation of {@link PrefixedNameSet} suitable for storing large number * of entries; basically anything above trivially small sets (4 or less). *<p> * Notes about usage: * <ul> * <li>All Strings contained in {@link PrefixedName} instances are assumed * interned, so that equality comparison can be done (both for values * stored and keys used) * </li> * <li>It is assumed that sets are never empty, ie. always contain at * least one entry. * </li> * <li>It is assumed that caller has ensured that there are no duplicates * in the set -- this data structure does no further validation. * </li> * </ul> */ public final class LargePrefixedNameSet extends PrefixedNameSet { /** * Let's not bother creating tiny hash areas; should seldom be a problem * as smaller sets are usually created using different impl. class. */ final static int MIN_HASH_AREA = 8; final boolean mNsAware; /** * 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) */ final PrefixedName[] mNames; /** * 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, */ final Bucket[] mBuckets; public LargePrefixedNameSet(boolean nsAware, PrefixedName[] names) { mNsAware = nsAware; int len = names.length; // Let's find the size first... let's except 1/8 slack (88% fill rate) int minSize = len + ((len + 7) >> 3); // Let's not create hash areas smaller than certain limit int tableSize = MIN_HASH_AREA; while (tableSize < minSize) { tableSize += tableSize; } mNames = new PrefixedName[tableSize]; // and 1/4 of that for spill area... but let's do that lazily Bucket[] buckets = null; int mask = (tableSize - 1); for (int i = 0; i < len; ++i) { PrefixedName nk = names[i]; int ix = (nk.hashCode() & mask); if (mNames[ix] == null) { // no collision mNames[ix] = nk; } else { // collision, need to add a bucket ix >>= 2; Bucket old; if (buckets == null) { buckets = new Bucket[tableSize >> 2]; old = null; } else { old = buckets[ix]; } buckets[ix] = new Bucket(nk, old); } } mBuckets = buckets; } @Override public boolean hasMultiple() { return true; } /** * @return True if the set contains specified name; false if not. */ @Override public boolean contains(PrefixedName name) { PrefixedName[] hashArea = mNames; int index = name.hashCode() & (hashArea.length - 1); PrefixedName res = hashArea[index]; if (res != null && res.equals(name)) { return true; } Bucket[] buckets = mBuckets; if (buckets != null) { for (Bucket bucket = buckets[index >> 2]; bucket != null; bucket = bucket.getNext()) { res = bucket.getName(); if (res.equals(name)) { return true; } } } return false; } /** * Method called by debug/error handling code, to get a list of * all names contained. */ @Override public void appendNames(StringBuilder sb, String sep) { // Let's first get the alphabetized list of all names from main hash TreeSet<PrefixedName> ts = new TreeSet<PrefixedName>(); for (int i = 0; i < mNames.length; ++i) { PrefixedName name = mNames[i]; if (name != null) { ts.add(name); } } // then spill area if (mBuckets != null) { for (int i = 0; i < (mNames.length >> 2); ++i) { Bucket b = mBuckets[i]; while (b != null) { ts.add(b.getName()); b = b.getNext(); } } } // And then append them: Iterator<PrefixedName> it = ts.iterator(); boolean first = true; while (it.hasNext()) { if (first) { first = false; } else { sb.append(sep); } sb.append(it.next().toString()); } } /* /////////////////////////////////////////////////////////// // Helper class(es) /////////////////////////////////////////////////////////// */ private final static class Bucket { final PrefixedName mName; final Bucket mNext; public Bucket(PrefixedName name, Bucket next) { mName = name; mNext = next; } public PrefixedName getName() { return mName; } public Bucket getNext() { return mNext; } /* public boolean contains(PrefixedName n) { return mName.equals(n); } */ } }
⏎ com/ctc/wstx/dtd/LargePrefixedNameSet.java
Or download all of them as a single archive file:
File name: woodstox-core-6.4.0-fyi.zip File size: 552992 bytes Release date: 2022-10-25 Download
⇒ woodstox-core-6.4.0.jar - Woodstox Core 6.4.0
⇐ What Is Woodstox XML Processing
2023-01-29, 3472👍, 0💬
Popular Posts:
Apache Neethi provides general framework for the programmers to use WS Policy. It is compliant with ...
The Apache FontBox library is an open source Java tool to obtain low level information from font fil...
JDK 11 jdk.javadoc.jmod is the JMOD file for JDK 11 Java Document tool, which can be invoked by the ...
Apache Log4j IOStreams is a Log4j API extension that provides numerous classes from java.io that can...
What Is HttpComponents httpclient-4.2.2.jar? HttpComponents httpclient-4.2.2.jar is the JAR file for...