|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.dtfj.analyzer.util.ObjectIterator
public abstract class ObjectIterator
Iterate over all the objects in a heap or runtime. During the iteration we ignore all
corrupt objects and then apply a set of user definable filters to the remaining ones.
A set of filters is provided in com.ibm.dtfj.analyzer.util.filter and may be extended
by implementing a filter interface (See ObjectFilter
).
This iterator can be reset to conveniently allow multiple passes over a set of objects.
For an object to be accepted by a set of filters it must be accepted by at least one of
them and not rejected by any of them. To simplify the definition of these filter chains
it is possible to change to starting 'state' of objects - accepted or rejected. By default
this iterator starts with all objects in the rejected state and thus you must add at least
one filter to see any objects. By changing the defaultAcceptState to true the iterator will
accept all objects and a filter must be added if we want to reject any.
Field Summary | |
---|---|
protected IAnalyzerContext |
context
|
static int |
DEFAULT_LIMIT
Define the maximum number of corrupt data objects we will handle from a given iterator. |
Method Summary | |
---|---|
void |
addFilter(ObjectFilter filter)
Add a filter which will decide if any given object is a part of the set to iterate. |
static ObjectIterator |
build(com.ibm.dtfj.java.JavaHeap heap)
Iterate over all the objects in a JavaHeap. |
static ObjectIterator |
build(com.ibm.dtfj.java.JavaHeap heap,
IAnalyzerContext ctx)
Iterate over all the objects in a JavaHeap. |
static ObjectIterator |
build(com.ibm.dtfj.java.JavaRuntime run)
Iterate over all the objects in a JavaRuntime. |
static ObjectIterator |
build(com.ibm.dtfj.java.JavaRuntime run,
IAnalyzerContext ctx)
Iterate over all the objects in a JavaRuntime. |
int |
getCorruptObjectCount()
Count the total number of CorruptData objects that have been seen so far. |
boolean |
getDefaultAcceptState()
Return the initial assumption on accepting objects. |
protected abstract com.ibm.dtfj.java.JavaHeap |
getHeap()
|
protected boolean |
handleMoreCorruptObjects(java.lang.Object obj)
A convenience method that can be overridden to change the handling of corrupt objects. |
protected boolean |
handleMoreNulls(java.lang.Object obj)
|
boolean |
hasNext()
Test the iterator to see if there are any more objects to be returned to next(). |
protected abstract boolean |
hasNextRaw()
|
void |
iterateOverObjects(ObjectObserver observer)
Iterate over all the objects in the current set and call the given observer for each of them. |
long |
length()
Get the total number of elements which will be iterated over. |
com.ibm.dtfj.java.JavaObject |
next()
Get the next object from the iterator. |
protected abstract com.ibm.dtfj.java.JavaObject |
nextRaw()
|
void |
removeAllFilters()
Remove all the filters from this iterator. |
void |
removeFilter(ObjectFilter filter)
Remove the given filter from the set of active filters. |
void |
reset()
Reset the iterator so that we scan the objects from the start. |
void |
setDefaultAcceptState(boolean accept)
Define the initial assumption on accepting objects. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_LIMIT
protected IAnalyzerContext context
Method Detail |
---|
public static ObjectIterator build(com.ibm.dtfj.java.JavaRuntime run)
setDefaultAcceptState(boolean)
).
run
- the runtime to operate with - iterate over all objects
public static ObjectIterator build(com.ibm.dtfj.java.JavaRuntime run, IAnalyzerContext ctx)
setDefaultAcceptState(boolean)
).
run
- the runtime to operate with - iterate over all objectsctx
- context for reporting errors
public static ObjectIterator build(com.ibm.dtfj.java.JavaHeap heap)
setDefaultAcceptState(boolean)
).
heap
- the heap operate with - iterate over all objects
public static ObjectIterator build(com.ibm.dtfj.java.JavaHeap heap, IAnalyzerContext ctx)
setDefaultAcceptState(boolean)
).
heap
- the heap operate with - iterate over all objectsctx
- context for reporting errors
public void setDefaultAcceptState(boolean accept)
accept
- true to accept objects, false to reject them.public boolean getDefaultAcceptState()
public boolean hasNext()
public com.ibm.dtfj.java.JavaObject next()
public long length()
public void addFilter(ObjectFilter filter)
filter
- the filter to add - which must not be nullpublic void removeFilter(ObjectFilter filter)
filter
- the filter to remove - which must have been previously addedpublic void removeAllFilters()
public int getCorruptObjectCount()
public void iterateOverObjects(ObjectObserver observer)
observer
- the observer that will be invoked on each object.public final void reset()
protected boolean handleMoreCorruptObjects(java.lang.Object obj)
obj
- the corrupt object to handle
protected boolean handleMoreNulls(java.lang.Object obj)
protected abstract com.ibm.dtfj.java.JavaHeap getHeap()
protected abstract boolean hasNextRaw()
protected abstract com.ibm.dtfj.java.JavaObject nextRaw()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |