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
-
-
Constructor Summary
Constructors Modifier Constructor 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 Description void
assertCorrectImpact(int impact)
void
assertCorrectImpact(long impact)
void
assertCorrectImpact(BigDecimal impact)
<Score_ extends Score<Score_>>
Score_extractConstraintWeight(Solution_ workingSolution)
ConstraintFactory_
getConstraintFactory()
TheConstraintFactory
that build this.String
getConstraintId()
The constraint id isthe constraint package
concatenated with "/" andthe constraint name
.String
getConstraintName()
The constraint name.String
getConstraintPackage()
The constraint package is the namespace of the constraint.ScoreImpactType
getScoreImpactType()
-
-
-
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 final void assertCorrectImpact(int impact)
-
assertCorrectImpact
public final void assertCorrectImpact(long impact)
-
assertCorrectImpact
public final void assertCorrectImpact(BigDecimal impact)
-
getConstraintFactory
public final ConstraintFactory_ getConstraintFactory()
Description copied from interface:Constraint
TheConstraintFactory
that build this.- Specified by:
getConstraintFactory
in interfaceConstraint
- Returns:
- never null
-
getConstraintPackage
public final String getConstraintPackage()
Description copied from interface:Constraint
The constraint package is the namespace of the constraint.When using a
ConstraintConfiguration
, it is equal to theConstraintWeight.constraintPackage()
.- Specified by:
getConstraintPackage
in interfaceConstraint
- Returns:
- never null
-
getConstraintName
public final String getConstraintName()
Description copied from interface:Constraint
The constraint name. It might not be unique, butConstraint.getConstraintId()
is unique.When using a
ConstraintConfiguration
, it is equal to theConstraintWeight.value()
.- Specified by:
getConstraintName
in interfaceConstraint
- Returns:
- never null
-
getConstraintId
public final String getConstraintId()
Description copied from interface:Constraint
The constraint id isthe constraint package
concatenated with "/" andthe constraint name
. It is unique.- Specified by:
getConstraintId
in interfaceConstraint
- Returns:
- never null
-
getScoreImpactType
public final ScoreImpactType getScoreImpactType()
-
-