Loading Please wait...

zList Class Reference
[OOPS data structures.]

Linked List Class. More...

Inheritance diagram for zList:

Inheritance graph
[legend]
Collaboration diagram for zList:

Collaboration graph
[legend]

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

Detailed Description

Linked List Class.

Definition at line 15 of file zlinkedlist.php.


Member Function Documentation

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.

Parameters:
$type String
$length Integer
Returns:
zList

Definition at line 31 of file zlinkedlist.php.

References $length, zItem::$type, and length().

00031                                    {
00032     $this->length = $length;
00033     parent::zItem($type);
00034   }

Here is the call graph for this function:

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

Parameters:
$length int
Returns:
Integer

Definition at line 41 of file zlinkedlist.php.

References $length, and length().

00041                                   {
00042     if($length != null)$this->length = $length;
00043     return $this->length;
00044   }

Here is the call graph for this function:

zList::length (  ) 

returns the actual Length of teh List

Returns:
integer

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   }

Here is the call graph for this function:

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

Parameters:
$val mixed
Returns:
boolean

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   }

Here is the call graph for this function:

zList::isMaxLengthOverFlow (  ) 

Checks Wheather or not Max Length is over Flown.

Returns:
boolean

Definition at line 85 of file zlinkedlist.php.

References length().

Referenced by addData().

00085                                 {
00086     return !($this->length == -1 || $this->length() <= $this->length);
00087   }

Here is the call graph for this function:


Field Documentation

zList::$length = -1

Definition at line 22 of file zlinkedlist.php.

Referenced by mexLength(), and zList().


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

Generated on Mon Oct 27 23:54:09 2008 for zigmoyd.kdevelop by doxygen 1.5.6