Exemplo n.º 1
0
 /**
  * @param Item[] $items
  */
 public function setContents(array $items)
 {
     if (count($items) > $this->size) {
         $items = array_slice($items, 0, $this->size, true);
     }
     parent::setContents($items);
     $leftItems = array_slice($items, 0, $this->left->getSize(), true);
     $this->left->setContents($leftItems);
     if (count($items) > $this->left->getSize()) {
         $rightItems = array_slice($items, $this->left->getSize() - 1, $this->right->getSize(), true);
         $this->right->setContents($rightItems);
     }
 }
 public function clear($index)
 {
     return $index < $this->left->getSize() ? $this->left->clear($index) : $this->right->clear($index - $this->right->getSize());
 }