|
<?php
|
|
|
|
namespace Automata\Storage;
|
|
|
|
use Automata\Tool;
|
|
|
|
class ToolMemory
|
|
{
|
|
/** @var Tool[] */
|
|
private array $memory = [];
|
|
|
|
|
|
public function save(Tool $tool): void
|
|
{
|
|
$this->memory[$tool->T] = $tool;
|
|
}
|
|
|
|
|
|
public function read(int $T): ?Tool
|
|
{
|
|
return @$this->memory[$T];
|
|
}
|
|
}
|