summaryrefslogtreecommitdiff
path: root/framework/Collections
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Collections')
-rw-r--r--framework/Collections/TAttributeCollection.php2
-rw-r--r--framework/Collections/TDummyDataSource.php2
-rw-r--r--framework/Collections/TList.php18
-rw-r--r--framework/Collections/TListItemCollection.php2
-rw-r--r--framework/Collections/TMap.php4
-rw-r--r--framework/Collections/TPagedDataSource.php2
-rw-r--r--framework/Collections/TPagedList.php2
-rw-r--r--framework/Collections/TPriorityList.php138
-rw-r--r--framework/Collections/TPriorityMap.php70
-rw-r--r--framework/Collections/TQueue.php4
-rw-r--r--framework/Collections/TStack.php4
11 files changed, 124 insertions, 124 deletions
diff --git a/framework/Collections/TAttributeCollection.php b/framework/Collections/TAttributeCollection.php
index d72640f2..098d3fe6 100644
--- a/framework/Collections/TAttributeCollection.php
+++ b/framework/Collections/TAttributeCollection.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: TAttributeCollection.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
diff --git a/framework/Collections/TDummyDataSource.php b/framework/Collections/TDummyDataSource.php
index bf74dbec..1f8d8679 100644
--- a/framework/Collections/TDummyDataSource.php
+++ b/framework/Collections/TDummyDataSource.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: TDummyDataSource.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
diff --git a/framework/Collections/TList.php b/framework/Collections/TList.php
index b82f676e..a1c0b9d0 100644
--- a/framework/Collections/TList.php
+++ b/framework/Collections/TList.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: TList.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
@@ -252,7 +252,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 +266,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 +276,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 +290,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,8 +402,8 @@ 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
diff --git a/framework/Collections/TListItemCollection.php b/framework/Collections/TListItemCollection.php
index 23d5ade8..6f665451 100644
--- a/framework/Collections/TListItemCollection.php
+++ b/framework/Collections/TListItemCollection.php
@@ -6,7 +6,7 @@
* @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
diff --git a/framework/Collections/TMap.php b/framework/Collections/TMap.php
index d5f2ffce..06c3c271 100644
--- a/framework/Collections/TMap.php
+++ b/framework/Collections/TMap.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: TMap.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
@@ -272,7 +272,7 @@ 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
diff --git a/framework/Collections/TPagedDataSource.php b/framework/Collections/TPagedDataSource.php
index 60d2736b..7c6c4a21 100644
--- a/framework/Collections/TPagedDataSource.php
+++ b/framework/Collections/TPagedDataSource.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: TPagedDataSource.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
diff --git a/framework/Collections/TPagedList.php b/framework/Collections/TPagedList.php
index ff03606f..709ec977 100644
--- a/framework/Collections/TPagedList.php
+++ b/framework/Collections/TPagedList.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: TPagedList.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
diff --git a/framework/Collections/TPriorityList.php b/framework/Collections/TPriorityList.php
index 1ccbd9ce..0d73530f 100644
--- a/framework/Collections/TPriorityList.php
+++ b/framework/Collections/TPriorityList.php
@@ -4,7 +4,7 @@
*
* @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
@@ -13,12 +13,12 @@
/**
* 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,7 +39,7 @@
* $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>
@@ -47,7 +47,7 @@
* @package System.Collections
* @since 3.2a
*/
-class TPriorityList extends TList
+class TPriorityList extends TList
{
/**
* @var array internal data storage
@@ -73,7 +73,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 +92,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 +102,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 +111,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 +122,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 +135,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 +144,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 +152,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 +161,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 +171,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 +181,8 @@ class TPriorityList extends TList
$this->sortPriorities();
return array_keys($this->_d);
}
-
-
+
+
/**
* This orders the priority list internally.
*/
@@ -194,20 +194,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 +235,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 +250,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 +268,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 +284,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 +292,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 +305,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 +318,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 +331,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 +352,13 @@ class TPriorityList extends TList
else
$this->_fd=null;
}
-
+
$this->_c++;
-
+
return $c;
-
+
}
-
+
/**
* Removes an item from the priority list.
@@ -373,14 +373,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 +402,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 +420,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 +447,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 +489,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 +516,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 +541,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 +562,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 +592,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 +612,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 +627,7 @@ class TPriorityList extends TList
}
return $items;
}
-
+
/**
* Copies iterable data into the priority list.
@@ -658,7 +658,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 +677,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 +707,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..008c99b0 100644
--- a/framework/Collections/TPriorityMap.php
+++ b/framework/Collections/TPriorityMap.php
@@ -4,7 +4,7 @@
*
* @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
@@ -13,18 +13,18 @@
/**
* 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,13 +39,13 @@
*
* 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}.
@@ -121,7 +121,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 +129,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 +138,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 +146,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 +165,8 @@ class TPriorityMap extends TMap
{
return new ArrayIterator($this->flattenPriorities());
}
-
-
+
+
/**
* Orders the priority list internally.
*/
@@ -184,7 +184,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 +209,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 +221,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 +250,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 +279,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 +298,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 +348,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 +376,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 +391,7 @@ class TPriorityMap extends TMap
{
if($priority===null)
$priority=$this->getDefaultPriority();
-
+
if($priority===false)
{
$this->sortPriorities();
@@ -455,8 +455,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 +469,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 +489,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 +508,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 +538,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..07379d09 100644
--- a/framework/Collections/TStack.php
+++ b/framework/Collections/TStack.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: TStack.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Collections
@@ -180,7 +180,7 @@ 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