Package: org.apache.groovy.contracts.domain

## [Java] Class LoopInvariant

- org.apache.groovy.contracts.domain.LoopInvariant

-     public class LoopInvariant
      extends Assertion

  A loop-invariant assertion that must hold at the start of each iteration.

  Since:
    6.0.0

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static LoopInvariant` | `DEFAULT` | Shared invariant instance representing an unconstrained loop invariant.

  - ### Constructor Summary

    Constructors
    Constructor and description
    `LoopInvariant()` Creates a loop invariant that defaults to `true`.
    `LoopInvariant(BlockStatement blockStatement, BooleanExpression booleanExpression)` Creates a loop invariant from the supplied source block and boolean expression.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Assertion` | `and, booleanExpression, or, originalBlockStatement, renew`

- - ### Field Detail

    - #### public static final LoopInvariant DEFAULT

      Shared invariant instance representing an unconstrained loop invariant.

  - ### Constructor Detail

    - #### public LoopInvariant()

      Creates a loop invariant that defaults to `true`.

    - #### public LoopInvariant(BlockStatement blockStatement, BooleanExpression booleanExpression)

      Creates a loop invariant from the supplied source block and boolean expression.

      Parameters:
        `blockStatement` - the original invariant block
        `booleanExpression` - the normalized invariant expression