jif.types.principal
Interface Principal

All Superinterfaces:
java.lang.Cloneable, polyglot.util.Copy, Param, java.io.Serializable, polyglot.types.TypeObject
All Known Subinterfaces:
BottomPrincipal, ConjunctivePrincipal, DisjunctivePrincipal, DynamicPrincipal, ExternalPrincipal, ParamPrincipal, TopPrincipal, UnknownPrincipal, VarPrincipal
All Known Implementing Classes:
BottomPrincipal_c, ConjunctivePrincipal_c, DisjunctivePrincipal_c, DynamicPrincipal_c, ExternalPrincipal_c, ParamPrincipal_c, Principal_c, TopPrincipal_c, UnknownPrincipal_c, VarPrincipal_c

public interface Principal
extends Param

The root interface of all kinds of Jif principals.


Method Summary
 boolean hasVariables()
          Does the label contain any variables at all? This includes variables that are in bounds of arg labels.
 boolean isBottomPrincipal()
           
 boolean isTopPrincipal()
           
 PathMap labelCheck(JifContext A, LabelChecker lc)
          Label check the principal, which will determine how much information may be gained if the principal is evaluated at runtime.
 Principal simplify()
          Simplify the label, using the actsfor relation if needed
 Principal subst(LabelSubstitution labelSubst)
           
 java.util.List throwTypes(polyglot.types.TypeSystem ts)
          If the principal is runtime representable, when it is evaluated at runtime it may throw exceptions.
 polyglot.ast.Expr toJava(JifToJavaRewriter rw)
           
 java.util.Set variables()
          The set of variables that this label contains including variables contained in upper bounds of arg labels.
 
Methods inherited from interface jif.types.Param
isCanonical, isRuntimeRepresentable
 
Methods inherited from interface polyglot.types.TypeObject
equalsImpl, position, typeSystem
 
Methods inherited from interface polyglot.util.Copy
copy
 

Method Detail

subst

Principal subst(LabelSubstitution labelSubst)
                throws polyglot.types.SemanticException
Parameters:
labelSubst - The LabelSubstitution to apply to this principal
Returns:
the result of applying labelSubst to this principal.
Throws:
polyglot.types.SemanticException

labelCheck

PathMap labelCheck(JifContext A,
                   LabelChecker lc)
Label check the principal, which will determine how much information may be gained if the principal is evaluated at runtime. For example, given the dynamic principal p, where p is a local variable, evaluation of this label at runtime will reveal as much information as the label of p. For example, the following code is illegal, as the runtime evaluation of the principal reveals too much information
 boolean{Alice:} secret = ...;
 final principal{Alice:} p = secret?Bob:Chuck;
 boolean{} leak = false;
 if (p actsfor Bob) { // evaluation of p reveals
                      // information at level {Alice:}
     leak = true;
        } 
 

See Also:
Jif.labelCheck(LabelChecker), Label.labelCheck(JifContext, LabelChecker)

toJava

polyglot.ast.Expr toJava(JifToJavaRewriter rw)
                         throws polyglot.types.SemanticException
Throws:
polyglot.types.SemanticException

throwTypes

java.util.List throwTypes(polyglot.types.TypeSystem ts)
If the principal is runtime representable, when it is evaluated at runtime it may throw exceptions. This method returns a list of the exceptions that the runtime evaluation of the principal may produce. If the principal cannot be evaluated at runtime, an empty list should be returned.


hasVariables

boolean hasVariables()
Does the label contain any variables at all? This includes variables that are in bounds of arg labels.


variables

java.util.Set variables()
The set of variables that this label contains including variables contained in upper bounds of arg labels.


isTopPrincipal

boolean isTopPrincipal()

isBottomPrincipal

boolean isBottomPrincipal()

simplify

Principal simplify()
Simplify the label, using the actsfor relation if needed