|
Jive Forums API (5.5.20.2-oracle) Developer Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jivesoftware.base.stats.Element
com.jivesoftware.base.stats.element.LongElement
com.jivesoftware.base.stats.element.CyclicElement
public class CyclicElement
An Element for which values wrap around after being incremented a sufficient number of times. This type of element is useful for dealing with days of the week, months of the year, hours of the day, and so on. Usually used with a CyclicSequence.
CyclicSequence
Constructor Summary | |
---|---|
CyclicElement(long cycleSize,
long cycleStart,
long n)
Creates new CyclicElement with a specified cycle size, lower bound and an initial starting point. |
Method Summary | |
---|---|
int |
compare(java.lang.Object o1,
java.lang.Object o2)
Compare two CyclicElements. |
boolean |
equals(java.lang.Object o)
Test two CyclicEements for equality. |
long |
getCanonicalValue(long n)
Helper function used to map a long to a value in [cycleStart, cycleStart+cycleSize) |
long |
getCycleSize()
Returns the size of the cycle, for example 7 for a week long cycle. |
long |
getCycleStart()
Returns the lower bound of the cycle. |
Element |
getInstance(long n)
Generate a new CyclicElement. |
int |
hashCode()
Generate a hashCode for the current element. |
static void |
main(java.lang.String[] args)
|
Methods inherited from class com.jivesoftware.base.stats.element.LongElement |
---|
compareTo, getValue, setLongElement, toLong, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CyclicElement(long cycleSize, long cycleStart, long n)
cycleSize
- the length of the cycle. When the internal counter
reaches cycleSize+cycleStart, the counter will be reset to
cycleStart.cycleStart
- Start of the cycle, used for comparing two
CyclicElements.n
- Value of this element.Method Detail |
---|
public long getCycleSize()
public long getCycleStart()
public Element getInstance(long n)
getInstance
in class LongElement
n
- Value for new CyclicElement
public int hashCode()
hashCode
in class LongElement
public boolean equals(java.lang.Object o)
equals
in class LongElement
public int compare(java.lang.Object o1, java.lang.Object o2)
o1
- First object to compare.o2
- Second object to compare.
public long getCanonicalValue(long n)
public static void main(java.lang.String[] args)
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |