More stringable removal for performance.

This commit is contained in:
2024-03-19 15:48:29 +00:00
parent ae5d2a8b73
commit bbff1fbbbc
11 changed files with 34 additions and 61 deletions

View File

@ -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

View File

@ -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;
}
}

View File

@ -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

View File

@ -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

View File

@ -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);
}
}