JADE Java Persistence API
1.0

com.jadeworld.jade
Class LightIterator<E>

java.lang.Object
  extended by com.jadeworld.jade.LightIterator<E>
All Implemented Interfaces:
java.util.Iterator<E>

public class LightIterator<E>
extends java.lang.Object
implements java.util.Iterator<E>

The Iterator class encapsulates the behavior required to sequentially access elements of a collection. Instances of the Iterator class are referred to as iterators. Use iterators to iterate two or more collections where the iterations are not nested or when the state of an iteration (that is, the position in a collection) needs to be remembered and the iteration resumed later. (The foreach instruction enables you to iterate through two collections simultaneously only if one iteration is nested within the other.) previous and hasPrevious are JADE extensions of Iterator based on ListIterator.


Constructor Summary
LightIterator(EntityManager em, Collection<E> name, boolean primitive)
           
 
Method Summary
 boolean hasNext()
          Returns true if the iteration has more elements, so that a next method will return an element.
 boolean hasPrevious()
          Returns true if the iteration has more elements, so that a back method will return an element.
 E next()
          Accesses successive entries one at a time in the collection to which the iteration is attached.
 E previous()
          Accesses successive entries one at a time in reverse order in the collection to which the iteration is attached.
 void remove()
          Not yet implemented
 void reset()
          Restarts an iteration.
 void startAtIndex(int index)
          Sets the starting position of the iterator in the attached collection to a relative index.
 void startAtObject(E object)
          Sets the starting position of the iterator in the attached collection at the position of the object specified in the object parameter.
 void startNearIndex(int index)
          Sets the starting position of the iterator in the attached collection approximate to a relative index.
 java.lang.String toString()
          Return the value when an object instance is displayed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LightIterator

public LightIterator(EntityManager em,
                     Collection<E> name,
                     boolean primitive)
Method Detail

toString

public java.lang.String toString()
Return the value when an object instance is displayed.

Overrides:
toString in class java.lang.Object
Returns:
Class name.

hasNext

public boolean hasNext()
Returns true if the iteration has more elements, so that a next method will return an element. Use in conjunction with the next method.

Specified by:
hasNext in interface java.util.Iterator<E>
Returns:
true if there are remaining items in the iteration.

next

public E next()
Accesses successive entries one at a time in the collection to which the iteration is attached.

Specified by:
next in interface java.util.Iterator<E>
Returns:
The next item in the collection, or null if there are no more.

remove

public void remove()
Not yet implemented

Specified by:
remove in interface java.util.Iterator<E>

reset

public void reset()
Restarts an iteration. After using the reset method, the following next() method invocation starts at the first entry in the collection or the next previous() method invocation starts at the end of the collection.

JADE-only method.


hasPrevious

public boolean hasPrevious()
Returns true if the iteration has more elements, so that a back method will return an element. Use in conjunction with the back method.

JADE-only method.

Returns:
true if there are remaining items in the iteration.

previous

public E previous()
Accesses successive entries one at a time in reverse order in the collection to which the iteration is attached.

JADE-only method.

Returns:
The next item in the collection, or null if there are no more.

startAtIndex

public void startAtIndex(int index)
Sets the starting position of the iterator in the attached collection to a relative index. Specify the required position in the index parameter.

JADE-only method.

Parameters:
index - The relative index in the collection at which to start.

startAtObject

public void startAtObject(E object)
Sets the starting position of the iterator in the attached collection at the position of the object specified in the object parameter.

JADE-only method.

Parameters:
object - The object whose location in the collection determines the start position.

startNearIndex

public void startNearIndex(int index)
Sets the starting position of the iterator in the attached collection approximate to a relative index. Specify the required position in the index parameter. Note: This method is implemented only for iterations of Array, Set, and Dictionary classes.

JADE-only method.

Parameters:
index - The relative index in the collection at which to start.

JADE Java Persistence API
1.0

Copyright © 2007 Jade Software Corporation