com.ibm.dtfj.analyzer.util
Class DTFJSortedIterator

java.lang.Object
  extended by com.ibm.dtfj.analyzer.util.DTFJIterator
      extended by com.ibm.dtfj.analyzer.util.DTFJSortedIterator
All Implemented Interfaces:
java.util.Iterator

public class DTFJSortedIterator
extends DTFJIterator

This class extends the basic capability of DTFJIterator and additionally ensures that the objects are returned in a well defined sort order. The sorting is currently controlled internally and the sort order cannot be changed. Note that this is not optimised for large collections so is ulnlikely to perform well if handed an Iterator over all objects. At present it is aimed at sorting JavaClassloaders and Threads etc.


Field Summary
 
Fields inherited from class com.ibm.dtfj.analyzer.util.DTFJIterator
context, DEFAULT_LIMIT, rawIterator
 
Constructor Summary
DTFJSortedIterator(java.util.Iterator it)
          A 'sorted' iterator which has the same semantics as the underlying 'safe' iterator and adds the sorting semantic.
DTFJSortedIterator(java.util.Iterator it, IAnalyzerContext ctx)
          A 'sorted' iterator which has the same semantics as the underlying 'safe' iterator and adds the sorting semantic.
 
Method Summary
 boolean hasNext()
          We override this one just to make it clear that there's no further need to alter the raw iterator semantic since we handled CorruptData when building the collection.
 java.lang.Object next()
          We override this one just to make it clear that there's no further need to alter the raw iterator semantic since we handled CorruptData when building the collection.
 void remove()
          (non-Javadoc)
 
Methods inherited from class com.ibm.dtfj.analyzer.util.DTFJIterator
getCorruptObjectCount, getNullCount, handleMoreCorruptObjects, handleMoreNulls
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DTFJSortedIterator

public DTFJSortedIterator(java.util.Iterator it,
                          IAnalyzerContext ctx)
A 'sorted' iterator which has the same semantics as the underlying 'safe' iterator and adds the sorting semantic. At present it sorts the iterator based on the identity key that we build in the helper method in IdentityKeyHelper.

Parameters:
it - the iterator that we are going to wrap
ctx - the current analyzer context

DTFJSortedIterator

public DTFJSortedIterator(java.util.Iterator it)
A 'sorted' iterator which has the same semantics as the underlying 'safe' iterator and adds the sorting semantic. At present it sorts the iterator based on the identity key that we build in the helper method in IdentityKeyHelper.

Parameters:
it - the iterator that we are going to wrap
Method Detail

remove

public void remove()
(non-Javadoc)

Specified by:
remove in interface java.util.Iterator
Overrides:
remove in class DTFJIterator
See Also:
Iterator.remove()

hasNext

public boolean hasNext()
We override this one just to make it clear that there's no further need to alter the raw iterator semantic since we handled CorruptData when building the collection. The inherited method would work but be slightly slower.

Specified by:
hasNext in interface java.util.Iterator
Overrides:
hasNext in class DTFJIterator
See Also:
Iterator.hasNext()

next

public java.lang.Object next()
We override this one just to make it clear that there's no further need to alter the raw iterator semantic since we handled CorruptData when building the collection. The inherited method would work but be slightly slower.

Specified by:
next in interface java.util.Iterator
Overrides:
next in class DTFJIterator
See Also:
Iterator.next()


© Copyright IBM Corp. 2007, 2008 All Rights Reserved. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.