Loading Please wait...

zItem Class Reference
[OOPS data structures.]

zItem Class Constructs a Node of a Linked List or a tree More...

Inheritance diagram for zItem:

Inheritance graph
[legend]
Collaboration diagram for zItem:

Collaboration graph
[legend]

Public Member Functions

 zItem ($type)
 Constructs an Item Node with the Specified data Type.
 hasParent ()
 Checks wheather or not the Current Node has a Parent.
 setParent (&$parentNode)
 Sets the Parent Node of a Node.
getParent ()
 Returns a Reference to the Parent Node.
 setData ($val)
 Store Data in teh data Block Data Must be of same type as it is Supposed to be.
 getData ()
 Returns teh Data in the data Block.
 hasNext ()
 Checks wheather or not its the Last Item.
 setNext ($nextElem)
 Sets the Next Element on the link Block returns False also fires Error if the next element is not of zItem Class Type.
getNext ()
 Get the next Eelement.
 removeNext ()
 Removes the Link.
 getType ()
 retrns teh TypeId used in this Node
 isDataValid ($type)
 Checks Wheather or not the Current Node Contains a Valid Type Safe Data in Its Data Block.
 isValid ($type)
 Checks wheather this Node as well as the Child Nodes are Valid Recursively.

Data Fields

 $type
 $data
 $link = null
 $parent = null

Detailed Description

zItem Class Constructs a Node of a Linked List or a tree

Definition at line 15 of file zitem.php.


Member Function Documentation

zItem::zItem ( type  ) 

Constructs an Item Node with the Specified data Type.

e.g. If its a Node of String you can only attach a String Node as teh next Item in teh link Block

Parameters:
$type String
Returns:
zItem

Definition at line 51 of file zitem.php.

References $type.

Referenced by zList::addData(), and zVect::insert().

00051                        {
00052     $this->type = $type;
00053   }

zItem::hasParent (  ) 

Checks wheather or not the Current Node has a Parent.

Returns:
boolean

Definition at line 59 of file zitem.php.

00059                       {
00060     return is_null($this->parent);
00061   }

zItem::setParent ( &$  parentNode  ) 

Sets the Parent Node of a Node.

Parameters:
$parentNode zItem

Definition at line 67 of file zitem.php.

References getType(), ofPolymorphicType(), perror(), and typeId().

00067                                   {
00068     if(!ofPolymorphicType($parentNode, 'zItem')){
00069       perror("<code>zigmoyd.common.zItem.setParent()</code><br />parentItem is not of zItem Class Type instead its a ".typeId($parentNode)." Type So It Cannot be linked with a zItem Object");
00070       return false;
00071     }
00072     if(!(strtolower($this->getType()) == strtolower($nextElem->getType()))){
00073       perror("<code>zigmoyd.common.zItem.setParent()</code><br />parentItem Node is not of same Type of this Item Node<br />Expecting ".$this->getType()." But getting ".$parentNode->getType());
00074       return false;
00075     }
00076     $this->parent = $parentNode;
00077     return true;
00078   }

Here is the call graph for this function:

& zItem::getParent (  ) 

Returns a Reference to the Parent Node.

Returns:
zItem

Definition at line 84 of file zitem.php.

00084                        {
00085     return $this->parent;
00086   }

zItem::setData ( val  ) 

Store Data in teh data Block Data Must be of same type as it is Supposed to be.

Parameters:
$val mixed
Returns:
boolean

Definition at line 93 of file zitem.php.

References $val, ofType(), perror(), and typeId().

00093                         {
00094     if(ofType($val, $this->type)){
00095       $this->data = $val;
00096       return true;
00097     }
00098     perror("<code>zigmoyd.common.zItem.setData($val)</code><br />DataType Mismatch. Expecting value of Type $this->type But ".typeId($val)." Type value Given.<br />Not setting the Data in teh Data Block");
00099     return false;
00100   }

Here is the call graph for this function:

zItem::getData (  ) 

Returns teh Data in the data Block.

Returns:
mixed

Definition at line 106 of file zitem.php.

00106                     {
00107     return $this->data;
00108   }

zItem::hasNext (  ) 

Checks wheather or not its the Last Item.

Returns:
boolean

Definition at line 114 of file zitem.php.

Referenced by zList::addData(), zVect::at(), zVect::dataAt(), zVect::detach(), isValid(), and zList::length().

00114                     {
00115     return !is_null($this->link);
00116   }

zItem::setNext ( nextElem  ) 

Sets the Next Element on the link Block returns False also fires Error if the next element is not of zItem Class Type.

Parameters:
$nextElem zItem
Returns:
boolean

Definition at line 123 of file zitem.php.

References getType(), ofType(), perror(), and typeId().

00123                              {
00124     if(!ofType($nextElem, 'zItem')){
00125       perror("<code>zigmoyd.common.zItem.setNext()</code><br />nextItem is not of zItem Class Type instead its a ".typeId($nextElem)." Type So It Cannot be linked with a zItem Object");
00126       return false;
00127     }
00128     if(strtolower($this->getType()) == strtolower($nextElem->getType())){
00129       $nextElem->setParent($this);
00130       $this->link = $nextElem;
00131       return true;
00132     }
00133     perror("<code>zigmoyd.common.zItem.setNext()</code><br />nextItem Node is not of same Type of this Item Node<br />Expecting ".$this->getType()." But getting ".$nextElem->getType());
00134     return false;
00135   }

Here is the call graph for this function:

& zItem::getNext (  ) 

Get the next Eelement.

Returns:
zItem

Definition at line 141 of file zitem.php.

Referenced by zVect::at(), and zVect::dataAt().

00141                      {
00142     return $this->link;
00143   }

zItem::removeNext (  ) 

Removes the Link.

Definition at line 148 of file zitem.php.

00148                        {
00149     unset($this->link);
00150     $this->link = null;
00151   }

zItem::getType (  ) 

retrns teh TypeId used in this Node

Returns:
String

Definition at line 157 of file zitem.php.

Referenced by setNext(), and setParent().

00157                     {
00158     return $this->type;
00159   }

zItem::isDataValid ( type  ) 

Checks Wheather or not the Current Node Contains a Valid Type Safe Data in Its Data Block.

Parameters:
$type String
Returns:
boolean

Definition at line 166 of file zitem.php.

References $type, and typeId().

Referenced by isValid().

00166                              {
00167     return (typeId($this->data)==$type);
00168   }

Here is the call graph for this function:

zItem::isValid ( type  ) 

Checks wheather this Node as well as the Child Nodes are Valid Recursively.

Parameters:
$type String
Returns:
boolean

Definition at line 175 of file zitem.php.

References $type, hasNext(), and isDataValid().

00175                          {
00176     if($this->isDataValid($type)){
00177       if($this->hasNext()){
00178         return $this->isValid($this->type);
00179       }
00180       return true;
00181     }
00182     return false;
00183   }

Here is the call graph for this function:


Field Documentation

zItem::$type

Definition at line 22 of file zitem.php.

Referenced by isDataValid(), isValid(), zItem(), and zList::zList().

zItem::$data

Definition at line 29 of file zitem.php.

zItem::$link = null

Definition at line 36 of file zitem.php.

zItem::$parent = null

Definition at line 43 of file zitem.php.


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

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