00001 <?php
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 class Varien_Db_Tree_NodeSet implements Iterator
00033 {
00034     private $_nodes = array();
00035     private $_currentNode = 0;
00036     private $_current = 0;
00037 
00038 
00039     function __construct() {
00040         $this->_nodes = array();
00041         $this->_current = 0;
00042         $this->_currentNode = 0;
00043         $this->count = 0;
00044     }
00045 
00046 
00047 
00048     function addNode(Varien_Db_Tree_Node $node) {
00049         $this->_nodes[$this->_currentNode] = $node;
00050         $this->count++;
00051         return ++$this->_currentNode;
00052     }
00053 
00054     function count() {
00055         return $this->count;
00056     }
00057 
00058 
00059     function valid() {
00060         return  isset($this->_nodes[$this->_current]);
00061     }
00062 
00063     function next() {
00064         if ($this->_current > $this->_currentNode) {
00065             return false;
00066         } else {
00067             return  $this->_current++;
00068         }
00069     }
00070 
00071     function key() {
00072         return $this->_current;
00073     }
00074 
00075 
00076     function current() {
00077         return $this->_nodes[$this->_current];
00078     }
00079 
00080     function rewind() {
00081         $this->_current = 0;
00082     }
00083 }