Formatting output Plese Wait...
zItem Class Constructs a Node of a Linked List or a tree
More...
|
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( String $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:
-
- Returns:
- zItem
Definition at line 51 of file zitem.php.
References $type.
Referenced by zList::addData(), and zVect::insert().
Show Source00051 {
00052 $this->type = $type;
00053 }
Top
Checks wheather or not the Current Node has a Parent.
- Returns:
- boolean
Definition at line 59 of file zitem.php.
Show Source00059 {
00060 return is_null($this->parent);
00061 }
Top
Sets the Parent Node of a Node.
- Parameters:
-
| $parentNode | class="el" href="classzItem.php" title="zItem Class Constructs a Node of a Linked List or a tree">zItem |
Definition at line 67 of file zitem.php.
References getType(), ofPolymorphicType(), perror(), and typeId().
Show Source00067 {
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 }
Top
Returns a Reference to the Parent Node.
- Returns:
- zItem
Definition at line 84 of file zitem.php.
Show Source00084 {
00085 return $this->parent;
00086 }
Top
zItem::setData( mixed $val )
Store Data in teh data Block Data Must be of same type as it is Supposed to be.
- Parameters:
-
- Returns:
- boolean
Definition at line 93 of file zitem.php.
References $val, ofType(), perror(), and typeId().
Show Source00093 {
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 }
Top
Returns teh Data in the data Block.
- Returns:
- mixed
Definition at line 106 of file zitem.php.
Show Source00106 {
00107 return $this->data;
00108 }
Top
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 | class="el" href="classzItem.php" title="zItem Class Constructs a Node of a Linked List or a tree">zItem |
- Returns:
- boolean
Definition at line 123 of file zitem.php.
References getType(), ofType(), perror(), and typeId().
Show Source00123 {
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 }
Top
Removes the Link.
Definition at line 148 of file zitem.php.
Show Source00148 {
00149 unset($this->link);
00150 $this->link = null;
00151 }
Top
retrns teh TypeId used in this Node
- Returns:
- String
Definition at line 157 of file zitem.php.
Referenced by setNext(), and setParent().
Show Source00157 {
00158 return $this->type;
00159 }
Top
zItem::isDataValid( String $type )
Checks Wheather or not the Current Node Contains a Valid Type Safe Data in Its Data Block.
- Parameters:
-
- Returns:
- boolean
Definition at line 166 of file zitem.php.
References $type, and typeId().
Referenced by isValid().
Show Source00166 {
00167 return (typeId($this->data)==$type);
00168 }
Top
zItem::isValid( String $type )
Checks wheather this Node as well as the Child Nodes are Valid Recursively.
- Parameters:
-
- Returns:
- boolean
Definition at line 175 of file zitem.php.
References $type, hasNext(), and isDataValid().
Show Source00175 {
00176 if($this->isDataValid($type)){
00177 if($this->hasNext()){
00178 return $this->isValid($this->type);
00179 }
00180 return true;
00181 }
00182 return false;
00183 }
Top
Field Documentation
The documentation for this class was generated from the following file: