コード例 #1
0
 /**
  * @param ArrayContainer $input
  * @param ArrayContainer $output
  * @param MemoryContainer $memory
  * @param ArrayContainer $program
  */
 public function prepareResponse(ArrayContainer $input, ArrayContainer $output, MemoryContainer $memory, ArrayContainer $program)
 {
     $this->variables['input'] = implode(array_map([$this, "formatCharacter"], $input->getArray()));
     $this->variables['output'] = implode(array_map([$this, "formatCharacter"], $output->getArray()));
     $this->variables['memory'] = $memory->getArray();
     $this->variables['program'] = implode($program->getArray());
 }
コード例 #2
0
 public function run()
 {
     $commandFactory = new CommandFactory($this->input, $this->output, $this->memory, $this->program, $this->loop);
     while ($command = $this->program->getValue()) {
         if ($command === 0) {
             break;
         }
         $commandClass = $commandFactory->getCommand($command);
         if ($commandClass instanceof Command) {
             $commandClass->execute();
         }
         $this->program->incrementPointer();
     }
     $this->response->prepareResponse($this->input, $this->output, $this->memory, $this->program);
     $this->response->processResponse();
 }
コード例 #3
0
 public function execute()
 {
     $this->output->setValue($this->memory->getValue());
     $this->output->incrementPointer();
 }
コード例 #4
0
 public function execute()
 {
     $this->memory->setValue($this->input->getValue());
 }