<?
class Iterator
{
 var $dataList = null;

 function Iterator($dataList)
 {
  $this->dataList = $dataList;
 }

    //+------------------------------------------------------------------------------------------------------------
   //Desc:取第一个元素
 function moveFirst()
 {
  reset($this->dataList);
  return current($this->dataList);
 }

    //+——--------------------------------------------------------------------------------------------------------
   //Desc:取下一个元素
 function moveNext()
 {
  if(next($this->dataList))
  {
   return current($this->dataList);
  }  
 }

    //+-----------------------------------------------------------------------------------------------------------
   //Desc:取前一个元素
 function movePrev()
 {
  if(prev($this->dataList))
  {
   return current($this->dataList);
  }
 }

    //+-----------------------------------------------------------------------------------------------------------
   //Desc:取最后一个元素
 function moveLast()
 {
  end($this->dataList);
  return current($this->dataList);
 }
}
?>

posted on 2007-01-06 12:10  成都发哥  阅读(197)  评论(0)    收藏  举报