jif.types.label
Class AccessPathConstant

java.lang.Object
  extended by jif.types.label.AccessPath
      extended by jif.types.label.AccessPathRoot
          extended by jif.types.label.AccessPathConstant
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, polyglot.util.Copy

public class AccessPathConstant
extends AccessPathRoot

Represents a final access path consisting of a constant label or principal, that is, either a NewLabel expression or an External principal. For example, "new label {Alice:}" or "Alice". These access paths only arise during method instantiation. For example, given a method

 
    int{*lb} m(label{} lb);
  
 
and a call site
 
    m(new label{Alice:});
  
 
the type system needs to be precise enough to realize that the method call returns an int with label {Alice:}. This is achieved through the use of AccessPathConstants.

See Also:
AccessPath, JifUtil.exprToAccessPath(Expr, JifContext), Serialized Form

Constructor Summary
AccessPathConstant(Label label, polyglot.types.Type type, polyglot.util.Position pos)
           
AccessPathConstant(Principal principal, polyglot.types.Type type, polyglot.util.Position pos)
           
 
Method Summary
 java.lang.Object constantValue()
           
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 boolean isCanonical()
           
 boolean isLabelConstant()
           
 boolean isNeverNull()
           
 boolean isPrincipalConstant()
           
 AccessPath subst(AccessPathRoot r, AccessPath e)
          Return the result of substituting the root r with the access path e.
 java.lang.String toString()
           
 polyglot.types.Type type()
          The type of the access path (when the access path is regarded as an expression).
 
Methods inherited from class jif.types.label.AccessPathRoot
equivalentTo, isUninterpreted, labelcheck, root
 
Methods inherited from class jif.types.label.AccessPath
copy, exprString, position, throwTypes, verify
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AccessPathConstant

public AccessPathConstant(Label label,
                          polyglot.types.Type type,
                          polyglot.util.Position pos)

AccessPathConstant

public AccessPathConstant(Principal principal,
                          polyglot.types.Type type,
                          polyglot.util.Position pos)
Method Detail

constantValue

public java.lang.Object constantValue()

isLabelConstant

public boolean isLabelConstant()

isNeverNull

public boolean isNeverNull()
Specified by:
isNeverNull in class AccessPath

isPrincipalConstant

public boolean isPrincipalConstant()

isCanonical

public boolean isCanonical()
Specified by:
isCanonical in class AccessPath

subst

public AccessPath subst(AccessPathRoot r,
                        AccessPath e)
Description copied from class: AccessPath
Return the result of substituting the root r with the access path e. For example, given a field access path "this.f", substituting the access path root "this" for the access path "o.g" will result in the access path "o.g.f". This method is used to instantiate procedures for calls, and labels of fields.

Specified by:
subst in class AccessPath

toString

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

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in class AccessPath

hashCode

public int hashCode()
Specified by:
hashCode in class AccessPath

type

public polyglot.types.Type type()
Description copied from class: AccessPath
The type of the access path (when the access path is regarded as an expression).

Specified by:
type in class AccessPath