|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection<E> java.util.AbstractSet<E> org.eclipse.internal.xtend.util.WeakInterningHashSet<QualifiedNameWithDelimiter> org.eclipse.internal.xtend.util.QualifiedNameWithDelimiter.QualifiedNameCache
protected static class QualifiedNameWithDelimiter.QualifiedNameCache
A cached pool of weakly referenced qualified names. There are several ways of interning instances, all of which seek to avoid creating new
objects whenever possible. This implementation provides the hash code computations for a qualified name. It's carefully designed to ensure that
a qualified name's hash code is the same as that of its string representation, except for the
encoding
of the leading slash.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.eclipse.internal.xtend.util.WeakInterningHashSet |
---|
WeakInterningHashSet.Entry<E> |
Field Summary | |
---|---|
protected char[] |
buffer
A buffer for character level processing. |
protected static int[] |
POWERS_OF_31
A cached array for the 31^n. |
protected java.lang.String[] |
segmentBuffer
A buffer for buiding up string segments. |
Fields inherited from class org.eclipse.internal.xtend.util.WeakInterningHashSet |
---|
CAPACITY_MASK, entries, MOD_COUNT_INCREMENT, modCount, NULL_BIT_INCREMENT, NULL_ENTRY, PRIME_CAPACITIES, queue, size |
Constructor Summary | |
---|---|
protected |
QualifiedNameWithDelimiter.QualifiedNameCache()
|
Method Summary | |
---|---|
protected void |
ensureSegmentCapacity(int segmentCount)
Ensures that the segment buffer is give enough to hold the given number of segments. |
protected static boolean |
equals(java.lang.String[] segments1,
java.lang.String[] segments2)
Returns true if the arrays are of the same length and have equal strings. |
protected static int |
hashCode(boolean hasLeadingSlash,
java.lang.String[] segments)
Computes the hash code for the segments, taking into account whether there is a leading slash. |
protected static int |
hashCode(boolean hasLeadingSlash,
java.lang.String[] segments,
java.lang.String segment)
Computes the hash code for the segments along with the one additional segment, taking into account whether there is a leading slash. |
protected static int |
hashCode(boolean hasLeadingSlash,
java.lang.String[] segments1,
java.lang.String[] segments2)
Computes the hash code for the composed segments, taking into account whether there is a leading slash. |
protected static int |
hashCode(int initialHashCode,
java.lang.String[] segments)
A helper utility for computing the hash code starting with a base code and taking the given segments into account. |
QualifiedNameWithDelimiter |
intern(boolean hasLeadingSlash,
boolean needsCopying,
boolean needsToIntern,
java.lang.String[] segments)
Interns the segments, taking into account the leading slash, copying the array when needed, and interning the segments themselves, when needed. |
protected QualifiedNameWithDelimiter |
intern(boolean hasLeadingSlash,
java.lang.String[] segments,
java.lang.String segment)
Interns the segments along with the one additional segment, taking into account the leading slash and interning the additional segment. |
protected QualifiedNameWithDelimiter |
intern(boolean hasLeadingSlash,
java.lang.String[] segments1,
java.lang.String[] segments2)
Interns the composed segments, taking into account the leading slash. |
protected QualifiedNameWithDelimiter |
intern(java.lang.String name)
Interns the string representation of a qualified name, splitting it into appropriate segments. |
protected static int |
powerOf31(int n)
Returns 31^n. |
Methods inherited from class org.eclipse.internal.xtend.util.WeakInterningHashSet |
---|
add, addEntry, cleanup, contains, createEntry, dump, ensureCapacity, equals, get, getEntry, grow, hashCode, index, intern, iterator, newEntries, nullEntry, putEntry, rehash, remove, removeEntry, size |
Methods inherited from class java.util.AbstractSet |
---|
equals, hashCode, removeAll |
Methods inherited from class java.util.AbstractCollection |
---|
addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
---|
addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray |
Field Detail |
---|
protected static int[] POWERS_OF_31
protected char[] buffer
protected java.lang.String[] segmentBuffer
Constructor Detail |
---|
protected QualifiedNameWithDelimiter.QualifiedNameCache()
Method Detail |
---|
protected static int powerOf31(int n)
protected static int hashCode(int initialHashCode, java.lang.String[] segments)
String.hashCode()
.
protected static int hashCode(boolean hasLeadingSlash, java.lang.String[] segments)
public QualifiedNameWithDelimiter intern(boolean hasLeadingSlash, boolean needsCopying, boolean needsToIntern, java.lang.String[] segments)
protected static int hashCode(boolean hasLeadingSlash, java.lang.String[] segments, java.lang.String segment)
protected QualifiedNameWithDelimiter intern(boolean hasLeadingSlash, java.lang.String[] segments, java.lang.String segment)
protected static int hashCode(boolean hasLeadingSlash, java.lang.String[] segments1, java.lang.String[] segments2)
protected QualifiedNameWithDelimiter intern(boolean hasLeadingSlash, java.lang.String[] segments1, java.lang.String[] segments2)
protected QualifiedNameWithDelimiter intern(java.lang.String name)
protected void ensureSegmentCapacity(int segmentCount)
segmentCount
- protected static boolean equals(java.lang.String[] segments1, java.lang.String[] segments2)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |