Class GradeComparisonHelper
java.lang.Object
ch.tocco.nice2.optional.qualification.impl.drools.helper.GradeComparisonHelper
encapsulates any country specific logic used in comparing grades
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
compareGrades
(@Nullable BigDecimal left, @Nullable BigDecimal right) compares grades according toGradeComparisonHelper.ComparisonType
, null is always worse than any other valueboolean
isGradeBetter
(@Nullable BigDecimal left, @Nullable BigDecimal right) boolean
isGradeBetterOrEqual
(@Nullable BigDecimal left, @Nullable BigDecimal right) boolean
isGradeWorse
(@Nullable BigDecimal left, @Nullable BigDecimal right) boolean
isGradeWorseOrEqual
(@Nullable BigDecimal left, @Nullable BigDecimal right) void
setComparisonType
(String mode)
-
Field Details
-
DEFAULT_SORTING_TYPE
-
-
Constructor Details
-
GradeComparisonHelper
public GradeComparisonHelper()
-
-
Method Details
-
setComparisonType
@Value("${nice2.optional.qualification.validate.scaleMode}") public void setComparisonType(String mode) -
getComparisonType
-
isGradeBetter
public boolean isGradeBetter(@Nullable @Nullable BigDecimal left, @Nullable @Nullable BigDecimal right) - Returns:
- returns true if left grade is better (according to current
GradeComparisonHelper.ComparisonType
) than right grade
-
isGradeBetterOrEqual
public boolean isGradeBetterOrEqual(@Nullable @Nullable BigDecimal left, @Nullable @Nullable BigDecimal right) - Returns:
- returns true if left grade is better (according to current
GradeComparisonHelper.ComparisonType
) than or equal to right grade
-
isGradeWorse
public boolean isGradeWorse(@Nullable @Nullable BigDecimal left, @Nullable @Nullable BigDecimal right) - Returns:
- returns true if left grade is worse (according to current
GradeComparisonHelper.ComparisonType
) than right grade
-
isGradeWorseOrEqual
public boolean isGradeWorseOrEqual(@Nullable @Nullable BigDecimal left, @Nullable @Nullable BigDecimal right) - Returns:
- returns true if left grade is worse (according to current
GradeComparisonHelper.ComparisonType
) than or equal to right grade
-
compareGrades
compares grades according toGradeComparisonHelper.ComparisonType
, null is always worse than any other value- Parameters:
left
- first graderight
- second grade- Returns:
- 1 when first grade is better, -1 when second grade is better, 0 when grades are equal
-