common
Class ReferenceHistogramPair

java.lang.Object
  extended by common.ReferenceHistogramPair

public class ReferenceHistogramPair
extends java.lang.Object

Represents the partitions of two sets of references, called the foreground set and the background set. There are methods for moving a reference from one set to another; the foreground and background histograms are both updated, so that the total number of references referring to each object always remains the same. There are also methods for getting the foreground and background histograms, which implement the ReferenceHistogram interface and are backed by the ReferenceHistogramPair object. A ReferenceHistogramPair object does not maintain two separate histograms explicitly. Instead, it starts with one master histogram representing the full set of references. It represents the foreground histogram explicitly, and represents the background histogram implicitly as the difference between the master and foreground histograms. The point is that we don't have to explicitly construct the background histogram, which may be quite large. The master histogram is never changed.


Constructor Summary
ReferenceHistogramPair(ReferenceHistogram master)
          Creates a new ReferenceHistogramPair with this given master histogram, where all citations are initially in the background set.
 
Method Summary
 ReferenceHistogram getBackgroundHistogram()
          Returns a ReferenceHistogram object for the background set.
 ReferenceHistogram getForegroundHistogram()
          Returns a ReferenceHistogram object for the foreground set.
 void moveToBackground(java.lang.Long obj)
          Moves one reference referring to the given object from the foreground to the background.
 void moveToForeground(java.lang.Long obj)
          Moves one reference referring to the given object from the background to the foreground.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReferenceHistogramPair

public ReferenceHistogramPair(ReferenceHistogram master)
Creates a new ReferenceHistogramPair with this given master histogram, where all citations are initially in the background set.

Method Detail

moveToForeground

public void moveToForeground(java.lang.Long obj)
Moves one reference referring to the given object from the background to the foreground. Throws an IllegalStateException if there is no such reference in the background.

Parameters:
obj - the ID of the object referred to by the reference being moved

moveToBackground

public void moveToBackground(java.lang.Long obj)
Moves one reference referring to the given object from the foreground to the background. Throws an IllegalStateException if there is no such reference in the foreground.

Parameters:
obj - the ID of the object referred to by the reference being moved.

getForegroundHistogram

public ReferenceHistogram getForegroundHistogram()
Returns a ReferenceHistogram object for the foreground set.


getBackgroundHistogram

public ReferenceHistogram getBackgroundHistogram()
Returns a ReferenceHistogram object for the background set.