mirror of
https://github.com/furyfire/trueskill.git
synced 2025-05-12 06:07:50 +00:00
More stringable removal for performance.
This commit is contained in:
@ -72,7 +72,7 @@ abstract class FactorGraphLayer
|
||||
*/
|
||||
protected function scheduleSequence(array $itemsToSequence, string $name): ScheduleSequence
|
||||
{
|
||||
return new ScheduleSequence($name, $itemsToSequence);
|
||||
return new ScheduleSequence($itemsToSequence);
|
||||
}
|
||||
|
||||
protected function addLayerFactor(Factor $factor): void
|
||||
|
@ -4,16 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace DNW\Skills\FactorGraphs;
|
||||
|
||||
abstract class Schedule implements \Stringable
|
||||
abstract class Schedule
|
||||
{
|
||||
protected function __construct(private readonly string $name)
|
||||
{
|
||||
}
|
||||
|
||||
abstract public function visit(int $depth = -1, int $maxDepth = 0): float;
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
|
@ -6,9 +6,8 @@ namespace DNW\Skills\FactorGraphs;
|
||||
|
||||
class ScheduleLoop extends Schedule
|
||||
{
|
||||
public function __construct(string $name, private readonly Schedule $scheduleToLoop, private readonly float $maxDelta)
|
||||
public function __construct(private readonly Schedule $scheduleToLoop, private readonly float $maxDelta)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function visit(int $depth = -1, int $maxDepth = 0): float
|
||||
|
@ -9,9 +9,8 @@ class ScheduleSequence extends Schedule
|
||||
/**
|
||||
* @param Schedule[] $schedules
|
||||
*/
|
||||
public function __construct(string $name, private readonly array $schedules)
|
||||
public function __construct(private readonly array $schedules)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function visit(int $depth = -1, int $maxDepth = 0): float
|
||||
|
@ -6,15 +6,12 @@ namespace DNW\Skills\FactorGraphs;
|
||||
|
||||
class ScheduleStep extends Schedule
|
||||
{
|
||||
public function __construct(string $name, private readonly Factor $factor, private readonly int $index)
|
||||
public function __construct(private readonly Factor $factor, private readonly int $index)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function visit(int $depth = -1, int $maxDepth = 0): float
|
||||
{
|
||||
$currentFactor = $this->factor;
|
||||
|
||||
return $currentFactor->updateMessageIndex($this->index);
|
||||
return $this->factor->updateMessageIndex($this->index);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user