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
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompareGrades(@Nullable BigDecimal left, @Nullable BigDecimal right) compares grades according toGradeComparisonHelper.ComparisonType, null is always worse than any other valuebooleanisGradeBetter(@Nullable BigDecimal left, @Nullable BigDecimal right) booleanisGradeBetterOrEqual(@Nullable BigDecimal left, @Nullable BigDecimal right) booleanisGradeWorse(@Nullable BigDecimal left, @Nullable BigDecimal right) booleanisGradeWorseOrEqual(@Nullable BigDecimal left, @Nullable BigDecimal right) voidsetComparisonType(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
-