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 Description protected ConstraintFactoryconstraintFactoryprotected StringconstraintNameprotected StringconstraintPackageprotected ScoreImpactTypescoreImpactType
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractConstraint(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 Description voidassertCorrectImpact(int impact)voidassertCorrectImpact(long impact)voidassertCorrectImpact(BigDecimal impact)Score<?>extractConstraintWeight(Solution_ workingSolution)ConstraintFactorygetConstraintFactory()TheConstraintFactorythat build this.StringgetConstraintName()The constraint name.StringgetConstraintPackage()The constraint package is the namespace of the constraint.ScoreImpactTypegetScoreImpactType()-
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
-
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:ConstraintTheConstraintFactorythat build this.- Specified by:
getConstraintFactoryin interfaceConstraint- Returns:
- never null
-
getConstraintPackage
public String getConstraintPackage()
Description copied from interface:ConstraintThe constraint package is the namespace of the constraint.When using a
ConstraintConfiguration, it is equal to theConstraintWeight.constraintPackage().- Specified by:
getConstraintPackagein interfaceConstraint- Returns:
- never null
-
getConstraintName
public String getConstraintName()
Description copied from interface:ConstraintThe constraint name. It might not be unique, butConstraint.getConstraintId()is unique.When using a
ConstraintConfiguration, it is equal to theConstraintWeight.value().- Specified by:
getConstraintNamein interfaceConstraint- Returns:
- never null
-
getScoreImpactType
public ScoreImpactType getScoreImpactType()
-
-