mirror of
https://github.com/furyfire/trueskill.git
synced 2025-01-15 17:37:39 +00:00
use of static in Range implementation.
This commit is contained in:
@ -9,7 +9,7 @@ use Exception;
|
||||
|
||||
class Range
|
||||
{
|
||||
public function __construct(private int $min, private int $max)
|
||||
final public function __construct(private int $min, private int $max)
|
||||
{
|
||||
if ($min > $max) {
|
||||
throw new Exception('min > max');
|
||||
@ -26,9 +26,9 @@ class Range
|
||||
return $this->max;
|
||||
}
|
||||
|
||||
protected static function create(int $min, int $max): self
|
||||
protected static function create(int $min, int $max): static
|
||||
{
|
||||
return new Range($min, $max);
|
||||
return new static($min, $max);
|
||||
}
|
||||
|
||||
// REVIEW: It's probably bad form to have access statics via a derived class, but the syntax looks better :-)
|
||||
|
@ -6,8 +6,8 @@ use DNW\Skills\Numerics\Range;
|
||||
|
||||
class PlayersRange extends Range
|
||||
{
|
||||
protected static function create(int $min, int $max): self
|
||||
protected static function create(int $min, int $max): static
|
||||
{
|
||||
return new PlayersRange($min, $max);
|
||||
return new static($min, $max);
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,8 @@ use DNW\Skills\Numerics\Range;
|
||||
|
||||
class TeamsRange extends Range
|
||||
{
|
||||
protected static function create(int $min, int $max): self
|
||||
protected static function create(int $min, int $max): static
|
||||
{
|
||||
return new TeamsRange($min, $max);
|
||||
return new static($min, $max);
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,6 @@ class PlayerPriorValuesToSkillsLayer extends TrueSkillFactorGraphLayer
|
||||
|
||||
private function createPriorFactor(Rating $priorRating, Variable $skillsVariable): GaussianPriorFactor
|
||||
{
|
||||
echo (get_class($this->getParentFactorGraph()).PHP_EOL);
|
||||
return new GaussianPriorFactor(
|
||||
$priorRating->getMean(),
|
||||
BasicMath::square($priorRating->getStandardDeviation()) +
|
||||
|
Reference in New Issue
Block a user