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.
562 563 564 565 566 |
# File 'lib/appengine-apis/datastore.rb', line 562 def initialize(array) @array = array @index = 0 @removed = false end |
Instance Method Details
#hasNext ⇒ Object
568 569 570 |
# File 'lib/appengine-apis/datastore.rb', line 568 def hasNext @index < @array.size end |
#next ⇒ Object
572 573 574 575 576 577 |
# File 'lib/appengine-apis/datastore.rb', line 572 def next raise java.util.NoSuchElementException unless hasNext @removed = false @index += 1 @array[@index - 1] end |
#remove ⇒ Object
579 580 581 582 583 584 |
# File 'lib/appengine-apis/datastore.rb', line 579 def remove raise java.lang.IllegalStateException if @removed raise java.lang.IllegalStateException unless @index > 0 @removed = true @array.delete_at(@index - 1) end |