Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.base.stats.bin
Class CyclicSequence

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

public class CyclicSequence
extends java.lang.Object
implements BinSequence


Constructor Summary
CyclicSequence(long cycleSize)
          Create a BinSequence that will generate a sequence of regularly spaced intervals.
 
Method Summary
 Bin getBin(Element element)
          Get the Bin for the specified Element.
 Bin[] getBins(Element minElement, Element maxElement)
          Get a sequence of bins starting at minElement and ending with maxElement.
 Bin[] getBins(Element minElement, Element maxElement, boolean containsMin, boolean containsMax)
          Get a sequence of bins starting at minElement and ending with maxElement.
 Bin getNext(Bin bin)
          Get the next bin in the sequence following the specified bin
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

CyclicSequence

public CyclicSequence(long cycleSize)

Create a BinSequence that will generate a sequence of regularly spaced intervals. CyclicSequence differs from RegularSequence in that the elements are assumed to be cyclic. For example, the elements involved may be days if the week, in which case we might be interested in a sequence starting on Monday and ending on Sunday, or one starting on Saturday and ending on Friday. A few modifications to the RegularSequence code are needed to handle the wrapping around of elements in mid-sequence.

Parameters:
cycleSize - The length of the cycle
Method Detail

getBin

public Bin getBin(Element element)
Get the Bin for the specified Element.

Specified by:
getBin in interface BinSequence
Parameters:
element - an Element to be placed in a Bin
Returns:
a Bin containing the given Element

getNext

public Bin getNext(Bin bin)
Get the next bin in the sequence following the specified bin

Specified by:
getNext in interface BinSequence
Parameters:
bin - Current bin in the sequence
Returns:
Next bin in the sequence

getBins

public Bin[] getBins(Element minElement,
                     Element maxElement)

Get a sequence of bins starting at minElement and ending with maxElement.

Specified by:
getBins in interface BinSequence
Parameters:
minElement - An element used to define the beginning of the sequence
maxElement - An element used to define the end of the sequence
Returns:
The resulting array of Bins

getBins

public Bin[] getBins(Element minElement,
                     Element maxElement,
                     boolean containsMin,
                     boolean containsMax)

Get a sequence of bins starting at minElement and ending with maxElement.

Specified by:
getBins in interface BinSequence
Parameters:
minElement - An element used to define the beginning of the sequence
maxElement - An element used to define the end of the sequence
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.