Packagesekati.collections
Classpublic class ArrayBounceIterator
ImplementsIIterator, IPointerIterator

ArrayBounceIterator provides a non-destructive, pointer-based, bouncing Array Iterator which iterates to the end of the array then reverses direction backward & forward.



Public Properties
 PropertyDefined by
  length : int
[read-only] Return the collection length.
ArrayBounceIterator
  pointer : int
The interative pointer index.
ArrayBounceIterator
Protected Properties
 PropertyDefined by
  _array : Array
ArrayBounceIterator
  _isForward : Boolean
ArrayBounceIterator
  _isSkipRepeat : Boolean
ArrayBounceIterator
  _pointer : int
ArrayBounceIterator
Public Methods
 MethodDefined by
  
ArrayBounceIterator(array:Array, isSkipRepeat:Boolean = true)
ArrayBounceIterator Constructor
ArrayBounceIterator
  
current():Object
Return the current element
ArrayBounceIterator
  
hasNext():Boolean
We always have a next element as we bounce at each iteration end.
ArrayBounceIterator
  
next():Object
Returns the next element, or null if none.
ArrayBounceIterator
  
peek():Object
Return a peek of the next element without directionally iterating the pointer forwards, or return null if none.
ArrayBounceIterator
  
reset():void
Reset iterative pointer index.
ArrayBounceIterator
Protected Methods
 MethodDefined by
  
movePointer(isPreview:Boolean = false):int
Move the pointer in the proper direction; bounce at either end.
ArrayBounceIterator
Property detail
_arrayproperty
protected var _array:Array
_isForwardproperty 
protected var _isForward:Boolean
_isSkipRepeatproperty 
protected var _isSkipRepeat:Boolean
lengthproperty 
length:int  [read-only]

Return the collection length.

Implementation
    public function get length():int
_pointerproperty 
protected var _pointer:int
pointerproperty 
pointer:int  [read-write]

The interative pointer index.

Implementation
    public function get pointer():int
    public function set pointer(value:int):void
Constructor detail
ArrayBounceIterator()constructor
public function ArrayBounceIterator(array:Array, isSkipRepeat:Boolean = true)

ArrayBounceIterator Constructor

Parameters
array:Array — of collection elements.
 
isSkipRepeat:Boolean (default = true) — if true iterate '0,1,2,1,0' rather than '0,1,2,2,1,0'.
Method detail
current()method
public function current():Object

Return the current element

Returns
Object
hasNext()method 
public function hasNext():Boolean

We always have a next element as we bounce at each iteration end.

Returns
Boolean
movePointer()method 
protected function movePointer(isPreview:Boolean = false):int

Move the pointer in the proper direction; bounce at either end.

Parameters
isPreview:Boolean (default = false) — if true the pointer will not be iterated; but will return a preview pointer index.

Returns
int
next()method 
public function next():Object

Returns the next element, or null if none.

Returns
Object
peek()method 
public function peek():Object

Return a peek of the next element without directionally iterating the pointer forwards, or return null if none.

Returns
Object
reset()method 
public function reset():void

Reset iterative pointer index.