Class AbstractConstraint<Solution_,Constraint_ extends AbstractConstraint<Solution_,Constraint_,ConstraintFactory_>,ConstraintFactory_ extends InnerConstraintFactory<Solution_,Constraint_>>
- java.lang.Object
-
- org.optaplanner.core.impl.score.stream.common.AbstractConstraint<Solution_,Constraint_,ConstraintFactory_>
-
- All Implemented Interfaces:
Constraint
- Direct Known Subclasses:
BavetConstraint,DroolsConstraint
public abstract class AbstractConstraint<Solution_,Constraint_ extends AbstractConstraint<Solution_,Constraint_,ConstraintFactory_>,ConstraintFactory_ extends InnerConstraintFactory<Solution_,Constraint_>> extends Object implements Constraint
-
-
Field Summary
Fields Modifier and Type Field Description protected ConstraintFactory_constraintFactoryprotected 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_ extends Score<Score_>>
Score_extractConstraintWeight(Solution_ workingSolution)ConstraintFactory_getConstraintFactory()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_,Constraint_> 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_ extends Score<Score_>> 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: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()
-
-