jif.types

## Class Constraint

- java.lang.Object
- - jif.types.Constraint

- Direct Known Subclasses:
    LabelConstraint, PrincipalConstraint

      public abstract class Constraint
      extends java.lang.Object

  A `Constraint` is the superclass of label constraints and principals constraints, which are generated during type checking and label checking.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Constraint.Kind` Kinds of constraint, either equality or inequality.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected LabelEnv` | `env` The environment under which this constraint needs to be satisfied.
    `protected Constraint.Kind` | `kind`
    `protected Param` | `lhs`
    `protected ConstraintMessage` | `messages` Error messages
    `protected polyglot.util.Position` | `pos`
    `protected boolean` | `report` Do we want to report a violation of this constraint, or report the error for a different constraint?
    `protected Param` | `rhs`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Constraint(Param lhs, Constraint.Kind kind, Param rhs, LabelEnv env, polyglot.util.Position pos, ConstraintMessage msg, boolean report)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `detailMsg()` A detailed message to display if this constraint is violated.
    `LabelEnv` | `env()`
    `abstract java.util.Collection<Equation>` | `getEquations()` Produce a `Collection` of `Equations` for this constraint.
    `abstract boolean` | `hasVariables()`
    `boolean` | `isCanonical()`
    `Constraint.Kind` | `kind()`
    `ConstraintMessage` | `messages()`
    `java.lang.String` | `msg()` A message to display if this constraint is violated.
    `polyglot.util.Position` | `position()`
    `boolean` | `report()`
    `java.lang.String` | `technicalMsg()` A technical message to display if this constraint is violated.
    `java.lang.String` | `toString()`

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

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

- - ### Field Detail

    - #### lhs

          protected final Param lhs

    - #### rhs

          protected final Param rhs

    - #### kind

          protected final Constraint.Kind kind

    - #### env

          protected final LabelEnv env

      The environment under which this constraint needs to be satisfied.

    - #### pos

          protected final polyglot.util.Position pos

    - #### messages

          protected final ConstraintMessage messages

      Error messages

    - #### report

          protected final boolean report

      Do we want to report a violation of this constraint, or report the error for a different constraint?

  - ### Constructor Detail

    - #### Constraint

          public Constraint(Param lhs,
                            Constraint.Kind kind,
                            Param rhs,
                            LabelEnv env,
                            polyglot.util.Position pos,
                            ConstraintMessage msg,
                            boolean report)

  - ### Method Detail

    - #### kind

          public Constraint.Kind kind()

    - #### env

          public LabelEnv env()

    - #### position

          public polyglot.util.Position position()

    - #### report

          public boolean report()

    - #### messages

          public ConstraintMessage messages()

    - #### msg

          public java.lang.String msg()

      A message to display if this constraint is violated. This message should be short, and explain without using typing rules what this constraint represents. It should not refer to the names of labels (i.e., names for `NamedLabel`s.

    - #### detailMsg

          public java.lang.String detailMsg()

      A detailed message to display if this constraint is violated. This message may consist of several sentences, and may refer to the names of the labels, if `NamedLabel`s are used.

    - #### technicalMsg

          public java.lang.String technicalMsg()

      A technical message to display if this constraint is violated. This message can refer to typing rules to explain what the constraint represents, and to names of labels, if `NamedLabel`s are used.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getEquations

          public abstract java.util.Collection<Equation> getEquations()

      Produce a `Collection` of `Equations` for this constraint.

    - #### isCanonical

          public boolean isCanonical()

    - #### hasVariables

          public abstract boolean hasVariables()