|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcommon.DefaultReferenceHistogram
public class DefaultReferenceHistogram
Default implementation of the ReferenceHistogram interface. It uses a HashMap to store the mapping from objects to numbers of references.
Field Summary |
---|
Fields inherited from interface common.ReferenceHistogram |
---|
EMPTY_HISTOGRAM |
Constructor Summary | |
---|---|
DefaultReferenceHistogram()
Creates a new DefaultReferenceHistogram with no references (and hence no referenced objects). |
Method Summary | |
---|---|
void |
addReference(java.lang.Long obj)
Adds to this histogram a reference referring to the given object. |
void |
changeReference(java.lang.Long oldObj,
java.lang.Long newObj)
Takes one of the references in this histogram that refers to oldObj, and makes it refer to newObj instead. |
int |
getNumReferences(java.lang.Long obj)
Returns the number of references for the given object. |
java.util.Iterator |
iterator()
Allows iteration over the objects that have at least one reference. |
int |
numReferencedObjects()
Returns the number of objects with at least one reference. |
void |
removeReference(java.lang.Long obj)
Removes from this histogram a reference referring to the given object. |
int |
totalReferences()
Returns the total number of references in this histogram. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultReferenceHistogram()
Method Detail |
---|
public void addReference(java.lang.Long obj)
obj
- a Long value representing the ID of the object that the
added reference refers topublic void removeReference(java.lang.Long obj)
obj
- a Long value representing the ID of the object that the
removed citation refers topublic void changeReference(java.lang.Long oldObj, java.lang.Long newObj)
public int numReferencedObjects()
ReferenceHistogram
numReferencedObjects
in interface ReferenceHistogram
public int totalReferences()
ReferenceHistogram
totalReferences
in interface ReferenceHistogram
public int getNumReferences(java.lang.Long obj)
ReferenceHistogram
getNumReferences
in interface ReferenceHistogram
obj
- a Long object representing an object IDpublic java.util.Iterator iterator()
ReferenceHistogram
iterator
in interface ReferenceHistogram
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |