00001 <?php
00008 #include <zitem.php>
00009 include_once('/media/SRV/zigmoyd/usr/lib/module/common/zitem.php');
00010
00015 class zList extends zItem{
00022 var $length=-1;
00023
00031 function zList($type, $length=-1){
00032 $this->length = $length;
00033 parent::zItem($type);
00034 }
00041 function mexLength($length=null){
00042 if($length != null)$this->length = $length;
00043 return $this->length;
00044 }
00050 function length(){
00051 $dummyLink = $this;
00052 $i = 0;
00053 while($dummyLink->hasNext()){
00054 $dummyLink = $dummyLink->getNext();
00055 $i++;
00056 }
00057 return $i;
00058 }
00065 function addData($val){
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 }
00085 function isMaxLengthOverFlow(){
00086 return !($this->length == -1 || $this->length() <= $this->length);
00087 }
00088 }
00090 ?>
00091 <?php
00092
00094
00095
00096
00097
00098
00099
00100
00101
00102 ?>