jif.types
Class LabelSubstitution

java.lang.Object
  extended by jif.types.LabelSubstitution
Direct Known Subclasses:
JifFieldDeclExt_c.InvarianceLabelChecker, JifFieldDeclExt_c.StaticFieldLabelChecker, JifFormalExt.FormalVarianceLabelChecker, JifMethodDeclExt.CovariantLabelChecker, JifProcedureDeclExt_c.ConstraintVarianceLabelChecker, JifSubst_c.SubstLabelSubst, JifTypeNodeDel.StaticLabelChecker, VariableGatherer

public abstract class LabelSubstitution
extends java.lang.Object

The class is a simple Label visitor. It can be used to substitute and check labels and principals. All labels and principals implement a method subst(LabelSubstitution).

In addition, the LabelSubstitution keeps a stack of labels, to record which labels it is in the middle of processing. Labels that recurse on nested labels must push themselves onto the stack before the recursive call, and pop themselves off the stack after the recursive call. Prior to pushing themselves on the stack, labels should examine the stack to see if they already exist in the stack; if so, then the label should not make a recursive call, in order to avoid an infinite loop.

See Also:
Label.subst(LabelSubstitution)

Constructor Summary
LabelSubstitution()
           
 
Method Summary
 void popLabel(Label l)
           
 void pushLabel(Label l)
           
 boolean recurseIntoChildren(Label L)
           
 boolean stackContains(Label l)
           
 AccessPath substAccessPath(AccessPath ap)
           
 Label substLabel(Label L)
           
 Policy substPolicy(Policy p)
           
 Principal substPrincipal(Principal p)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LabelSubstitution

public LabelSubstitution()
Method Detail

substLabel

public Label substLabel(Label L)
                 throws polyglot.types.SemanticException
Throws:
polyglot.types.SemanticException

substPolicy

public Policy substPolicy(Policy p)
                   throws polyglot.types.SemanticException
Throws:
polyglot.types.SemanticException

substPrincipal

public Principal substPrincipal(Principal p)
                         throws polyglot.types.SemanticException
Throws:
polyglot.types.SemanticException

substAccessPath

public AccessPath substAccessPath(AccessPath ap)
                           throws polyglot.types.SemanticException
Throws:
polyglot.types.SemanticException

recurseIntoChildren

public boolean recurseIntoChildren(Label L)

pushLabel

public void pushLabel(Label l)

popLabel

public void popLabel(Label l)

stackContains

public boolean stackContains(Label l)