Example #1
0
 /**
  * Remove HashTable item
  *
  * @param  \PhpOffice\PhpPresentation\ComparableInterface $pSource Item to remove
  * @throws \Exception
  */
 public function remove(ComparableInterface $pSource)
 {
     if (isset($this->items[$pSource->getHashCode()])) {
         unset($this->items[$pSource->getHashCode()]);
         $deleteKey = -1;
         foreach ($this->keyMap as $key => $value) {
             if ($deleteKey >= 0) {
                 $this->keyMap[$key - 1] = $value;
             }
             if ($value == $pSource->getHashCode()) {
                 $deleteKey = $key;
             }
         }
         unset($this->keyMap[count($this->keyMap) - 1]);
     }
 }
Example #2
0
 /**
  * @return int
  */
 private function getPairTotal()
 {
     return $this->left->compareTo($this->right);
 }