diff --git a/rating/src/main/scala/glicko/impl/Rating.scala b/rating/src/main/scala/glicko/impl/Rating.scala index 71d278e99..66c82e826 100644 --- a/rating/src/main/scala/glicko/impl/Rating.scala +++ b/rating/src/main/scala/glicko/impl/Rating.scala @@ -12,33 +12,33 @@ final private[glicko] class Rating( import RatingCalculator.* // the following variables are used to hold values temporarily whilst running calculations - private[glicko] var workingRating: Double = scala.compiletime.uninitialized - private[glicko] var workingRatingDeviation: Double = scala.compiletime.uninitialized - private[glicko] var workingVolatility: Double = scala.compiletime.uninitialized + private[impl] var workingRating: Double = scala.compiletime.uninitialized + private[impl] var workingRatingDeviation: Double = scala.compiletime.uninitialized + private[impl] var workingVolatility: Double = scala.compiletime.uninitialized /** Return the average skill value of the player scaled down to the scale used by the algorithm's internal * workings. */ - def getGlicko2Rating: Double = convertRatingToGlicko2Scale(this.rating) + private[impl] def getGlicko2Rating: Double = convertRatingToGlicko2Scale(this.rating) /** Set the average skill value, taking in a value in Glicko2 scale. */ - def setGlicko2Rating(r: Double) = + private[impl] def setGlicko2Rating(r: Double) = rating = convertRatingToOriginalGlickoScale(r) /** Return the rating deviation of the player scaled down to the scale used by the algorithm's internal * workings. */ - def getGlicko2RatingDeviation: Double = convertRatingDeviationToGlicko2Scale(ratingDeviation) + private[impl] def getGlicko2RatingDeviation: Double = convertRatingDeviationToGlicko2Scale(ratingDeviation) /** Set the rating deviation, taking in a value in Glicko2 scale. */ - def setGlicko2RatingDeviation(rd: Double) = + private[impl] def setGlicko2RatingDeviation(rd: Double) = ratingDeviation = convertRatingDeviationToOriginalGlickoScale(rd) /** Used by the calculation engine, to move interim calculations into their "proper" places. */ - def finaliseRating() = + private[impl] def finaliseRating() = setGlicko2Rating(workingRating) setGlicko2RatingDeviation(workingRatingDeviation) volatility = workingVolatility @@ -46,7 +46,7 @@ final private[glicko] class Rating( workingRating = 0d workingVolatility = 0d - override def toString = f"Rating($rating%1.2f, $ratingDeviation%1.2f, $volatility%1.2f, $numberOfResults)" - - def incrementNumberOfResults(increment: Int) = + private[impl] def incrementNumberOfResults(increment: Int) = numberOfResults = numberOfResults + increment + + override def toString = f"Rating($rating%1.2f, $ratingDeviation%1.2f, $volatility%1.2f, $numberOfResults)" diff --git a/rating/src/main/scala/glicko/impl/RatingCalculator.scala b/rating/src/main/scala/glicko/impl/RatingCalculator.scala index 7326f0788..331cfb494 100644 --- a/rating/src/main/scala/glicko/impl/RatingCalculator.scala +++ b/rating/src/main/scala/glicko/impl/RatingCalculator.scala @@ -85,7 +85,7 @@ final private[glicko] class RatingCalculator( * @param results * @param elapsedRatingPeriods */ - def calculateNewRating(player: Rating, results: List[Result], elapsedRatingPeriods: Double): Unit = + private def calculateNewRating(player: Rating, results: List[Result], elapsedRatingPeriods: Double): Unit = val phi = player.getGlicko2RatingDeviation val sigma = player.volatility val a = Math.log(Math.pow(sigma, 2))