polyglot.ext.jl.types
Class Package_c

java.lang.Object
  extended by polyglot.ext.jl.types.TypeObject_c
      extended by polyglot.ext.jl.types.Package_c
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Named, Package, Qualifier, TypeObject, Copy
Direct Known Subclasses:
UnknownPackage_c

public class Package_c
extends TypeObject_c
implements Package

An PackageType represents a package type. It may or may not be fully qualified. Package types are never canonical and never primitive.

See Also:
Serialized Form

Field Summary
protected  java.lang.String fullname
          The full name is computed lazily from the prefix and name.
protected  java.lang.String name
           
protected  Package prefix
           
 
Fields inherited from class polyglot.ext.jl.types.TypeObject_c
position, ts
 
Constructor Summary
protected Package_c()
          Used for deserializing types.
  Package_c(TypeSystem ts)
           
  Package_c(TypeSystem ts, Package prefix, java.lang.String name)
           
  Package_c(TypeSystem ts, java.lang.String name)
           
 
Method Summary
 boolean equalsImpl(TypeObject o)
          Default implementation is pointer equality.
 java.lang.String fullName()
          Full dotted-name of the type object.
 int hashCode()
           
 boolean isCanonical()
          Return true if the type object contains no unknown/ambiguous types.
 boolean isPackage()
          Return true if the qualifier is a package.
 boolean isType()
          Return true if the qualifier is a type.
 java.lang.String name()
          Simple name of the type object.
 Package prefix()
          The package's outer package.
 Package toPackage()
          Cast the qualifier to a package, or return null.
 java.lang.String toString()
           
 Type toType()
          Cast the qualifier to a type, or return null.
 java.lang.String translate(Resolver c)
          Return a string that is the translation of this package.
 
Methods inherited from class polyglot.ext.jl.types.TypeObject_c
copy, equals, position, typeSystem
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface polyglot.types.TypeObject
position, typeSystem
 
Methods inherited from interface polyglot.util.Copy
copy
 
Methods inherited from interface polyglot.types.TypeObject
position, typeSystem
 
Methods inherited from interface polyglot.util.Copy
copy
 

Field Detail

prefix

protected Package prefix

name

protected java.lang.String name

fullname

protected java.lang.String fullname
The full name is computed lazily from the prefix and name.

Constructor Detail

Package_c

protected Package_c()
Used for deserializing types.


Package_c

public Package_c(TypeSystem ts)

Package_c

public Package_c(TypeSystem ts,
                 java.lang.String name)

Package_c

public Package_c(TypeSystem ts,
                 Package prefix,
                 java.lang.String name)
Method Detail

isType

public boolean isType()
Description copied from interface: Qualifier
Return true if the qualifier is a type.

Specified by:
isType in interface Qualifier

isPackage

public boolean isPackage()
Description copied from interface: Qualifier
Return true if the qualifier is a package.

Specified by:
isPackage in interface Qualifier

toType

public Type toType()
Description copied from interface: Qualifier
Cast the qualifier to a type, or return null. This method will probably be deprecated.

Specified by:
toType in interface Qualifier

toPackage

public Package toPackage()
Description copied from interface: Qualifier
Cast the qualifier to a package, or return null. This method will probably be deprecated.

Specified by:
toPackage in interface Qualifier

prefix

public Package prefix()
Description copied from interface: Package
The package's outer package.

Specified by:
prefix in interface Package

name

public java.lang.String name()
Description copied from interface: Named
Simple name of the type object. Anonymous classes do not have names.

Specified by:
name in interface Named

translate

public java.lang.String translate(Resolver c)
Description copied from interface: Package
Return a string that is the translation of this package.

Specified by:
translate in interface Package
Parameters:
c - A resolver in which to look up the package.

fullName

public java.lang.String fullName()
Description copied from interface: Named
Full dotted-name of the type object. For a package, top level class, top level interface, or primitive type, this is the fully qualified name. For a member class or interface that is directly enclosed in a class or interface with a fully qualified name, then this is the fully qualified name of the member class or interface. For local and anonymous classes, this method returns a string that is not the fully qualified name (as these classes do not have fully qualified names), but that may be suitable for debugging or error messages.

Specified by:
fullName in interface Named

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class TypeObject_c

equalsImpl

public boolean equalsImpl(TypeObject o)
Description copied from class: TypeObject_c
Default implementation is pointer equality.

Specified by:
equalsImpl in interface TypeObject
Overrides:
equalsImpl in class TypeObject_c
See Also:
TypeObject_c.equalsImpl(TypeObject), Object.hashCode()

isCanonical

public boolean isCanonical()
Description copied from interface: TypeObject
Return true if the type object contains no unknown/ambiguous types.

Specified by:
isCanonical in interface TypeObject