Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.base.stats.bin
Class TimeSigFigSequence

java.lang.Object
  extended by com.jivesoftware.base.stats.bin.TimeSigFigSequence
All Implemented Interfaces:
BinSequence

public class TimeSigFigSequence
extends java.lang.Object
implements BinSequence

TimeSigFigSequence is similar to SigFigSequence, but is specialized for producing sequences of times. SigFigSequence produces sequences in which successive bins have different orders of magnitude, e.g., 1, 10, 100, 1000. TimeSigFigSequence has similar behavior, but instead of increasing by powers of 10, TimeSigFigSequence increases first by powers of 10 and then by units, e.g., 1 second, 10 seconds, 1 minute, 10 minutes, 1 hour, 10 hours, 1 day, 1 week, 1 month, 10 months, 1 year.


Constructor Summary
TimeSigFigSequence(int sigFig, long step)
          Generate a new BinSequence object that truncates all but a specified # of significant figures from input elements.
 
Method Summary
 Bin getBin(Element element)
          Take an element, convert to the relevant time units, strip out all but sigFig significant figures, and build a new bin.
 Bin[] getBins(Element minElement, Element maxElement)
          Return a sequence of bins.
 Bin[] getBins(Element minElement, Element maxElement, boolean containsMin, boolean containsMax)
          Get a sequence of Bins.
 Bin getNext(Bin bin)
          Given a Bin, return the next Bin in the sequence
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeSigFigSequence

public TimeSigFigSequence(int sigFig,
                          long step)

Generate a new BinSequence object that truncates all but a specified # of significant figures from input elements. The toLong() function for each input element is assumed to yield a time in milliseconds. As with SigFigSequence, the sigFig parameter sets the number of significant figures to keep:

Parameters:
sigFig - The number of significant figures to retain
step - The step size to use in setting bin widths
Method Detail

getBin

public Bin getBin(Element element)
Take an element, convert to the relevant time units, strip out all but sigFig significant figures, and build a new bin.

Specified by:
getBin in interface BinSequence
Parameters:
element - The element to be mapped to a Bin
Returns:
The resulting Bin

getNext

public Bin getNext(Bin bin)
Given a Bin, return the next Bin in the sequence

Specified by:
getNext in interface BinSequence
Parameters:
bin - The current Bin
Returns:
The next Bin

getBins

public Bin[] getBins(Element minElement,
                     Element maxElement)
Return a sequence of bins.

Specified by:
getBins in interface BinSequence
Parameters:
minElement - An element that should be contained in the first Bin.
maxElement - An element that should be contained in the last Bin.
Returns:
The resulting array of Bins

getBins

public Bin[] getBins(Element minElement,
                     Element maxElement,
                     boolean containsMin,
                     boolean containsMax)
Get a sequence of Bins.

Specified by:
getBins in interface BinSequence
Parameters:
minElement - An element that defines the first Bin.
maxElement - An element that defines the last Bin.
containsMin - Should the list contain the first Bin?
containsMax - Should the list contain the last Bin?
Returns:
The resulting array of Bins

main

public static void main(java.lang.String[] args)

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.