} else {
if (path[i].startsWith("C"))
{
long classId = parseObjectId(path[i]);
MemoryClass clazz = findClass(classId);
MemoryReferenceSummary summary = (MemoryReferenceSummary)summariesByClass.get(clazz);
currentList.clear();
if (summary!=null)
{
currentList.addAll(summary.getObjectsReferenced().values());
}
} else {
long objectId = parseObjectId(path[i]);
MemoryObject objectFound = findObject(objectId);
MemoryClass clazz = objectFound.getMemoryClass();
MemoryReferenceSummary summary = (MemoryReferenceSummary)summariesByClass.get(clazz);
if (summary!=null)
{
// We could look for the object at summary.getObjectsReferenced()... but we would get the same result... so, just don't bother about it.
currentList.add(objectFound);
}
}
summariesByClass.clear();
}
int count=0;
Iterator iter = currentList.iterator();
while (iter.hasNext())
{
if ((count++)%100==0)
{
System.out.println("Treated " + count + " references");
}
MemoryObject objectReference = (MemoryObject)iter.next();
ReferenceContainer container = this.dao.selectReferences(objectReference,forward);
if (container==null)
{
continue;
}
Iterator referencesToIterator = container.getListOfReferences().iterator();
while (referencesToIterator.hasNext())
{
MemoryReference reference = (MemoryReference) referencesToIterator.next();
MemoryObject objectReferenceTo = null;
objectReferenceTo=reference.getObjectReferred();
MemoryClass memoryClazz = this.solveClassReference(objectReferenceTo);
if (memoryClazz==null)
{
long classId=0;
if (objectReferenceTo!=null)
{
classId=objectReferenceTo.getClassId();
}
System.out.println("Didn't find class for " + classId + " Reference = (" + reference.toString()+ ")");
}
MemoryReferenceSummary summary = (MemoryReferenceSummary)summariesByClass.get(memoryClazz);
if (summary==null)
{
summary = new MemoryReferenceSummary();
summary.setReferenceTo(memoryClazz);
summariesByClass.put(memoryClazz,summary);
}
if (summary.getObjectsReferenced().get(objectReferenceTo)==null) {
summary.getObjectsReferenced().put(objectReferenceTo,objectReferenceTo);
summary.setNumberOfDistinctObjects(summary.getNumberOfDistinctObjects()+1);
}
summary.setNumberOfReferences(summary.getNumberOfReferences()+1);
if (reference.isThreadReference())
{
summary.setNumberOfThreadReferences(summary.getNumberOfThreadReferences()+1);
}
}
}
}