org.optaplanner.core.impl.score.stream.common

## Class AbstractConstraint<Solution_,ConstraintFactory extends InnerConstraintFactory<Solution_>>

- java.lang.Object
- - org.optaplanner.core.impl.score.stream.common.AbstractConstraint<Solution_,ConstraintFactory>

- All Implemented Interfaces:
    Constraint
  Direct Known Subclasses:
    BavetConstraint, DroolsConstraint

      public abstract class AbstractConstraint<Solution_,ConstraintFactory extends InnerConstraintFactory<Solution_>>
      extends Object
      implements Constraint

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ConstraintFactory` | `constraintFactory`
    `protected String` | `constraintName`
    `protected String` | `constraintPackage`
    `protected ScoreImpactType` | `scoreImpactType`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractConstraint(ConstraintFactory constraintFactory, String constraintPackage, String constraintName, Function<Solution_,Score<?>> constraintWeightExtractor, ScoreImpactType scoreImpactType, boolean isConstraintWeightConfigurable)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `assertCorrectImpact(BigDecimal impact)`
    `void` | `assertCorrectImpact(int impact)`
    `void` | `assertCorrectImpact(long impact)`
    `Score<?>` | `extractConstraintWeight(Solution_ workingSolution)`
    `ConstraintFactory` | `getConstraintFactory()` The `ConstraintFactory` that build this.
    `String` | `getConstraintName()` The constraint name.
    `String` | `getConstraintPackage()` The constraint package is the namespace of the constraint.
    `ScoreImpactType` | `getScoreImpactType()`

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

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

    - ### Methods inherited from interface org.optaplanner.core.api.score.stream.Constraint

      `getConstraintId`

- - ### Field Detail

    - #### constraintFactory

          protected final ConstraintFactory extends InnerConstraintFactory<Solution_> constraintFactory

    - #### constraintPackage

          protected final String constraintPackage

    - #### constraintName

          protected final String constraintName

    - #### scoreImpactType

          protected final ScoreImpactType scoreImpactType

  - ### Constructor Detail

    - #### AbstractConstraint

          protected AbstractConstraint(ConstraintFactory constraintFactory,
                                       String constraintPackage,
                                       String constraintName,
                                       Function<Solution_,Score<?>> constraintWeightExtractor,
                                       ScoreImpactType scoreImpactType,
                                       boolean isConstraintWeightConfigurable)

  - ### Method Detail

    - #### extractConstraintWeight

          public final Score<?> extractConstraintWeight(Solution_ workingSolution)

    - #### assertCorrectImpact

          public void assertCorrectImpact(int impact)

    - #### assertCorrectImpact

          public void assertCorrectImpact(long impact)

    - #### assertCorrectImpact

          public void assertCorrectImpact(BigDecimal impact)

    - #### getConstraintFactory

          public ConstraintFactory getConstraintFactory()

      Description copied from interface: `Constraint`
      The `ConstraintFactory` that build this.
      Specified by:
        `getConstraintFactory` in interface `Constraint`
      Returns:
        never null

    - #### getConstraintPackage

          public String getConstraintPackage()

      Description copied from interface: `Constraint`
      The constraint package is the namespace of the constraint.

      When using a `ConstraintConfiguration`, it is equal to the `ConstraintWeight.constraintPackage()`.

      Specified by:
        `getConstraintPackage` in interface `Constraint`
      Returns:
        never null

    - #### getConstraintName

          public String getConstraintName()

      Description copied from interface: `Constraint`
      The constraint name. It might not be unique, but `Constraint.getConstraintId()` is unique.

      When using a `ConstraintConfiguration`, it is equal to the `ConstraintWeight.value()`.

      Specified by:
        `getConstraintName` in interface `Constraint`
      Returns:
        never null

    - #### getScoreImpactType

          public ScoreImpactType getScoreImpactType()

Copyright © 2006–2021 JBoss by Red Hat. All rights reserved.