00001 <?php 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 require_once(dirname(__FILE__) . '/KjwResultSet.php');
00021 
00028 class KjwArrayResultSet extends KjwResultSet {
00029         var $_data;                     
00030         var $_pointer;          
00037         function KjwArrayResultSet($resultset) {
00038                 assert(is_array($resultset));
00039                 parent::KjwResultSet();
00040                 $this->_pointer = 0;
00041                 $this->_data = $resultset; 
00042         }
00043 
00044         
00045         function destroy() {
00046                 unset($this->_data);
00047                 unset($this->_pointer);
00048                 parent::destroy();
00049         }
00050 
00051         
00052         function getNext() {
00053                 if ($this->_pointer >= sizeof($this->_data))
00054                         return false;
00055                 return $this->_data[$this->_pointer++];
00056         }
00057 
00058         
00059         function at() {
00060                 return $this->_pointer;
00061         }
00062 
00063         
00064         function size() {
00065                 return sizeof($this->_data);
00066         }
00067 
00068         
00069         function seekAbs($offset) {
00070                 if($offset < 0 || $offset >= sizeof($this->_data))
00071                         return false;
00072                 $this->_pointer = $offset;
00073                 return true;
00074         }
00075 }
00076 
00077 ?>