mirror of
https://github.com/furyfire/trueskill.git
synced 2025-04-19 20:34:28 +00:00
No more use of $_ to mark private members.
This commit is contained in:
@ -4,13 +4,13 @@ namespace DNW\Skills\FactorGraphs;
|
||||
|
||||
class KeyedVariable extends Variable
|
||||
{
|
||||
public function __construct(private mixed $_key, string $name, mixed $prior)
|
||||
public function __construct(private mixed $key, string $name, mixed $prior)
|
||||
{
|
||||
parent::__construct($name, $prior);
|
||||
}
|
||||
|
||||
public function getKey(): mixed
|
||||
{
|
||||
return $this->_key;
|
||||
return $this->key;
|
||||
}
|
||||
}
|
||||
|
@ -4,22 +4,22 @@ namespace DNW\Skills\FactorGraphs;
|
||||
|
||||
class Message implements \Stringable
|
||||
{
|
||||
public function __construct(private $_value = null, private $_name = null)
|
||||
public function __construct(private $value = null, private $name = null)
|
||||
{
|
||||
}
|
||||
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return (string) $this->_name;
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ namespace DNW\Skills\FactorGraphs;
|
||||
|
||||
class ScheduleLoop extends Schedule
|
||||
{
|
||||
public function __construct($name, private readonly Schedule $_scheduleToLoop, private $_maxDelta)
|
||||
public function __construct($name, private readonly Schedule $scheduleToLoop, private $maxDelta)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
@ -12,9 +12,9 @@ class ScheduleLoop extends Schedule
|
||||
public function visit(int $depth = -1, int $maxDepth = 0)
|
||||
{
|
||||
$totalIterations = 1;
|
||||
$delta = $this->_scheduleToLoop->visit($depth + 1, $maxDepth);
|
||||
while ($delta > $this->_maxDelta) {
|
||||
$delta = $this->_scheduleToLoop->visit($depth + 1, $maxDepth);
|
||||
$delta = $this->scheduleToLoop->visit($depth + 1, $maxDepth);
|
||||
while ($delta > $this->maxDelta) {
|
||||
$delta = $this->scheduleToLoop->visit($depth + 1, $maxDepth);
|
||||
$totalIterations++;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ namespace DNW\Skills\FactorGraphs;
|
||||
|
||||
class ScheduleSequence extends Schedule
|
||||
{
|
||||
public function __construct($name, private readonly array $_schedules)
|
||||
public function __construct($name, private readonly array $schedules)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
@ -13,7 +13,7 @@ class ScheduleSequence extends Schedule
|
||||
{
|
||||
$maxDelta = 0;
|
||||
|
||||
$schedules = $this->_schedules;
|
||||
$schedules = $this->schedules;
|
||||
foreach ($schedules as $currentSchedule) {
|
||||
$currentVisit = $currentSchedule->visit($depth + 1, $maxDepth);
|
||||
$maxDelta = max($currentVisit, $maxDelta);
|
||||
|
@ -4,15 +4,15 @@ namespace DNW\Skills\FactorGraphs;
|
||||
|
||||
class ScheduleStep extends Schedule
|
||||
{
|
||||
public function __construct($name, private readonly Factor $_factor, private $_index)
|
||||
public function __construct($name, private readonly Factor $factor, private $index)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function visit(int $depth = -1, int $maxDepth = 0)
|
||||
{
|
||||
$currentFactor = $this->_factor;
|
||||
$currentFactor = $this->factor;
|
||||
|
||||
return $currentFactor->updateMessageIndex($this->_index);
|
||||
return $currentFactor->updateMessageIndex($this->index);
|
||||
}
|
||||
}
|
||||
|
@ -4,20 +4,20 @@ namespace DNW\Skills\FactorGraphs;
|
||||
|
||||
class VariableFactory
|
||||
{
|
||||
public function __construct(private $_variablePriorInitializer)
|
||||
public function __construct(private $variablePriorInitializer)
|
||||
{
|
||||
}
|
||||
|
||||
public function createBasicVariable(string $name): Variable
|
||||
{
|
||||
$initializer = $this->_variablePriorInitializer;
|
||||
$initializer = $this->variablePriorInitializer;
|
||||
|
||||
return new Variable($name, $initializer());
|
||||
}
|
||||
|
||||
public function createKeyedVariable(mixed $key, string $name): KeyedVariable
|
||||
{
|
||||
$initializer = $this->_variablePriorInitializer;
|
||||
$initializer = $this->variablePriorInitializer;
|
||||
|
||||
return new KeyedVariable($key, $name, $initializer());
|
||||
}
|
||||
|
Reference in New Issue
Block a user