Class: AppEngine::Datastore::Iterator
- Inherits:
-
Object
- Object
- AppEngine::Datastore::Iterator
- Defined in:
- lib/appengine-apis/datastore.rb
Overview
:nodoc:
Instance Method Summary collapse
- #hasNext ⇒ Object
-
#initialize(array) ⇒ Iterator
constructor
A new instance of Iterator.
- #next ⇒ Object
- #remove ⇒ Object
Constructor Details
#initialize(array) ⇒ Iterator
Returns a new instance of Iterator.
570 571 572 573 574 |
# File 'lib/appengine-apis/datastore.rb', line 570 def initialize(array) @array = array @index = 0 @removed = false end |
Instance Method Details
#hasNext ⇒ Object
576 577 578 |
# File 'lib/appengine-apis/datastore.rb', line 576 def hasNext @index < @array.size end |
#next ⇒ Object
580 581 582 583 584 585 |
# File 'lib/appengine-apis/datastore.rb', line 580 def next raise java.util.NoSuchElementException unless hasNext @removed = false @index += 1 @array[@index - 1] end |
#remove ⇒ Object
587 588 589 590 591 592 |
# File 'lib/appengine-apis/datastore.rb', line 587 def remove raise java.lang.IllegalStateException if @removed raise java.lang.IllegalStateException unless @index > 0 @removed = true @array.delete_at(@index - 1) end |