Class GradeComparisonHelper

java.lang.Object
ch.tocco.nice2.optional.qualification.impl.drools.helper.GradeComparisonHelper

@Component public class GradeComparisonHelper extends Object
encapsulates any country specific logic used in comparing grades
  • Field Details

  • Constructor Details

    • GradeComparisonHelper

      public GradeComparisonHelper()
  • Method Details

    • setComparisonType

      @Value("${nice2.optional.qualification.validate.scaleMode}") public void setComparisonType(String mode)
    • getComparisonType

      public GradeComparisonHelper.ComparisonType 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

      public int compareGrades(@Nullable @Nullable BigDecimal left, @Nullable @Nullable BigDecimal right)
      compares grades according to GradeComparisonHelper.ComparisonType, null is always worse than any other value
      Parameters:
      left - first grade
      right - second grade
      Returns:
      1 when first grade is better, -1 when second grade is better, 0 when grades are equal