コード例 #1
0
 public function removeObserver(MyObserver $o)
 {
     $i = $this->observers->indexOf($o);
     if ($i >= 0) {
         $this->observers->remove($i);
     }
 }
コード例 #2
0
 public function testSet()
 {
     // Remove the following lines when you implement this test.
     $this->assertTrue($this->object->set(2, 69)->toNative() == 2);
     $this->assertTrue($this->object->get(2)->toNative() == 69);
     $this->assertTrue($this->object->indexOf(69) == 2);
 }
コード例 #3
0
ファイル: TypedArrayList.php プロジェクト: dazarobbo/cola
 public function indexOf($value)
 {
     $this->validTypeThrow($value);
     return parent::indexOf($value);
 }
コード例 #4
0
ファイル: test.ArrayList.php プロジェクト: vrana/nette
// IList::offsetUnset
try {
    echo "Removing using unset\n";
    unset($list[-1]);
} catch (Exception $e) {
    echo get_class($e), ': ', $e->getMessage(), "\n\n";
}
try {
    echo "Removing using unset\n";
    unset($list[1]);
} catch (Exception $e) {
    echo get_class($e), ': ', $e->getMessage(), "\n\n";
}
// IList::indexOf()
echo "indexOf Jack:\n";
Debug::dump($list->indexOf($jack));
echo "indexOf Mary:\n";
Debug::dump($list->indexOf($mary));
// IList::count
echo "Count: ", $list->count(), "\n";
echo "Count: ", count($list), "\n";
// IList::getIterator
echo "Get Interator:\n";
foreach ($list as $key => $person) {
    echo $key, ' => ', $person->sayHi();
}
// IList::clear
echo "Clearing\n";
$list->clear();
foreach ($list as $person) {
    $person->sayHi();