LZReverseDictionary.php 543 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: sics
  5. * Date: 28.02.2016
  6. * Time: 12:53
  7. */
  8. namespace App\Game\Services\LZCompressor;
  9. class LZReverseDictionary
  10. {
  11. public $entries = array(0, 1 ,2);
  12. public function size() {
  13. return count($this->entries);
  14. }
  15. public function hasEntry($index) {
  16. return array_key_exists($index, $this->entries);
  17. }
  18. public function getEntry($index) {
  19. return $this->entries[$index];
  20. }
  21. public function addEntry($char) {
  22. $this->entries[] = $char;
  23. }
  24. }