Hoa central
Public Member Functions | Protected Attributes | List of all members
Hoa\Iterator\Lookahead Class Reference
Inheritance diagram for Hoa\Iterator\Lookahead:

Public Member Functions

 __construct (\Iterator $iterator)
 
 getInnerIterator ()
 
 current ()
 
 key ()
 
 next ()
 
 rewind ()
 
 valid ()
 
 hasNext ()
 
 getNext ()
 
 getNextKey ()
 

Protected Attributes

 $_iterator = null
 
 $_key = 0
 
 $_current = null
 
 $_valid = false
 

Detailed Description

Class .

Look ahead iterator.

Definition at line 47 of file Lookahead.php.

Constructor & Destructor Documentation

Hoa\Iterator\Lookahead::__construct ( \Iterator  $iterator)

Construct.

Parameters
\Iterator$iteratorIterator.
Returns
void

Definition at line 87 of file Lookahead.php.

88  {
89  $this->_iterator = $iterator;
90 
91  return;
92  }

Member Function Documentation

Hoa\Iterator\Lookahead::current ( )

Return the current element.

Returns
mixed

Definition at line 109 of file Lookahead.php.

110  {
111  return $this->_current;
112  }
Hoa\Iterator\Lookahead::getInnerIterator ( )

Get inner iterator.

Returns

Definition at line 99 of file Lookahead.php.

100  {
101  return $this->_iterator;
102  }

Here is the caller graph for this function:

Hoa\Iterator\Lookahead::getNext ( )

Get next value.

Returns
mixed

Definition at line 182 of file Lookahead.php.

183  {
184  return $this->getInnerIterator()->current();
185  }

Here is the call graph for this function:

Hoa\Iterator\Lookahead::getNextKey ( )

Get next key.

Returns
mixed

Definition at line 192 of file Lookahead.php.

193  {
194  return $this->getInnerIterator()->key();
195  }

Here is the call graph for this function:

Hoa\Iterator\Lookahead::hasNext ( )

Check whether there is a next element.

Returns
bool

Definition at line 172 of file Lookahead.php.

173  {
174  return $this->getInnerIterator()->valid();
175  }

Here is the call graph for this function:

Hoa\Iterator\Lookahead::key ( )

Return the key of the current element.

Returns
mixed

Definition at line 119 of file Lookahead.php.

120  {
121  return $this->_key;
122  }
Hoa\Iterator\Lookahead::next ( )

Move forward to next element.

Returns
void

Definition at line 129 of file Lookahead.php.

130  {
131  $innerIterator = $this->getInnerIterator();
132  $this->_valid = $innerIterator->valid();
133 
134  if (false === $this->_valid) {
135  return;
136  }
137 
138  $this->_key = $innerIterator->key();
139  $this->_current = $innerIterator->current();
140 
141  return $innerIterator->next();
142  }

Here is the call graph for this function:

Here is the caller graph for this function:

Hoa\Iterator\Lookahead::rewind ( )

Rewind the iterator to the first element.

Returns
void

Definition at line 149 of file Lookahead.php.

150  {
151  $out = $this->getInnerIterator()->rewind();
152  $this->next();
153 
154  return $out;
155  }

Here is the call graph for this function:

Hoa\Iterator\Lookahead::valid ( )

Check if current position is valid.

Returns
bool

Definition at line 162 of file Lookahead.php.

163  {
164  return $this->_valid;
165  }

Member Data Documentation

Hoa\Iterator\Lookahead::$_current = null
protected

Definition at line 70 of file Lookahead.php.

Hoa\Iterator\Lookahead::$_iterator = null
protected

Definition at line 56 of file Lookahead.php.

Hoa\Iterator\Lookahead::$_key = 0
protected

Definition at line 63 of file Lookahead.php.

Hoa\Iterator\Lookahead::$_valid = false
protected

Definition at line 77 of file Lookahead.php.


The documentation for this class was generated from the following file: