jif.types.label

## Class Label_c

- java.lang.Object
- - polyglot.types.TypeObject_c
  - - jif.types.Param_c
    - - jif.types.label.Label_c

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, ActsForParam, Label, Param, polyglot.types.TypeObject, polyglot.util.Copy<polyglot.types.TypeObject>
  Direct Known Subclasses:
    ArgLabel_c, CovariantParamLabel_c, DynamicLabel_c, JoinLabel_c, MeetLabel_c, NotTaken_c, PairLabel_c, ParamLabel_c, ProviderLabel_c, ThisLabel_c, UnknownLabel_c, VarLabel_c, WritersToReadersLabel_c

      public abstract class Label_c
      extends Param_c
      implements Label

  An abstract implementation of the `Label` 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.lang.String` | `description`
    `protected LabelToJavaExpr` | `toJava`
    `protected java.util.Set<Variable>` | `variables`

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

      `position, ts`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Label_c()`
    `` | `Label_c(JifTypeSystem ts, polyglot.util.Position pos)`
    `` | `Label_c(JifTypeSystem ts, polyglot.util.Position pos, LabelToJavaExpr toJava)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `componentString()` Equivalent to componentString(emptySet)
    `abstract java.lang.String` | `componentString(java.util.Set<Label> printedLabels)` return a string s such that {s} is a label
    `ConfPolicy` | `confProjection()`
    `Label_c` | `copy()`
    `java.lang.String` | `description()`
    `abstract boolean` | `equalsImpl(polyglot.types.TypeObject t)`
    `boolean` | `hasVariableComponents()` Does the label contain any variables as components? This does not include variables that are in bounds of arg labels.
    `boolean` | `hasVariables()` Does the label contain any variables at all? This includes variables that are in bounds of arg labels.
    `boolean` | `hasWritersToReaders()` Does the label contain any writersToReaders constructs?
    `IntegPolicy` | `integProjection()`
    `boolean` | `isBottom()` By default, a label is not Bottom
    `boolean` | `isDisambiguated()` Are the components of this label all disambiguated?
    `protected abstract boolean` | `isDisambiguatedImpl()` Check if the label is disambiguated, without recursing into child labels.
    `boolean` | `isInvariant()` Is this label invariant?
    `boolean` | `isTop()` Is this label equivalent to top?
    `PathMap` | `labelCheck(JifContext A, LabelChecker lc)` Label check the label, which will determine how much information may be gained if the label is evaluated at runtime.
    `Label` | `normalize()` Normalize the label.
    `void` | `setDescription(java.lang.String d)`
    `Label` | `simplify()` Simplify the label, using leq if needed
    `protected Label` | `simplifyImpl()`
    `Label` | `subst(LabelSubstitution substitution)`
    `java.util.List<polyglot.types.Type>` | `throwTypes(polyglot.types.TypeSystem ts)` If the label is runtime representable, when it is evaluated at runtime it may throw exceptions.
    `polyglot.ast.Expr` | `toJava(JifToJavaRewriter rw, polyglot.ast.Expr thisQualifier)`
    `polyglot.ast.Expr` | `toJava(JifToJavaRewriter rw, polyglot.ast.Expr thisQualifier, boolean simplify)`
    `java.lang.String` | `toString()` Equivalent to toString(emptySet).
    `java.lang.String` | `toString(java.util.Set<Label> printedLabels)` return a string representation of the label.
    `java.util.Set<Variable>` | `variableComponents()` The set of variables that this label contains as components.
    `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

      `equals, hashCode, position`

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

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

    - ### Methods inherited from interface jif.types.label.Label

      `isComparable, isCovariant, isEnumerable, isRuntimeRepresentable, leq_`

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

      `isCanonical, typeSystem`

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

      `position`

- - ### Field Detail

    - #### description

          protected java.lang.String description

    - #### toJava

          protected LabelToJavaExpr toJava

    - #### variables

          protected java.util.Set<Variable> variables

  - ### Constructor Detail

    - #### Label_c

          protected Label_c()

    - #### Label_c

          public Label_c(JifTypeSystem ts,
                         polyglot.util.Position pos,
                         LabelToJavaExpr toJava)

    - #### Label_c

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

  - ### Method Detail

    - #### copy

          public Label_c copy()

      Specified by:
        `copy` in interface `Label`
      Specified by:
        `copy` in interface `polyglot.util.Copy<polyglot.types.TypeObject>`
      Overrides:
        `copy` in class `polyglot.types.TypeObject_c`

    - #### description

          public java.lang.String description()

      Specified by:
        `description` in interface `Label`

    - #### setDescription

          public void setDescription(java.lang.String d)

      Specified by:
        `setDescription` in interface `Label`

    - #### hasVariableComponents

          public boolean hasVariableComponents()

      Description copied from interface: `Label`
      Does the label contain any variables as components? This does not include variables that are in bounds of arg labels.
      Specified by:
        `hasVariableComponents` in interface `Label`

    - #### hasVariables

          public final boolean hasVariables()

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

    - #### hasWritersToReaders

          public boolean hasWritersToReaders()

      Description copied from interface: `Label`
      Does the label contain any writersToReaders constructs?
      Specified by:
        `hasWritersToReaders` in interface `Label`

    - #### variables

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

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

    - #### 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`

    - #### toJava

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

      Specified by:
        `toJava` in interface `Label`
        `thisQualifier` - an Expr representing the translated "this" reference.
        `simplify` - whether to attempt to simplify the label when it's constructed at run time.
      Throws:
        `polyglot.types.SemanticException`

    - #### isBottom

          public boolean isBottom()

      By default, a label is not Bottom
      Specified by:
        `isBottom` in interface `Label`

    - #### isTop

          public boolean isTop()

      Description copied from interface: `Label`
      Is this label equivalent to top?

      For example, a JoinLabel with two components, one of which is Top, would return true for this method.

      Specified by:
        `isTop` in interface `Label`

    - #### isInvariant

          public boolean isInvariant()

      Description copied from interface: `Label`
      Is this label invariant?
      Specified by:
        `isInvariant` in interface `Label`

    - #### isDisambiguatedImpl

          protected abstract boolean isDisambiguatedImpl()

      Check if the label is disambiguated, without recursing into child labels.

    - #### isDisambiguated

          public final boolean isDisambiguated()

      Description copied from interface: `Label`
      Are the components of this label all disambiguated?
      Specified by:
        `isDisambiguated` in interface `Label`

    - #### toString

          public java.lang.String toString()

      Description copied from interface: `Label`
      Equivalent to toString(emptySet).
      Specified by:
        `toString` in interface `Label`
      Overrides:
        `toString` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString(java.util.Set<Label> printedLabels)

      Description copied from interface: `Label`
      return a string representation of the label.
      Specified by:
        `toString` in interface `Label`
      Parameters:
        `printedLabels` - the set of labels for which auxiliary information should be omitted.

    - #### componentString

          public java.lang.String componentString()

      Description copied from interface: `Label`
      Equivalent to componentString(emptySet)
      Specified by:
        `componentString` in interface `Label`

    - #### componentString

          public abstract java.lang.String componentString(java.util.Set<Label> printedLabels)

      Description copied from interface: `Label`
      return a string s such that {s} is a label
      Specified by:
        `componentString` in interface `Label`
      Parameters:
        `printedLabels` - the set of labels for which auxiliary information should be omitted.

    - #### equalsImpl

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

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

    - #### simplify

          public final Label simplify()

      Description copied from interface: `Label`
      Simplify the label, using leq if needed
      Specified by:
        `simplify` in interface `ActsForParam`
      Specified by:
        `simplify` in interface `Label`

    - #### simplifyImpl

          protected Label simplifyImpl()

    - #### normalize

          public Label normalize()

      Description copied from interface: `Label`
      Normalize the label. Essentially, simplify as much as possible without using the leq ordering
      Specified by:
        `normalize` in interface `Label`

    - #### confProjection

          public ConfPolicy confProjection()

      Specified by:
        `confProjection` in interface `Label`

    - #### integProjection

          public IntegPolicy integProjection()

      Specified by:
        `integProjection` in interface `Label`

    - #### throwTypes

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

      Description copied from interface: `Label`
      If the label 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 label may produce. If the label cannot be evaluated at runtime, an empty list should be returned.
      Specified by:
        `throwTypes` in interface `Label`

    - #### subst

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

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

    - #### labelCheck

          public PathMap labelCheck(JifContext A,
                                    LabelChecker lc)

      Description copied from interface: `Label`
      Label check the label, which will determine how much information may be gained if the label is evaluated at runtime. For example, given the dynamic label {*lb}, where lb is a local variable, evaluation of this label at runtime will reveal as much information as the label of lb. For example, the following code is illegal, as the runtime evaluation of the label reveals too much information

            boolean{Alice:} secret = ...;
            final label{Alice:} lb = secret?new label{}:new label{Bob:};
            boolean{} leak = false;
            if ((*lb} <= new label{}) { // evaluation of lb reveals
                                     // information at level {Alice:}
               leak = true;
            }

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

    - #### variableComponents

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

      Description copied from interface: `Label`
      The set of variables that this label contains as components. This is a subset of variables(), since it does not count var labels contained in upper bounds of arg labels.
      Specified by:
        `variableComponents` in interface `Label`