Initial commit
This commit is contained in:
23
src/Automata/Storage/ToolMemory.php
Normal file
23
src/Automata/Storage/ToolMemory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user