Public Member Functions | |
dataAt ($atIndex) | |
Return's teh Data at i'th Node. | |
& | at ($atIndex) |
Return the i'th Node Itself. | |
append ($val) | |
Appends a Data to teh Vector. | |
insert ($i, $val) | |
Inserts data on the specified Index. | |
find ($search) | |
Serches with the Data in the Vector and returns the matching Node's Index return's -1 if not found. | |
detach ($atIndex) | |
Removes a Node and Its Child Nodes too. | |
remove ($atIndex) | |
Remove the specified Node only. |
Definition at line 15 of file zvect.php.
zVect::dataAt | ( | $ | atIndex | ) |
Return's teh Data at i'th Node.
$atIndex | integer |
Definition at line 22 of file zvect.php.
References zItem::getNext(), and zItem::hasNext().
Referenced by find().
00022 { 00023 $i = 0; 00024 $dummyTmp = $this->getNext(); 00025 while($dummyTmp->hasNext()){ 00026 if($i == $atIndex)return $dummyTmp->getData(); 00027 $dummyTmp = $dummyTmp->getNext(); 00028 $i++; 00029 } 00030 if($i == $atIndex)return $dummyTmp->getData(); 00031 return false; 00032 }
& zVect::at | ( | $ | atIndex | ) |
Return the i'th Node Itself.
$atIndex | integer |
Definition at line 39 of file zvect.php.
References zItem::getNext(), zItem::hasNext(), and perror().
Referenced by insert(), and remove().
00039 { 00040 $i = 0; 00041 $dummyTmp = $this->getNext(); 00042 while($dummyTmp->hasNext()){ 00043 if($i == $atIndex)return $dummyTmp; 00044 $dummyTmp = $dummyTmp->getNext(); 00045 $i++; 00046 } 00047 if($i == $atIndex)return $dummyTmp; 00048 perror("<code>zigmoyd.comon.vector.at()</code><br />Index $atIndex not accessible. Possible Causes: The length of the vector is less than the index you have Specified e.g. there is no node on $atIndex Index"); 00049 return ($x=false); 00050 }
zVect::append | ( | $ | val | ) |
zVect::insert | ( | $ | i, | |
$ | val | |||
) |
Inserts data on the specified Index.
$i | integer | |
$val | zItem |
Definition at line 66 of file zvect.php.
References $val, at(), and zItem::zItem().
00066 { 00067 $tmpCarry = $this->at($i); 00068 $tmpHold = $tmpCarry->getNext(); 00069 $dummy = new zItem($this->type); 00070 $dummy->setData($val); 00071 $dummy->setNext($tmpHold); 00072 $tmpCarry->setNext($dummy); 00073 }
zVect::find | ( | $ | search | ) |
Serches with the Data in the Vector and returns the matching Node's Index return's -1 if not found.
$search | mixed |
Definition at line 80 of file zvect.php.
References dataAt(), and zList::length().
00080 { 00081 for($i=0;$i<$this->length();$i++){ 00082 if($this->dataAt($i) == $search){ 00083 return $i; 00084 } 00085 } 00086 return -1; 00087 }
zVect::detach | ( | $ | atIndex | ) |
Removes a Node and Its Child Nodes too.
$atIndex | integer |
Definition at line 93 of file zvect.php.
References zItem::hasNext().
00093 { 00094 $i = 0; 00095 $dummyTmp = &$this->link; 00096 while($dummyTmp->hasNext()){ 00097 if($i == $atIndex)return $dummyTmp->removeNext(); 00098 $dummyTmp = &$dummyTmp->link; 00099 $i++; 00100 } 00101 if($i == $atIndex)return $dummyTmp->removeNext(); 00102 return false; 00103 }
zVect::remove | ( | $ | atIndex | ) |
Remove the specified Node only.
$atIndex | integer |
Definition at line 109 of file zvect.php.
References at().
00109 { 00110 $tmpCarry = $this->at($i); 00111 $tmpHold = $tmpCarry->getNext(); 00112 $tmpCarry = $tmpCarry->getParent(); 00113 $tmpCarry->setNext($tmpHold); 00114 }