summaryrefslogtreecommitdiff
path: root/framework/Collections/TList.php
diff options
context:
space:
mode:
authorxue <>2006-08-02 02:24:29 +0000
committerxue <>2006-08-02 02:24:29 +0000
commit550ba06593b467b643862d41a00ca2dd12ee704b (patch)
tree16ad8180c2f0b96454453effff89dc236469ee4f /framework/Collections/TList.php
parentccfa7850dc435ae9941cde18be827b3aac550f85 (diff)
merge from 3.0 branch till 1320.
Diffstat (limited to 'framework/Collections/TList.php')
-rw-r--r--framework/Collections/TList.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/framework/Collections/TList.php b/framework/Collections/TList.php
index 015781cb..1104ec47 100644
--- a/framework/Collections/TList.php
+++ b/framework/Collections/TList.php
@@ -25,9 +25,8 @@
* unset($list[$index]); // remove the item at $index
* if(isset($list[$index])) // if the list has an item at $index
* foreach($list as $index=>$item) // traverse each item in the list
+ * $n=count($list); // returns the number of items in the list
* </code>
- * Note, count($list) will always return 1. You should use {@link getCount()}
- * to determine the number of items in the list.
*
* To extend TList by doing additional operations with each addition or removal
* operation, override {@link insertAt()}, and {@link removeAt()}.
@@ -37,7 +36,7 @@
* @package System.Collections
* @since 3.0
*/
-class TList extends TComponent implements IteratorAggregate,ArrayAccess
+class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countable
{
/**
* internal data storage
@@ -95,6 +94,16 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess
}
/**
+ * Returns the number of items in the list.
+ * This method is required by Countable interface.
+ * @return integer number of items in the list.
+ */
+ public function count()
+ {
+ return $this->getCount();
+ }
+
+ /**
* @return integer the number of items in the list
*/
public function getCount()