コード例 #1
0
ファイル: SortedSet.php プロジェクト: novuso/system
 /**
  * {@inheritdoc}
  */
 public function add($item)
 {
     assert(Validate::isType($item, $this->itemType()), $this->itemTypeError('add', $item));
     $this->tree->set($item, true);
 }
コード例 #2
0
 public function test_that_clone_includes_linked_nodes()
 {
     $tree = new RedBlackSearchTree(new ComparableComparator());
     foreach ($this->getWeekDays() as $value => $key) {
         $tree->set($key, $value);
     }
     $copy = clone $tree;
     while (!$tree->isEmpty()) {
         $tree->removeMin();
     }
     $this->assertCount(7, $copy);
 }
コード例 #3
0
ファイル: SortedTable.php プロジェクト: novuso/system
 /**
  * {@inheritdoc}
  */
 public function set($key, $value)
 {
     assert(Validate::isType($key, $this->keyType()), $this->keyTypeError('set', $key));
     assert(Validate::isType($value, $this->valueType()), $this->valueTypeError('set', $value));
     $this->tree->set($key, $value);
 }