jif.types.principal

## Class Principal_c

- java.lang.Object
- - polyglot.types.TypeObject_c
  - - jif.types.Param_c
    - - jif.types.principal.Principal_c

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, ActsForParam, Param, Principal, polyglot.types.TypeObject, polyglot.util.Copy<polyglot.types.TypeObject>
  Direct Known Subclasses:
    BottomPrincipal_c, ConjunctivePrincipal_c, DisjunctivePrincipal_c, DynamicPrincipal_c, ExternalPrincipal_c, ParamPrincipal_c, TopPrincipal_c, UnknownPrincipal_c, VarPrincipal_c

      public abstract class Principal_c
      extends Param_c
      implements Principal

  An abstract implementation of the `Principal` interface.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface polyglot.util.Copy

      `polyglot.util.Copy.Util`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.Set<Variable>` | `variables`

    - ### Fields inherited from class polyglot.types.TypeObject_c

      `position, ts`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Principal_c(JifTypeSystem ts, polyglot.util.Position pos)`
    `Principal_c(JifTypeSystem ts, polyglot.util.Position pos, PrincipalToJavaExpr toJava)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract boolean` | `equalsImpl(polyglot.types.TypeObject o)`
    `abstract int` | `hashCode()`
    `boolean` | `hasVariables()` Does the label contain any variables at all? This includes variables that are in bounds of arg labels.
    `boolean` | `isBottomPrincipal()`
    `abstract boolean` | `isCanonical()`
    `abstract boolean` | `isRuntimeRepresentable()`
    `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 substitution)`
    `java.util.List<polyglot.types.Type>` | `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, polyglot.ast.Expr thisQualifier)`
    `java.util.Set<Variable>` | `variables()` The set of variables that this label contains including variables contained in upper bounds of arg labels.

    - ### Methods inherited from class jif.types.Param_c

      `typeSystem`

    - ### Methods inherited from class polyglot.types.TypeObject_c

      `copy, equals, position`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface jif.types.Param

      `typeSystem`

    - ### Methods inherited from interface polyglot.types.TypeObject

      `position`

    - ### Methods inherited from interface polyglot.util.Copy

      `copy`

- - ### Field Detail

    - #### variables

          protected java.util.Set<Variable> variables

  - ### Constructor Detail

    - #### Principal_c

          public Principal_c(JifTypeSystem ts,
                             polyglot.util.Position pos)

    - #### Principal_c

          public Principal_c(JifTypeSystem ts,
                             polyglot.util.Position pos,
                             PrincipalToJavaExpr toJava)

  - ### Method Detail

    - #### toJava

          public polyglot.ast.Expr toJava(JifToJavaRewriter rw,
                                          polyglot.ast.Expr thisQualifier)
                                   throws polyglot.types.SemanticException

      Specified by:
        `toJava` in interface `ActsForParam`
        `thisQualifier` - an Expr representing the translated "this" reference.
      Throws:
        `polyglot.types.SemanticException`

    - #### hasVariables

          public final boolean hasVariables()

      Description copied from interface: `Principal`
      Does the label contain any variables at all? This includes variables that are in bounds of arg labels.
      Specified by:
        `hasVariables` in interface `Principal`

    - #### isTopPrincipal

          public boolean isTopPrincipal()

      Specified by:
        `isTopPrincipal` in interface `Principal`

    - #### isBottomPrincipal

          public boolean isBottomPrincipal()

      Specified by:
        `isBottomPrincipal` in interface `Principal`

    - #### isCanonical

          public abstract boolean isCanonical()

      Specified by:
        `isCanonical` in interface `Param`
      Specified by:
        `isCanonical` in interface `polyglot.types.TypeObject`

    - #### isRuntimeRepresentable

          public abstract boolean isRuntimeRepresentable()

      Specified by:
        `isRuntimeRepresentable` in interface `Param`

    - #### equalsImpl

          public abstract boolean equalsImpl(polyglot.types.TypeObject o)

      Specified by:
        `equalsImpl` in interface `polyglot.types.TypeObject`
      Overrides:
        `equalsImpl` in class `polyglot.types.TypeObject_c`

    - #### hashCode

          public abstract int hashCode()

      Overrides:
        `hashCode` in class `polyglot.types.TypeObject_c`

    - #### throwTypes

          public java.util.List<polyglot.types.Type> throwTypes(polyglot.types.TypeSystem ts)

      Description copied from interface: `Principal`
      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.
      Specified by:
        `throwTypes` in interface `Principal`

    - #### subst

          public Principal subst(LabelSubstitution substitution)
                          throws polyglot.types.SemanticException

      Specified by:
        `subst` in interface `ActsForParam`
      Specified by:
        `subst` in interface `Principal`
      Parameters:
        `substitution` - The `LabelSubstitution` to apply to this principal
      Returns:
        the result of applying labelSubst to this principal.
      Throws:
        `polyglot.types.SemanticException`

    - #### labelCheck

          public PathMap labelCheck(JifContext A,
                                    LabelChecker lc)

      Description copied from interface: `Principal`
      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;
                  }

      Specified by:
        `labelCheck` in interface `Principal`
      See Also:
        `JifExt.labelCheck(LabelChecker)`, `Label.labelCheck(JifContext, LabelChecker)`

    - #### variables

          public java.util.Set<Variable> variables()

      Description copied from interface: `Principal`
      The set of variables that this label contains including variables contained in upper bounds of arg labels.
      Specified by:
        `variables` in interface `Principal`

    - #### simplify

          public Principal simplify()

      Description copied from interface: `Principal`
      Simplify the label, using the actsfor relation if needed
      Specified by:
        `simplify` in interface `ActsForParam`
      Specified by:
        `simplify` in interface `Principal`