ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_HashTable Class Reference
+ Collaboration diagram for PHPExcel_HashTable:

Public Member Functions

 __construct ($pSource=null)
 Create a new PHPExcel_HashTable.
 addFromSource ($pSource=null)
 Add HashTable items from source.
 add (PHPExcel_IComparable $pSource=null)
 Add HashTable item.
 remove (PHPExcel_IComparable $pSource=null)
 Remove HashTable item.
 clear ()
 Clear HashTable.
 count ()
 Count.
 getIndexForHashCode ($pHashCode= '')
 Get index for hash code.
 getByIndex ($pIndex=0)
 Get by index.
 getByHashCode ($pHashCode= '')
 Get by hashcode.
 toArray ()
 HashTable to array.
 __clone ()
 Implement PHP __clone to create a deep clone, not just a shallow copy.

Data Fields

 $_items = array()
 $_keyMap = array()

Detailed Description

Definition at line 36 of file HashTable.php.

Constructor & Destructor Documentation

PHPExcel_HashTable::__construct (   $pSource = null)

Create a new PHPExcel_HashTable.

Parameters
PHPExcel_IComparable[]$pSource Optional source array to create HashTable from
Exceptions
Exception

Definition at line 58 of file HashTable.php.

References addFromSource().

{
if (!is_null($pSource)) {
// Create HashTable
$this->addFromSource($pSource);
}
}

+ Here is the call graph for this function:

Member Function Documentation

PHPExcel_HashTable::__clone ( )

Implement PHP __clone to create a deep clone, not just a shallow copy.

Definition at line 194 of file HashTable.php.

{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
}
}
}
PHPExcel_HashTable::add ( PHPExcel_IComparable  $pSource = null)

Add HashTable item.

Parameters
PHPExcel_IComparable$pSourceItem to add
Exceptions
Exception

Definition at line 91 of file HashTable.php.

References count().

Referenced by addFromSource().

{
$hash = $pSource->getHashCode();
if (!isset($this->_items[$hash])) {
$this->_items[$hash] = $pSource;
$this->_keyMap[count($this->_items) - 1] = $hash;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_HashTable::addFromSource (   $pSource = null)

Add HashTable items from source.

Parameters
PHPExcel_IComparable[]$pSource Source array to create HashTable from
Exceptions
Exception

Definition at line 72 of file HashTable.php.

References add().

Referenced by __construct().

{
// Check if an array was passed
if ($pSource == null) {
return;
} else if (!is_array($pSource)) {
throw new Exception('Invalid array parameter passed.');
}
foreach ($pSource as $item) {
$this->add($item);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_HashTable::clear ( )

Clear HashTable.

Definition at line 128 of file HashTable.php.

{
$this->_items = array();
$this->_keyMap = array();
}
PHPExcel_HashTable::count ( )

Count.

Returns
int

Definition at line 138 of file HashTable.php.

Referenced by add(), and remove().

{
return count($this->_items);
}

+ Here is the caller graph for this function:

PHPExcel_HashTable::getByHashCode (   $pHashCode = '')

Get by hashcode.

Parameters
string$pHashCode
Returns
PHPExcel_IComparable

Definition at line 174 of file HashTable.php.

Referenced by getByIndex().

{
if (isset($this->_items[$pHashCode])) {
return $this->_items[$pHashCode];
}
return null;
}

+ Here is the caller graph for this function:

PHPExcel_HashTable::getByIndex (   $pIndex = 0)

Get by index.

Parameters
int$pIndex
Returns
PHPExcel_IComparable

Definition at line 159 of file HashTable.php.

References getByHashCode().

{
if (isset($this->_keyMap[$pIndex])) {
return $this->getByHashCode( $this->_keyMap[$pIndex] );
}
return null;
}

+ Here is the call graph for this function:

PHPExcel_HashTable::getIndexForHashCode (   $pHashCode = '')

Get index for hash code.

Parameters
string$pHashCode
Returns
int Index

Definition at line 148 of file HashTable.php.

{
return array_search($pHashCode, $this->_keyMap);
}
PHPExcel_HashTable::remove ( PHPExcel_IComparable  $pSource = null)

Remove HashTable item.

Parameters
PHPExcel_IComparable$pSourceItem to remove
Exceptions
Exception

Definition at line 105 of file HashTable.php.

References count().

{
$hash = $pSource->getHashCode();
if (isset($this->_items[$hash])) {
unset($this->_items[$hash]);
$deleteKey = -1;
foreach ($this->_keyMap as $key => $value) {
if ($deleteKey >= 0) {
$this->_keyMap[$key - 1] = $value;
}
if ($value == $hash) {
$deleteKey = $key;
}
}
unset($this->_keyMap[count($this->_keyMap) - 1]);
}
}

+ Here is the call graph for this function:

PHPExcel_HashTable::toArray ( )

HashTable to array.

Returns
PHPExcel_IComparable[]

Definition at line 187 of file HashTable.php.

References $_items.

{
return $this->_items;
}

Field Documentation

PHPExcel_HashTable::$_items = array()

Definition at line 43 of file HashTable.php.

Referenced by toArray().

PHPExcel_HashTable::$_keyMap = array()

Definition at line 50 of file HashTable.php.


The documentation for this class was generated from the following file: