com.sun.tools.javac.util
Class Name

java.lang.Object
  extended by com.sun.tools.javac.util.Name
All Implemented Interfaces:
java.lang.CharSequence, Name
Direct Known Subclasses:
SharedNameTable.NameImpl, UnsharedNameTable.NameImpl

public abstract class Name
extends java.lang.Object
implements Name

An abstraction for internal compiler strings. They are stored in Utf8 format. Names are stored in a Name.Table, and are unique within that table.

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.


Nested Class Summary
static class Name.Table
          An abstraction for the hash table used to create unique Name instances.
 
Field Summary
 Name.Table table
           
 
Constructor Summary
protected Name(Name.Table table)
           
 
Method Summary
 Name append(char c, Name n)
          Return the concatenation of this name, the given ASCII character, and name `n'.
 Name append(Name n)
          Return the concatenation of this name and name `n'.
 char charAt(int index)
           
 int compareTo(Name other)
          An arbitrary but consistent complete order among all Names.
 boolean contentEquals(java.lang.CharSequence cs)
          Compares this name to the specified CharSequence.
abstract  byte[] getByteArray()
          Get the underlying byte array for this name.
abstract  byte getByteAt(int i)
          Returns i'th byte of this name.
abstract  int getByteLength()
          Get the length (in bytes) of this name.
abstract  int getByteOffset()
          Get the start offset of this name within its byte array.
 void getBytes(byte[] cs, int start)
          Copy all bytes of this name to buffer cs, starting at start.
abstract  int getIndex()
           
 boolean isEmpty()
          Return true if this is the empty name.
 int lastIndexOf(byte b)
          Returns last occurrence of byte b in this name, -1 if not found.
 int length()
           
 boolean startsWith(Name prefix)
          Does this name start with prefix?
 Name subName(int start, int end)
          Returns the sub-name starting at position start, up to and excluding position end.
 java.lang.CharSequence subSequence(int start, int end)
           
 java.lang.String toString()
          Return the string representation of this name.
 byte[] toUtf()
          Return the Utf8 representation of this name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.lang.model.element.Name
equals, hashCode
 

Field Detail

table

public final Name.Table table
Constructor Detail

Name

protected Name(Name.Table table)
Method Detail

contentEquals

public boolean contentEquals(java.lang.CharSequence cs)
Description copied from interface: Name
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 in interface Name
Parameters:
cs - The sequence to compare this name against
Returns:
true if this name represents the same sequence of char values as the specified sequence, false otherwise
See Also:
String.contentEquals(CharSequence)

length

public int length()
Specified by:
length in interface java.lang.CharSequence

charAt

public char charAt(int index)
Specified by:
charAt in interface java.lang.CharSequence

subSequence

public java.lang.CharSequence subSequence(int start,
                                          int end)
Specified by:
subSequence in interface java.lang.CharSequence

append

public Name append(Name n)
Return the concatenation of this name and name `n'.


append

public Name append(char c,
                   Name n)
Return the concatenation of this name, the given ASCII character, and name `n'.


compareTo

public int compareTo(Name other)
An arbitrary but consistent complete order among all Names.


isEmpty

public boolean isEmpty()
Return true if this is the empty name.


lastIndexOf

public int lastIndexOf(byte b)
Returns last occurrence of byte b in this name, -1 if not found.


startsWith

public boolean startsWith(Name prefix)
Does this name start with prefix?


subName

public Name subName(int start,
                    int end)
Returns the sub-name starting at position start, up to and excluding position end.


toString

public java.lang.String toString()
Return the string representation of this name.

Specified by:
toString in interface java.lang.CharSequence
Overrides:
toString in class java.lang.Object

toUtf

public byte[] toUtf()
Return the Utf8 representation of this name.


getIndex

public abstract int getIndex()

getByteLength

public abstract int getByteLength()
Get the length (in bytes) of this name.


getByteAt

public abstract byte getByteAt(int i)
Returns i'th byte of this name.


getBytes

public void getBytes(byte[] cs,
                     int start)
Copy all bytes of this name to buffer cs, starting at start.


getByteArray

public abstract byte[] getByteArray()
Get the underlying byte array for this name. The contents of the array must not be modified.


getByteOffset

public abstract int getByteOffset()
Get the start offset of this name within its byte array.