| Package | system.data.iterators |
| Class | public class PageByPageIterator |
| Inheritance | PageByPageIterator Object |
| Implements | OrderedIterator |
1 the next and previous methods returns the single value element in the data array.
Example :
import system.iterator.PageByPageIterator;
var ar:Array = [1, 2, 3, 4, 5, 6, 7, 8] ;
var it:PageByPageIterator = new PageByPageIterator( a, 2 ) ;
var next:Function = function():void
{
if (!it.hasNext())
{
it.reset() ;
}
var next:= it.next()
trace( "> " + next + " : " + it.currentPage() ) ;
}
var prev:Function = function():void
{
var prev:;
if ( !it.hasPrevious())
{
it.lastPage() ;
// use it.current() to get the current page after a it.lastPage() invokation.
prev = it.current() ;
}
else
{
prev = it.previous() ;
}
trace( "> " + prev + " : " + it.currentPage() ) ;
}
next() ; // > 1,2 : 1
next() ; // > 3,4 : 2
next() ; // > 5,6 : 3
next() ; // > 7,8 : 4
next() ; // > 1,2 : 1
prev() ; // > 7,8 : 4
trace( "> current : " + it.current() ) ;
| Property | Defined By | ||
|---|---|---|---|
| DEFAULT_STEP : Number = 1 [static]
The default step value in all the PageByPageIterators. | PageByPageIterator | ||
| Method | Defined By | ||
|---|---|---|---|
PageByPageIterator(data:Array, stepSize:uint = 1)
Creates a new PageByPageIterator. | PageByPageIterator | ||
current():*
Returns the current value. | PageByPageIterator | ||
currentPage():Number
Returns the current page value. | PageByPageIterator | ||
firstPage():void
Seek the iterator in the first page of this object. | PageByPageIterator | ||
getStepSize():Number
Returns the step size of this PageByPageIterator. | PageByPageIterator | ||
hasNext():Boolean
Returns true if the iteration has more elements. | PageByPageIterator | ||
hasPrevious():Boolean
Checks to see if there is a previous element that can be iterated to. | PageByPageIterator | ||
key():*
Returns the current page number. | PageByPageIterator | ||
lastPage():void
Seek the iterator in the last page of this object. | PageByPageIterator | ||
next():*
Returns the next Array page of elements or the next element in the Array if the getStepSize() value is 1. | PageByPageIterator | ||
pageCount():Number
Returns the numbers of page of this iterator. | PageByPageIterator | ||
previous():*
Returns the previous Array page of elements or the previous element in the Array if the getStepSize() value is 1. | PageByPageIterator | ||
remove():*
Unsupported operation in a PageByPageIterator. | PageByPageIterator | ||
reset():void
Resets the key pointer of the iterator. | PageByPageIterator | ||
seek(position:*):void
Seek the key pointer of the iterator. | PageByPageIterator | ||
| DEFAULT_STEP | property |
public static var DEFAULT_STEP:Number = 1The default step value in all the PageByPageIterators.
| PageByPageIterator | () | Constructor |
public function PageByPageIterator(data:Array, stepSize:uint = 1)Creates a new PageByPageIterator.
Parametersdata:Array — the array to enumerate.
| |
stepSize:uint (default = 1) — the step size value.
|
IllegalOperationError — if the data array is empty.
|
| current | () | method |
public function current():*Returns the current value.
Returns* — the current value.
|
| currentPage | () | method |
public function currentPage():NumberReturns the current page value.
ReturnsNumber — the number of the current page.
|
| firstPage | () | method |
public function firstPage():voidSeek the iterator in the first page of this object.
| getStepSize | () | method |
public function getStepSize():NumberReturns the step size of this PageByPageIterator.
ReturnsNumber — the step size of this PageByPageIterator.
|
| hasNext | () | method |
public function hasNext():Boolean
Returns true if the iteration has more elements.
Boolean — true if the iterator has more elements.
|
| hasPrevious | () | method |
public function hasPrevious():BooleanChecks to see if there is a previous element that can be iterated to.
ReturnsBoolean — true if the iterator has more elements.
|
| key | () | method |
public function key():*Returns the current page number.
Returns* — the current page number.
|
| lastPage | () | method |
public function lastPage():voidSeek the iterator in the last page of this object.
| next | () | method |
public function next():*Returns the next Array page of elements or the next element in the Array if the getStepSize() value is 1.
Returns* — the next Array page of elements or the next element in the Array if the getStepSize() value is 1.
|
| pageCount | () | method |
public function pageCount():NumberReturns the numbers of page of this iterator.
ReturnsNumber — the numbers of page of this iterator.
|
| previous | () | method |
public function previous():*Returns the previous Array page of elements or the previous element in the Array if the getStepSize() value is 1.
Returns* — the previous element from the collection.
|
| remove | () | method |
public function remove():*Unsupported operation in a PageByPageIterator.
Returns* |
IllegalOperationError — the method remove() in this iterator is unsupported.
|
| reset | () | method |
public function reset():voidResets the key pointer of the iterator.
| seek | () | method |
public function seek(position:*):voidSeek the key pointer of the iterator.
Parameters
position:* |