ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

javafe.ast
Class Name

java.lang.Object
  extended byjavafe.ast.ASTNode
      extended byjavafe.ast.Name
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
CompoundName, SimpleName

public abstract class Name
extends ASTNode

Treated as an immutable type.

Invariant: There is always at least one element in a Name.


Field Summary
protected static java.lang.String[] emptyStringArray
          Avoid allocating more than one of these.
 
Fields inherited from class javafe.ast.ASTNode
decorations
 
Constructor Summary
protected Name()
          Construct a raw Name whose class invariant(s) have not yet been established.
 
Method Summary
 void check()
           
abstract  boolean equals(java.lang.Object other)
          Return true if other is a Name that is component-wise equal to this.
 int getEndLoc()
          Override getEndLoc so it refers to the actual end of us.
abstract  int hashCode()
          Return a hash code for this such that two Names that are equals have the same hash code.
abstract  Identifier identifierAt(int i)
          Return the ith identifier of this.
abstract  int locDotAfter(int i)
          Return the location of the dot after the ith identifier of this.
abstract  int locIdAt(int i)
          Return the location of the ith identifier of this.
static Name make(int[] locIds, int[] locDots, IdentifierVec ids)
          Make a Name with the given identifiers and locations.
static Name make(java.lang.String N, int loc)
          Make a Name whose locations are all loc from a String.
abstract  Name prefix(int len)
          Return a Name consisting of the first len identifiers of this.
abstract  java.lang.String printName()
          Return our printname, which will be of one of the forms X, X.Y, X.Y.Z, ...
abstract  int size()
          Return the number of identifiers in this.
 java.lang.String[] toStrings()
          Return all identifiers in this in an array.
abstract  java.lang.String[] toStrings(int len)
          Return the first len identifiers in this in an array.
 
Methods inherited from class javafe.ast.ASTNode
accept, accept, childAt, childCount, clone, clone, getDecorations, getStartLoc, getTag, setDecorations, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

emptyStringArray

protected static final java.lang.String[] emptyStringArray
Avoid allocating more than one of these.

Constructor Detail

Name

protected Name()
Construct a raw Name whose class invariant(s) have not yet been established. It is the caller's job to initialize the returned node's fields so that any class invariants hold.

Method Detail

printName

public abstract java.lang.String printName()
Return our printname, which will be of one of the forms X, X.Y, X.Y.Z, ...


hashCode

public abstract int hashCode()
Return a hash code for this such that two Names that are equals have the same hash code.


equals

public abstract boolean equals(java.lang.Object other)
Return true if other is a Name that is component-wise equal to this.


size

public abstract int size()
Return the number of identifiers in this.


identifierAt

public abstract Identifier identifierAt(int i)
Return the ith identifier of this.


locIdAt

public abstract int locIdAt(int i)
Return the location of the ith identifier of this.


locDotAfter

public abstract int locDotAfter(int i)
Return the location of the dot after the ith identifier of this.


toStrings

public abstract java.lang.String[] toStrings(int len)
Return the first len identifiers in this in an array. Requires that len be between 0 and length of this inclusive.


toStrings

public java.lang.String[] toStrings()
Return all identifiers in this in an array.


make

public static Name make(int[] locIds,
                        int[] locDots,
                        IdentifierVec ids)
Make a Name with the given identifiers and locations. Caller must forget about the Vecs/arrays passed here.


make

public static Name make(java.lang.String N,
                        int loc)
Make a Name whose locations are all loc from a String.

This routine parses a non-empty String consisting of a series of dot-separated components into a Name. precondition: N.length()>0


prefix

public abstract Name prefix(int len)
Return a Name consisting of the first len identifiers of this. Requires that len is greater than zero and less than or equal to the length of this.


getEndLoc

public int getEndLoc()
Override getEndLoc so it refers to the actual end of us.

Overrides:
getEndLoc in class ASTNode

check

public void check()
Overrides:
check in class ASTNode

ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

The ESC/Java2 Project Homepage