summaryrefslogtreecommitdiff
path: root/framework/Collections
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Collections')
-rw-r--r--framework/Collections/TAttributeCollection.php4
-rw-r--r--framework/Collections/TDummyDataSource.php5
-rw-r--r--framework/Collections/TList.php21
-rw-r--r--framework/Collections/TListItemCollection.php4
-rw-r--r--framework/Collections/TMap.php7
-rw-r--r--framework/Collections/TPagedDataSource.php6
-rw-r--r--framework/Collections/TPagedList.php6
-rw-r--r--framework/Collections/TPriorityList.php140
-rw-r--r--framework/Collections/TPriorityMap.php72
-rw-r--r--framework/Collections/TQueue.php4
-rw-r--r--framework/Collections/TStack.php7
11 files changed, 124 insertions, 152 deletions
diff --git a/framework/Collections/TAttributeCollection.php b/framework/Collections/TAttributeCollection.php
index d72640f2..775ad054 100644
--- a/framework/Collections/TAttributeCollection.php
+++ b/framework/Collections/TAttributeCollection.php
@@ -4,9 +4,8 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @version $Id: TAttributeCollection.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
*/
@@ -38,7 +37,6 @@ Prado::using('System.Collections.TMap');
* in the collection storage.
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Id: TAttributeCollection.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
* @since 3.0
*/
diff --git a/framework/Collections/TDummyDataSource.php b/framework/Collections/TDummyDataSource.php
index bf74dbec..7345982a 100644
--- a/framework/Collections/TDummyDataSource.php
+++ b/framework/Collections/TDummyDataSource.php
@@ -4,9 +4,8 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @version $Id: TDummyDataSource.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
*/
@@ -22,7 +21,6 @@
* </code>
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Id: TDummyDataSource.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
* @since 3.0
*/
@@ -76,7 +74,6 @@ class TDummyDataSource extends TComponent implements IteratorAggregate, Countabl
* for traversing its dummy items.
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Id: TDummyDataSource.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
* @since 3.0
*/
diff --git a/framework/Collections/TList.php b/framework/Collections/TList.php
index b82f676e..765fa2ce 100644
--- a/framework/Collections/TList.php
+++ b/framework/Collections/TList.php
@@ -4,9 +4,8 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @version $Id: TList.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
*/
@@ -32,7 +31,6 @@
* operation, override {@link insertAt()}, and {@link removeAt()}.
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Id: TList.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
* @since 3.0
*/
@@ -252,7 +250,7 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl
}
/**
- * Finds the base item. If found, the item is inserted before it.
+ * Finds the base item. If found, the item is inserted before it.
* @param mixed the base item which will be pushed back by the second parameter
* @param mixed the item
* @return int the index where the item is inserted
@@ -266,9 +264,9 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl
{
if(($index = $this->indexOf($baseitem)) == -1)
throw new TInvalidDataValueException('list_item_inexistent');
-
+
$this->insertAt($index, $item);
-
+
return $index;
}
else
@@ -276,7 +274,7 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl
}
/**
- * Finds the base item. If found, the item is inserted after it.
+ * Finds the base item. If found, the item is inserted after it.
* @param mixed the base item which comes before the second parameter when added to the list
* @param mixed the item
* @return int the index where the item is inserted
@@ -290,9 +288,9 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl
{
if(($index = $this->indexOf($baseitem)) == -1)
throw new TInvalidDataValueException('list_item_inexistent');
-
+
$this->insertAt($index + 1, $item);
-
+
return $index + 1;
}
else
@@ -402,10 +400,9 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl
*
* TListIterator is used by TList. It allows TList to return a new iterator
* for traversing the items in the list.
- *
- * @deprecated Issue 264 : ArrayIterator should be used instead
+ *
+ * @deprecated Issue 264 : ArrayIterator should be used instead
* @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Id: TList.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
* @since 3.0
*/
diff --git a/framework/Collections/TListItemCollection.php b/framework/Collections/TListItemCollection.php
index 23d5ade8..90a1fbf1 100644
--- a/framework/Collections/TListItemCollection.php
+++ b/framework/Collections/TListItemCollection.php
@@ -6,9 +6,8 @@
* @author Robin J. Rogge <rojaro@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @version $Id: TListControl.php 2624 2009-03-19 21:20:47Z godzilla80@gmx.net $
* @package System.Collections
*/
@@ -24,7 +23,6 @@ Prado::using('System.Web.UI.WebControls.TListItem');
* TListItemCollection maintains a list of {@link TListItem} for {@link TListControl}.
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Id: TListControl.php 2624 2009-03-19 21:20:47Z godzilla80@gmx.net $
* @package System.Collections
* @since 3.0
*/
diff --git a/framework/Collections/TMap.php b/framework/Collections/TMap.php
index d5f2ffce..a0ae8d5b 100644
--- a/framework/Collections/TMap.php
+++ b/framework/Collections/TMap.php
@@ -4,9 +4,8 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @version $Id: TMap.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
*/
@@ -28,7 +27,6 @@
* </code>
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Id: TMap.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
* @since 3.0
*/
@@ -272,9 +270,8 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable
* TMapIterator is used by TMap. It allows TMap to return a new iterator
* for traversing the items in the map.
*
- * @deprecated Issue 264 : ArrayIterator should be used instead
+ * @deprecated Issue 264 : ArrayIterator should be used instead
* @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Id: TMap.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
* @since 3.0
*/
diff --git a/framework/Collections/TPagedDataSource.php b/framework/Collections/TPagedDataSource.php
index 60d2736b..745fc052 100644
--- a/framework/Collections/TPagedDataSource.php
+++ b/framework/Collections/TPagedDataSource.php
@@ -4,9 +4,8 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @version $Id: TPagedDataSource.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
*/
@@ -24,7 +23,6 @@
* within the specified page will be returned and traversed.
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Id: TPagedDataSource.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
* @since 3.0
*/
@@ -277,7 +275,6 @@ class TPagedDataSource extends TComponent implements IteratorAggregate,Countable
* to return a new iterator for traversing the items in a {@link TList} object.
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Id: TPagedDataSource.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
* @since 3.0
*/
@@ -363,7 +360,6 @@ class TPagedListIterator implements Iterator
* to return a new iterator for traversing the items in a {@link TMap} object.
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Id: TPagedDataSource.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
* @since 3.0
*/
diff --git a/framework/Collections/TPagedList.php b/framework/Collections/TPagedList.php
index ff03606f..57e567e0 100644
--- a/framework/Collections/TPagedList.php
+++ b/framework/Collections/TPagedList.php
@@ -4,9 +4,8 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @version $Id: TPagedList.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
*/
@@ -51,7 +50,6 @@
*
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Id: TPagedList.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
* @since 3.0
*/
@@ -372,7 +370,6 @@ class TPagedList extends TList
* To obtain the page index before it was changed, use {@link getOldPageIndex OldPageIndex}.
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Id: TPagedList.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
* @since 3.0
*/
@@ -410,7 +407,6 @@ class TPagedListPageChangedEventParameter extends TEventParameter
* Newly fetched data should be saved in {@link setData Data} property.
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Id: TPagedList.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
* @since 3.0
*/
diff --git a/framework/Collections/TPriorityList.php b/framework/Collections/TPriorityList.php
index 1ccbd9ce..6a66b5be 100644
--- a/framework/Collections/TPriorityList.php
+++ b/framework/Collections/TPriorityList.php
@@ -4,21 +4,20 @@
*
* @author Brad Anderson <javalizard@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @version $Id: TPriorityList.php 2541 2008-10-21 15:05:13Z javalizard $
* @package System.Collections
*/
/**
* TPriorityList class
*
- * TPriorityList implements a priority ordered list collection class. It allows you to specify
- * any numeric for priorities down to a specific precision. The lower the numeric, the high the priority of the item in the
- * list. Thus -10 has a higher priority than -5, 0, 10 (the default), 18, 10005, etc. Per {@link round}, precision may be negative and
- * thus rounding can go by 10, 100, 1000, etc, instead of just .1, .01, .001, etc. The default precision allows for 8 decimal
- * places. There is also a default priority of 10, if no different default priority is specified or no item specific priority is indicated.
- * If you replace TList with this class it will work exactly the same with items inserted set to the default priority, until you start
+ * TPriorityList implements a priority ordered list collection class. It allows you to specify
+ * any numeric for priorities down to a specific precision. The lower the numeric, the high the priority of the item in the
+ * list. Thus -10 has a higher priority than -5, 0, 10 (the default), 18, 10005, etc. Per {@link round}, precision may be negative and
+ * thus rounding can go by 10, 100, 1000, etc, instead of just .1, .01, .001, etc. The default precision allows for 8 decimal
+ * places. There is also a default priority of 10, if no different default priority is specified or no item specific priority is indicated.
+ * If you replace TList with this class it will work exactly the same with items inserted set to the default priority, until you start
* using different priorities than the default priority.
*
* As you access the PHP array features of this class, it flattens and caches the results. If at all possible, this
@@ -39,15 +38,14 @@
* $n=count($list); // returns the number of items in the list
* </code>
*
- * To extend TPriorityList for doing your own operations with each addition or removal,
+ * To extend TPriorityList for doing your own operations with each addition or removal,
* override {@link insertAtIndexInPriority()} and {@link removeAtIndexInPriority()} and then call the parent.
*
* @author Brad Anderson <javalizard@gmail.com>
- * @version $Id: TPriorityList.php 2541 2008-10-21 15:05:13Z javalizard $
* @package System.Collections
* @since 3.2a
*/
-class TPriorityList extends TList
+class TPriorityList extends TList
{
/**
* @var array internal data storage
@@ -73,7 +71,7 @@ class TPriorityList extends TList
* @var integer the precision of the numeric priorities within this priority list.
*/
private $_p=8;
-
+
/**
* Constructor.
* Initializes the list with an array or an iterable object.
@@ -92,7 +90,7 @@ class TPriorityList extends TList
$this->setPrecision($precision);
$this->setDefaultPriority($defaultPriority);
}
-
+
/**
* Returns the number of items in the list.
* This method is required by Countable interface.
@@ -102,7 +100,7 @@ class TPriorityList extends TList
{
return $this->getCount();
}
-
+
/**
* Returns the total number of items in the list
* @return integer the number of items in the list
@@ -111,7 +109,7 @@ class TPriorityList extends TList
{
return $this->_c;
}
-
+
/**
* Gets the number of items at a priority within the list
* @param numeric optional priority at which to count items. if no parameter, it will be set to the default {@link getDefaultPriority}
@@ -122,12 +120,12 @@ class TPriorityList extends TList
if($priority===null)
$priority=$this->getDefaultPriority();
$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
-
+
if(!isset($this->_d[$priority]) || !is_array($this->_d[$priority]))
return false;
return count($this->_d[$priority]);
}
-
+
/**
* @return numeric gets the default priority of inserted items without a specified priority
*/
@@ -135,7 +133,7 @@ class TPriorityList extends TList
{
return $this->_dp;
}
-
+
/**
* This must be called internally or when instantiated.
* @param numeric sets the default priority of inserted items without a specified priority
@@ -144,7 +142,7 @@ class TPriorityList extends TList
{
$this->_dp=(string)round(TPropertyValue::ensureFloat($value),$this->_p);
}
-
+
/**
* @return integer The precision of numeric priorities, defaults to 8
*/
@@ -152,7 +150,7 @@ class TPriorityList extends TList
{
return $this->_p;
}
-
+
/**
* This must be called internally or when instantiated.
* @param integer The precision of numeric priorities.
@@ -161,7 +159,7 @@ class TPriorityList extends TList
{
$this->_p=TPropertyValue::ensureInteger($value);
}
-
+
/**
* Returns an iterator for traversing the items in the list.
* This method is required by the interface IteratorAggregate.
@@ -171,7 +169,7 @@ class TPriorityList extends TList
{
return new ArrayIterator($this->flattenPriorities());
}
-
+
/**
* This returns a list of the priorities within this list, ordered lowest to highest.
* @return array the array of priority numerics in decreasing priority order
@@ -181,8 +179,8 @@ class TPriorityList extends TList
$this->sortPriorities();
return array_keys($this->_d);
}
-
-
+
+
/**
* This orders the priority list internally.
*/
@@ -194,20 +192,20 @@ class TPriorityList extends TList
}
/**
- * This flattens the priority list into a flat array [0,...,n-1]
+ * This flattens the priority list into a flat array [0,...,n-1]
* @return array array of items in the list in priority and index order
*/
protected function flattenPriorities() {
if(is_array($this->_fd))
return $this->_fd;
-
+
$this->sortPriorities();
$this->_fd=array();
foreach($this->_d as $priority => $itemsatpriority)
$this->_fd=array_merge($this->_fd,$itemsatpriority);
return $this->_fd;
}
-
+
/**
* Returns the item at the index of a flattened priority list.
@@ -235,7 +233,7 @@ class TPriorityList extends TList
if($priority===null)
$priority=$this->getDefaultPriority();
$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
-
+
return isset($this->_d[$priority])?$this->_d[$priority]:null;
}
@@ -250,14 +248,14 @@ class TPriorityList extends TList
if($priority===null)
$priority=$this->getDefaultPriority();
$priority=(string)round(TPropertyValue::ensureFloat($priority), $this->_p);
-
+
return !isset($this->_d[$priority])?false:(
isset($this->_d[$priority][$index])?$this->_d[$priority][$index]:false
);
}
/**
- * Appends an item into the list at the end of the specified priority. The position of the added item may
+ * Appends an item into the list at the end of the specified priority. The position of the added item may
* not be at the end of the list.
* @param mixed item to add into the list at priority
* @param numeric priority blank or null for the default priority
@@ -268,7 +266,7 @@ class TPriorityList extends TList
{
if($this->getReadOnly())
throw new TInvalidOperationException('list_readonly',get_class($this));
-
+
return $this->insertAtIndexInPriority($item,false,$priority,true);
}
@@ -284,7 +282,7 @@ class TPriorityList extends TList
{
if($this->getReadOnly())
throw new TInvalidOperationException('list_readonly',get_class($this));
-
+
if(($priority=$this->priorityAt($index,true))!==false)
$this->insertAtIndexInPriority($item,$priority[1],$priority[0]);
else
@@ -292,7 +290,7 @@ class TPriorityList extends TList
}
/**
- * Inserts an item at the specified index within a priority. Override and call this method to
+ * Inserts an item at the specified index within a priority. Override and call this method to
* insert your own functionality.
* @param mixed item to add within the list.
* @param integer index within the priority to add the item, defaults to false which appends the item at the priority
@@ -305,11 +303,11 @@ class TPriorityList extends TList
{
if($this->getReadOnly())
throw new TInvalidOperationException('list_readonly',get_class($this));
-
+
if($priority===null)
$priority=$this->getDefaultPriority();
$priority=(string)round(TPropertyValue::ensureFloat($priority), $this->_p);
-
+
if($preserveCache) {
$this->sortPriorities();
$cc=0;
@@ -318,7 +316,7 @@ class TPriorityList extends TList
break;
else
$cc+=count($items);
-
+
if($index===false&&isset($this->_d[$priority])) {
$c=count($this->_d[$priority]);
$c+=$cc;
@@ -331,7 +329,7 @@ class TPriorityList extends TList
$this->_o = false;
$this->_d[$priority]=array($item);
}
-
+
if($this->_fd&&is_array($this->_fd)) // if there is a flattened array cache
array_splice($this->_fd,$c,0,array($item));
} else {
@@ -352,13 +350,13 @@ class TPriorityList extends TList
else
$this->_fd=null;
}
-
+
$this->_c++;
-
+
return $c;
-
+
}
-
+
/**
* Removes an item from the priority list.
@@ -373,14 +371,14 @@ class TPriorityList extends TList
{
if($this->getReadOnly())
throw new TInvalidOperationException('list_readonly',get_class($this));
-
+
if(($p=$this->priorityOf($item,true))!==false)
{
if($priority!==false) {
if($priority===null)
$priority=$this->getDefaultPriority();
$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
-
+
if($p[0]!=$priority)
throw new TInvalidDataValueException('list_item_inexistent');
}
@@ -402,14 +400,14 @@ class TPriorityList extends TList
{
if($this->getReadOnly())
throw new TInvalidOperationException('list_readonly',get_class($this));
-
+
if(($priority=$this->priorityAt($index, true))!==false)
return $this->removeAtIndexInPriority($priority[1],$priority[0]);
throw new TInvalidDataValueException('list_index_invalid',$index);
}
/**
- * Removes the item at a specific index within a priority. Override
+ * Removes the item at a specific index within a priority. Override
* and call this method to insert your own functionality.
* @param integer index of item to remove within the priority.
* @param numeric priority of the item to remove, defaults to null, or left blank, it is then set to the default priority
@@ -420,21 +418,21 @@ class TPriorityList extends TList
{
if($this->getReadOnly())
throw new TInvalidOperationException('list_readonly',get_class($this));
-
+
if($priority===null)
$priority=$this->getDefaultPriority();
$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
-
+
if(!isset($this->_d[$priority])||$index<0||$index>=count($this->_d[$priority]))
throw new TInvalidDataValueException('list_item_inexistent');
-
+
// $value is an array of elements removed, only one
$value=array_splice($this->_d[$priority],$index,1);
$value=$value[0];
-
+
if(!count($this->_d[$priority]))
unset($this->_d[$priority]);
-
+
$this->_c--;
$this->_fd=null;
return $value;
@@ -447,7 +445,7 @@ class TPriorityList extends TList
{
if($this->getReadOnly())
throw new TInvalidOperationException('list_readonly',get_class($this));
-
+
$d=array_reverse($this->_d,true);
foreach($this->_d as $priority=>$items) {
for($index=count($items)-1;$index>=0;$index--)
@@ -489,17 +487,17 @@ class TPriorityList extends TList
public function priorityOf($item,$withindex = false)
{
$this->sortPriorities();
-
+
$absindex = 0;
foreach($this->_d as $priority=>$items) {
if(($index=array_search($item,$items,true))!==false) {
$absindex+=$index;
- return $withindex?array($priority,$index,$absindex,
+ return $withindex?array($priority,$index,$absindex,
'priority'=>$priority,'index'=>$index,'absindex'=>$absindex):$priority;
} else
$absindex+=count($items);
}
-
+
return false;
}
@@ -516,21 +514,21 @@ class TPriorityList extends TList
{
if($index<0||$index>=$this->getCount())
throw new TInvalidDataValueException('list_index_invalid',$index);
-
+
$absindex=$index;
$this->sortPriorities();
foreach($this->_d as $priority=>$items) {
if($index>=($c=count($items)))
$index-=$c;
else
- return $withindex?array($priority,$index,$absindex,
+ return $withindex?array($priority,$index,$absindex,
'priority'=>$priority,'index'=>$index,'absindex'=>$absindex):$priority;
}
return false;
}
/**
- * This inserts an item before another item within the list. It uses the same priority as the
+ * This inserts an item before another item within the list. It uses the same priority as the
* found index item and places the new item before it.
* @param mixed indexitem the item to index
* @param mixed the item to add before indexitem
@@ -541,17 +539,17 @@ class TPriorityList extends TList
{
if($this->getReadOnly())
throw new TInvalidOperationException('list_readonly',get_class($this));
-
+
if(($priority=$this->priorityOf($indexitem,true))===false)
throw new TInvalidDataValueException('list_item_inexistent');
-
+
$this->insertAtIndexInPriority($item,$priority[1],$priority[0]);
-
+
return $priority[2];
}
/**
- * This inserts an item after another item within the list. It uses the same priority as the
+ * This inserts an item after another item within the list. It uses the same priority as the
* found index item and places the new item after it.
* @param mixed indexitem the item to index
* @param mixed the item to add after indexitem
@@ -562,12 +560,12 @@ class TPriorityList extends TList
{
if($this->getReadOnly())
throw new TInvalidOperationException('list_readonly',get_class($this));
-
+
if(($priority=$this->priorityOf($indexitem,true))===false)
throw new TInvalidDataValueException('list_item_inexistent');
-
+
$this->insertAtIndexInPriority($item,$priority[1]+1,$priority[0]);
-
+
return $priority[2]+1;
}
@@ -592,7 +590,7 @@ class TPriorityList extends TList
* Combines the map elements which have a priority below the parameter value
* @param numeric the cut-off priority. All items of priority less than this are returned.
* @param boolean whether or not the input cut-off priority is inclusive. Default: false, not inclusive.
- * @return array the array of priorities keys with values of arrays of items that are below a specified priority.
+ * @return array the array of priorities keys with values of arrays of items that are below a specified priority.
* The priorities are sorted so important priorities, lower numerics, are first.
*/
public function toArrayBelowPriority($priority,$inclusive=false)
@@ -612,7 +610,7 @@ class TPriorityList extends TList
* Combines the map elements which have a priority above the parameter value
* @param numeric the cut-off priority. All items of priority greater than this are returned.
* @param boolean whether or not the input cut-off priority is inclusive. Default: true, inclusive.
- * @return array the array of priorities keys with values of arrays of items that are above a specified priority.
+ * @return array the array of priorities keys with values of arrays of items that are above a specified priority.
* The priorities are sorted so important priorities, lower numerics, are first.
*/
public function toArrayAbovePriority($priority,$inclusive=true)
@@ -627,7 +625,7 @@ class TPriorityList extends TList
}
return $items;
}
-
+
/**
* Copies iterable data into the priority list.
@@ -658,7 +656,7 @@ class TPriorityList extends TList
/**
* Merges iterable data into the priority list.
* New data will be appended to the end of the existing data. If another TPriorityList is merged,
- * the incoming parameter items will be appended at the priorities they are present. These items will be added
+ * the incoming parameter items will be appended at the priorities they are present. These items will be added
* to the end of the existing items with equal priorities, if there are any.
* @param mixed the data to be merged with, must be an array or object implementing Traversable
* @throws TInvalidDataTypeException If data is neither an array nor an iterator.
@@ -677,7 +675,7 @@ class TPriorityList extends TList
{
foreach($data as $priority=>$item)
$this->add($item);
-
+
}
else if($data!==null)
throw new TInvalidDataTypeException('map_data_not_iterable');
@@ -707,12 +705,12 @@ class TPriorityList extends TList
/**
* Sets the element at the specified offset. This method is required by the interface ArrayAccess.
- * Setting elements in a priority list is not straight forword when appending and setting at the
+ * Setting elements in a priority list is not straight forword when appending and setting at the
* end boundary. When appending without an offset (a null offset), the item will be added at
* the default priority. The item may not be the last item in the list. When appending with an
* offset equal to the count of the list, the item will get be appended with the last items priority.
*
- * All together, when setting the location of an item, the item stays in that location, but appending
+ * All together, when setting the location of an item, the item stays in that location, but appending
* an item into a priority list doesn't mean the item is at the end of the list.
* @param integer the offset to set element
* @param mixed the element value
diff --git a/framework/Collections/TPriorityMap.php b/framework/Collections/TPriorityMap.php
index 46f05e9e..352e56ff 100644
--- a/framework/Collections/TPriorityMap.php
+++ b/framework/Collections/TPriorityMap.php
@@ -4,27 +4,26 @@
*
* @author Brad Anderson <javalizard@mac.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @version $Id: TPriorityMap.php 2817 2010-04-18 04:25:03Z javalizard $
* @package System.Collections
*/
/**
* TPriorityMap class
*
- * TPriorityMap implements a collection that takes key-value pairs with
- * a priority to allow key-value pairs to be ordered. This ordering is
+ * TPriorityMap implements a collection that takes key-value pairs with
+ * a priority to allow key-value pairs to be ordered. This ordering is
* important when flattening the map. When flattening the map, if some
- * key-value pairs are required to be before or after others, use this
+ * key-value pairs are required to be before or after others, use this
* class to keep order to your map.
*
* You can access, add or remove an item with a key by using
- * {@link itemAt}, {@link add}, and {@link remove}. These functions
- * can optionally take a priority parameter to allow access to specific
- * priorities. TPriorityMap is functionally backward compatible
+ * {@link itemAt}, {@link add}, and {@link remove}. These functions
+ * can optionally take a priority parameter to allow access to specific
+ * priorities. TPriorityMap is functionally backward compatible
* with {@link TMap}.
- *
+ *
* To get the number of the items in the map, use {@link getCount}.
* TPriorityMap can also be used like a regular array as follows,
* <code>
@@ -39,19 +38,18 @@
*
* An item that doesn't specify a priority will receive the default
* priority. The default priority is set during the instantiation
- * of a new TPriorityMap. If no custom default priority is specified,
+ * of a new TPriorityMap. If no custom default priority is specified,
* the standard default priority of 10 is used.
*
* Priorities with significant digits below precision will be rounded.
*
- * A priority may also be a numeric with decimals. This is set
- * during the instantiation of a new TPriorityMap.
+ * A priority may also be a numeric with decimals. This is set
+ * during the instantiation of a new TPriorityMap.
* The default is 8 decimal places for a priority. If a negative number
* is used, rounding occurs into the integer space rather than in
* the decimal space. See {@link round}.
*
* @author Brad Anderson <javalizard@mac.com>
- * @version $Id: TPriorityMap.php 2817 2010-04-18 04:25:03Z javalizard $
* @package System.Collections
* @since 3.2a
*/
@@ -121,7 +119,7 @@ class TPriorityMap extends TMap
{
$this->_r=TPropertyValue::ensureBoolean($value);
}
-
+
/**
* @return numeric gets the default priority of inserted items without a specified priority
*/
@@ -129,7 +127,7 @@ class TPriorityMap extends TMap
{
return $this->_dp;
}
-
+
/**
* This must be called internally or when instantiated.
* @param numeric sets the default priority of inserted items without a specified priority
@@ -138,7 +136,7 @@ class TPriorityMap extends TMap
{
$this->_dp = (string)round(TPropertyValue::ensureFloat($value), $this->_p);
}
-
+
/**
* @return integer The precision of numeric priorities, defaults to 8
*/
@@ -146,7 +144,7 @@ class TPriorityMap extends TMap
{
return $this->_p;
}
-
+
/**
* This must be called internally or when instantiated.
* @param integer The precision of numeric priorities.
@@ -165,8 +163,8 @@ class TPriorityMap extends TMap
{
return new ArrayIterator($this->flattenPriorities());
}
-
-
+
+
/**
* Orders the priority list internally.
*/
@@ -184,7 +182,7 @@ class TPriorityMap extends TMap
protected function flattenPriorities() {
if(is_array($this->_fd))
return $this->_fd;
-
+
$this->sortPriorities();
$this->_fd = array();
foreach($this->_d as $priority => $itemsatpriority)
@@ -209,10 +207,10 @@ class TPriorityMap extends TMap
{
return $this->_c;
}
-
+
/**
* Gets the number of items at a priority within the map.
- * @param numeric optional priority at which to count items. if no parameter,
+ * @param numeric optional priority at which to count items. if no parameter,
* it will be set to the default {@link getDefaultPriority}
* @return integer the number of items in the map at the specified priority
*/
@@ -221,12 +219,12 @@ class TPriorityMap extends TMap
if($priority===null)
$priority=$this->getDefaultPriority();
$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
-
+
if(!isset($this->_d[$priority])||!is_array($this->_d[$priority]))
return false;
return count($this->_d[$priority]);
}
-
+
/**
* This returns a list of the priorities within this map, ordered lowest to highest.
* @return array the array of priority numerics in decreasing priority order
@@ -250,7 +248,7 @@ class TPriorityMap extends TMap
* Returns the item with the specified key. If a priority is specified, only items
* within that specific priority will be selected
* @param mixed the key
- * @param mixed the priority. null is the default priority, false is any priority,
+ * @param mixed the priority. null is the default priority, false is any priority,
* and numeric is a specific priority. default: false, any priority.
* @return mixed the element at the offset, null if no element is found at the offset
*/
@@ -279,7 +277,7 @@ class TPriorityMap extends TMap
if($priority===null)
$priority=$this->getDefaultPriority();
$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
-
+
$oldpriority=$this->priorityAt($key);
if($oldpriority!==false&&$oldpriority!=$priority) {
$value=$this->remove($key,$oldpriority);
@@ -298,7 +296,7 @@ class TPriorityMap extends TMap
if($priority===null)
$priority=$this->getDefaultPriority();
$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
-
+
return isset($this->_d[$priority])?$this->_d[$priority]:null;
}
@@ -348,7 +346,7 @@ class TPriorityMap extends TMap
if($priority===null)
$priority=$this->getDefaultPriority();
$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
-
+
if(!$this->_r)
{
foreach($this->_d as $innerpriority=>$items)
@@ -376,11 +374,11 @@ class TPriorityMap extends TMap
/**
* Removes an item from the map by its key. If no priority, or false, is specified
* then priority is irrelevant. If null is used as a parameter for priority, then
- * the priority will be the default priority. If a priority is specified, or
+ * the priority will be the default priority. If a priority is specified, or
* the default priority is specified, only key-value pairs in that priority
* will be affected.
* @param mixed the key of the item to be removed
- * @param numeric|false|null priority. False is any priority, null is the
+ * @param numeric|false|null priority. False is any priority, null is the
* default priority, and numeric is a specific priority
* @return mixed the removed value, null if no such key exists.
* @throws TInvalidOperationException if the map is read-only
@@ -391,7 +389,7 @@ class TPriorityMap extends TMap
{
if($priority===null)
$priority=$this->getDefaultPriority();
-
+
if($priority===false)
{
$this->sortPriorities();
@@ -455,8 +453,8 @@ class TPriorityMap extends TMap
}
/**
- * When the map is flattened into an array, the priorities are taken into
- * account and elements of the map are ordered in the array according to
+ * When the map is flattened into an array, the priorities are taken into
+ * account and elements of the map are ordered in the array according to
* their priority.
* @return array the list of items in array
*/
@@ -469,7 +467,7 @@ class TPriorityMap extends TMap
* Combines the map elements which have a priority below the parameter value
* @param numeric the cut-off priority. All items of priority less than this are returned.
* @param boolean whether or not the input cut-off priority is inclusive. Default: false, not inclusive.
- * @return array the array of priorities keys with values of arrays of items that are below a specified priority.
+ * @return array the array of priorities keys with values of arrays of items that are below a specified priority.
* The priorities are sorted so important priorities, lower numerics, are first.
*/
public function toArrayBelowPriority($priority,$inclusive=false)
@@ -489,7 +487,7 @@ class TPriorityMap extends TMap
* Combines the map elements which have a priority above the parameter value
* @param numeric the cut-off priority. All items of priority greater than this are returned.
* @param boolean whether or not the input cut-off priority is inclusive. Default: true, inclusive.
- * @return array the array of priorities keys with values of arrays of items that are above a specified priority.
+ * @return array the array of priorities keys with values of arrays of items that are above a specified priority.
* The priorities are sorted so important priorities, lower numerics, are first.
*/
public function toArrayAbovePriority($priority,$inclusive=true)
@@ -508,7 +506,7 @@ class TPriorityMap extends TMap
/**
* Copies iterable data into the map.
* Note, existing data in the map will be cleared first.
- * @param mixed the data to be copied from, must be an array, object implementing
+ * @param mixed the data to be copied from, must be an array, object implementing
* Traversable, or a TPriorityMap
* @throws TInvalidDataTypeException If data is neither an array nor an iterator.
*/
@@ -538,7 +536,7 @@ class TPriorityMap extends TMap
/**
* Merges iterable data into the map.
* Existing data in the map will be kept and overwritten if the keys are the same.
- * @param mixed the data to be merged with, must be an array, object implementing
+ * @param mixed the data to be merged with, must be an array, object implementing
* Traversable, or a TPriorityMap
* @throws TInvalidDataTypeException If data is neither an array nor an iterator.
*/
diff --git a/framework/Collections/TQueue.php b/framework/Collections/TQueue.php
index 077b9b2f..ffa81b95 100644
--- a/framework/Collections/TQueue.php
+++ b/framework/Collections/TQueue.php
@@ -4,7 +4,7 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Collections
@@ -161,7 +161,7 @@ class TQueue extends TComponent implements IteratorAggregate,Countable
{
return $this->_c;
}
-
+
/**
* Returns the number of items in the queue.
* This method is required by Countable interface.
diff --git a/framework/Collections/TStack.php b/framework/Collections/TStack.php
index 06c97046..91996aaa 100644
--- a/framework/Collections/TStack.php
+++ b/framework/Collections/TStack.php
@@ -4,9 +4,8 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @version $Id: TStack.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
*/
@@ -27,7 +26,6 @@
* </code>
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Id: TStack.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
* @since 3.0
*/
@@ -180,9 +178,8 @@ class TStack extends TComponent implements IteratorAggregate,Countable
* TStackIterator is used by TStack. It allows TStack to return a new iterator
* for traversing the items in the list.
*
- * @deprecated Issue 264 : ArrayIterator should be used instead
+ * @deprecated Issue 264 : ArrayIterator should be used instead
* @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Id: TStack.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
* @since 3.0
*/