|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.internal.xtend.util.QualifiedName
public final class QualifiedName
A memory efficient structure to store qualified names composed of String segments which are (optionally) separated by a delimiter. QualifiedNames must be constructed through one its create methods. The structure uses String pooling to store the single segments. Further it maintains a pool of QualifiedName instances itself, so that each QualifiedName exists only once.
Field Summary | |
---|---|
protected static org.eclipse.internal.xtend.util.QualifiedName.QualifiedNameCache |
CACHE
|
protected int |
hash
|
protected java.lang.String[] |
segments
|
protected java.lang.ref.WeakReference<java.lang.String> |
toString
|
Constructor Summary | |
---|---|
protected |
QualifiedName(java.lang.String[] segments,
int hashCode)
Constructor |
Method Summary | |
---|---|
QualifiedName |
append(QualifiedName t)
Append another Identifier to this instance |
static QualifiedName |
create(java.lang.String segment)
Factory method. |
static QualifiedName |
create(java.lang.String[] segments)
Factory method. |
static QualifiedName |
create(java.lang.String segments,
java.lang.String delimiter)
Factory method. |
java.lang.String |
getFirstSegment()
|
java.lang.String |
getLastSegment()
|
java.lang.String |
getSegment(int index)
|
int |
getSegmentCount()
|
int |
hashCode()
Note that there's no override of Object.equals(Object) because all instances are interned and therefore there's at most one possible
instance for sequence of segments. |
java.lang.String |
toString()
Returns a canonical String representation of this. |
java.lang.String |
toString(java.lang.String delimiter)
Returns a canonical String representation of this using the specified delimiter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final int hash
protected java.lang.String[] segments
protected java.lang.ref.WeakReference<java.lang.String> toString
protected static final org.eclipse.internal.xtend.util.QualifiedName.QualifiedNameCache CACHE
Constructor Detail |
---|
protected QualifiedName(java.lang.String[] segments, int hashCode)
segments
- Segments of the Identifier.delimiter
- A delimiter string for the construction of a String representation with toString()
. Can be null
.Method Detail |
---|
public QualifiedName append(QualifiedName t)
t
- An identifier.
this
extended by the segments of t
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String delimiter)
toString()
, since
the result cannot be cached.
delimiter
- A delimiter to insert between segments.public int getSegmentCount()
public java.lang.String getSegment(int index)
public java.lang.String getLastSegment()
public java.lang.String getFirstSegment()
public int hashCode()
Object.equals(Object)
because all instances are interned and therefore there's at most one possible
instance for sequence of segments.
hashCode
in class java.lang.Object
public static QualifiedName create(java.lang.String[] segments)
segments
- segments the segments of the to-be-created qualified name.
QualifiedName
. When the factory method was already invoked with the same arguments the same instance as the previous call
will be returned.public static QualifiedName create(java.lang.String segment)
segment
- The string segment of the qualified name.
QualifiedName
. When the factory method was already invoked with the same arguments the same instance as the previous call
will be returned.public static QualifiedName create(java.lang.String segments, java.lang.String delimiter)
segments
- The string segment of the qualified name.delimiter
- The delimiter which separates the segments.
QualifiedName
. When the factory method was already invoked with the same arguments the same instance as the previous call
will be returned.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |