Class: com.sun.tools.javac.util.Name
- public class Name
- implements Name
An abstraction for internal compiler strings. For efficiency reasons,
GJC uses hashed strings that are stored in a common large buffer.
Names represent unique hashable strings. Two names are equal if their indices are equal. Utf8 representation is used for storing names internally.
This is NOT part of any API supported by Sun Microsystems. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
Methods
-
Nametop
public Name() -
appendtop
Return the concatenation of this name, the given ASCII character, and name `n'. -
appendtop
Return the concatenation of this name and name `n'. -
byteAttop
public byte byteAt(int i)Returns i'th byte of this name. -
charAttop
public char charAt(int index)Returns thecharvalue at the specified index. An index ranges from zero to length() - 1. The firstcharvalue of the sequence is at index zero, the next at index one, and so on, as for array indexing.If the
charvalue specified by the index is a surrogate, the surrogate value is returned.- Specified by:
- charAt from CharSequence
-
compareTotop
public int compareTo(Name other)An arbitrary but consistent complete order among all Names. -
concattop
Return the concatenation of all names in the array `ns'. -
contentEqualstop
public boolean contentEquals(CharSequence cs)Compares this name to the specified CharSequence. The result is true if and only if this name represents the same sequence of char values as the specified sequence.- Specified by:
- contentEquals from Name
-
endsWithtop
public boolean endsWith(Name suffix)Does this name end with suffix? -
equalstop
public boolean equals(Object other)Is this name equal to other? -
equalstop
static private boolean equals(byte[] names, int index, byte[] cs, int start, int len)Is (the utf8 representation of) name equal to cs[start..start+len-1]? -
fromCharstop
Create a name from the characters in cs[start..start+len-1]. -
fromStringtop
Create a name from the characters in char sequence s. -
fromStringtop
Create a name from the characters in string s. -
fromUtftop
Create a name from the bytes in array cs. Assume that bytes are in utf8 format. -
fromUtftop
Create a name from the bytes in cs[start..start+len-1]. Assume that bytes are in utf8 format. -
getBytestop
public void getBytes(byte[] cs, int start)Copy all bytes of this name to buffer cs, starting at start. -
hashCodetop
public int hashCode()Return the hash value of this name. -
hashValuetop
static private int hashValue(byte[] cs, int start, int len)The hashcode of a name. -
indexOftop
public int indexOf(byte b)Returns first occurrence of byte b in this name, len if not found. -
isEmptytop
public boolean isEmpty() -
lastIndexOftop
public int lastIndexOf(byte b)Returns last occurrence of byte b in this name, -1 if not found. -
lengthtop
public int length()Returns the length of this name.- Specified by:
- length from CharSequence
-
lesstop
public boolean less(Name that)Compare this name to other name, yielding -1 if smaller, 0 if equal, 1 if greater. -
replacetop
public Name replace(byte from, byte to)Replace all `from' bytes in this name with `to' bytes. -
startsWithtop
public boolean startsWith(Name prefix)Does this name start with prefix? -
subNametop
public Name subName(int start, int end)Returns the sub-name starting at position start, up to and excluding position end. -
subSequencetop
public CharSequence subSequence(int start, int end)Returns a newCharSequencethat is a subsequence of this sequence. The subsequence starts with thecharvalue at the specified index and ends with thecharvalue at index end - 1. The length (inchars) of the returned sequence is end - start, so if start == end then an empty sequence is returned.- Specified by:
- subSequence from CharSequence
-
toStringtop
public String toString()Return the string representation of this name.- Specified by:
- toString from CharSequence
-
toUtftop
public byte[] toUtf()Return the Utf8 representation of this name.
Fields
-
index
public int indexThe index where the bytes of this name are stored in the global name buffer `names'. -
len
public int lenThe number of bytes in this name. -
next
Name nextThe next name occupying the same hash bucket. -
table
The table structure where the name is stored
