JADE Java Persistence API
1.0

com.jadeworld.jade.rootschema
Class Iterator<E>

java.lang.Object
  extended by com.jadeworld.jade.rootschema.Object
      extended by com.jadeworld.jade.rootschema.Iterator<E>
All Implemented Interfaces:
java.util.Iterator<E>
Direct Known Subclasses:
ArrayIterator, DictIterator, SetIterator, VCollIterator

public class Iterator<E>
extends 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.


Field Summary
 
Fields inherited from class com.jadeworld.jade.rootschema.Object
oid
 
Constructor Summary
Iterator()
           
 
Method Summary
 boolean hasNext()
          Returns true if the iteration has more elements, so that a next will return an element.
 boolean hasPrevious()
          Returns true if the iteration has more elements, so that a back 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(Object 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.
 
Methods inherited from class com.jadeworld.jade.rootschema.Object
changeObjectVolatility, creationTime, edition, equals, exclusiveLock, getClassNumberForObject, getInstanceIdForObject, getLockStatus, getName, getObjectStringForObject, getObjectVolatility, getOidString, getOidStringForObject, getPropertyValue, hashCode, hasMembers, isImportedObject, isKindOf, isLockedByMe, isObjectFrozen, isObjectNonSharedTransient, isObjectPersistent, isObjectSharedTransient, isObjectStable, isObjectTransient, isObjectVolatile, isSharedTransient, isSystemObject, isTransient, latestEdition, lock, makeObjectFrozen, makeObjectStable, makeObjectVolatile, reserveLock, sdeCauseEvent, sdsCauseEvent, setPropertyValue, sharedLock, toString, tryLock, unlock, updateObjectEdition
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Iterator

public Iterator()
Method Detail

hasNext

public boolean hasNext()
Returns true if the iteration has more elements, so that a next 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 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(Object 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