Public Member Functions | |
zList ($type, $length=-1) | |
Constructs the Linked List of the Specified Type You can optionally specify Max Length However iif not specified maxLength would be assumed as Unlimited. | |
mexLength ($length=null) | |
Returns teh maximum Length of the Linked List. | |
length () | |
returns the actual Length of teh List | |
addData ($val) | |
Adds data to the List. | |
isMaxLengthOverFlow () | |
Checks Wheather or not Max Length is over Flown. | |
Data Fields | |
$length = -1 |
Definition at line 15 of file zlinkedlist.php.
zList::zList | ( | $ | type, | |
$ | length = -1 | |||
) |
Constructs the Linked List of the Specified Type You can optionally specify Max Length However iif not specified maxLength would be assumed as Unlimited.
$type | String | |
$length | Integer |
Definition at line 31 of file zlinkedlist.php.
References $length, zItem::$type, and length().
zList::mexLength | ( | $ | length = null |
) |
Returns teh maximum Length of the Linked List.
You can Change the length by Specifying a value for the additional argument $length
$length | int |
Definition at line 41 of file zlinkedlist.php.
References $length, and length().
zList::length | ( | ) |
returns the actual Length of teh List
Definition at line 50 of file zlinkedlist.php.
References zItem::hasNext().
Referenced by addData(), zVect::find(), isMaxLengthOverFlow(), mexLength(), and zList().
00050 { 00051 $dummyLink = $this; 00052 $i = 0; 00053 while($dummyLink->hasNext()){ 00054 $dummyLink = $dummyLink->getNext(); 00055 $i++; 00056 } 00057 return $i; 00058 }
zList::addData | ( | $ | val | ) |
Adds data to the List.
Just Specify teh Data for the data Block and It will create a Node for It and set it as the Next Element. Returns False and Fires Error in case of Max Length Overflow
$val | mixed |
Definition at line 65 of file zlinkedlist.php.
References $val, zItem::hasNext(), isMaxLengthOverFlow(), length(), perror(), and zItem::zItem().
00065 { 00066 if($this->isMaxLengthOverFlow()){ 00067 perror("<code>zigmoyd.common.zList.addData($val)</code><br />Maximum Length Overflow. List is restricted to $this->length Nodes Trying to Insert ".($this->length+1)." th Item"); 00068 return false; 00069 } 00070 $dummyLink = null; 00071 $dummyLink = &$this; 00072 while($dummyLink->hasNext()){ 00073 $dummyLink = &$dummyLink->link; 00074 } 00075 $tmpDummy = new zItem($this->type); 00076 $tmpDummy->setData($val); 00077 $dummyLink->setNext(&$tmpDummy); 00078 return true; 00079 }
zList::isMaxLengthOverFlow | ( | ) |
zList::$length = -1 |