|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object biz.chitec.quarterback.util.ValueHistoryStorage
Storage for development of a value through the time. Integer values which evolve over the time are a quite common data pattern. This class allows to store those values, evaluate them and do further work on then, especially regarding statistical needs.
The class' main idea is that certain changes of a value occur and will be accumulated. These changes are stored in a relative way first (incremented by one, decremented by two etc.), and can be turned into absolute values in a second step. This "absolutifying" can be done for an arbitrary head part of the stored values only, also. This is useful in case that the data is archieved in a way that it is possible to ensure that no more changes will occur to data earlier than a certain point of time.
Under the same assumption, a split operation is implemented which splits any first part from the storage and returns it separately. Any finished parts can be handled separately this way.
ValueHistoryStorage implements some basic functions for evaluating the selected data. Namely, this is the possibility to generate average values over the cumulated data for certain time ranges. This allows a wide variety of statistical evaluations on the data.
This class is built on the Collection framework of Java 1.2 and supports the chitec GJSA for String-encapsulated transmission over network connections.
Nested Class Summary | |
private static class |
ValueHistoryStorage.QuantiEntry
Small helper class for the QuantifiedIterator. |
private class |
ValueHistoryStorage.QuantifiedIterator
Quantification iterator. |
static class |
ValueHistoryStorage.ValueMark
Helper class to store a value at a certain point of time. |
Field Summary | |
private java.util.TreeMap |
data
The data of the storage. |
private static java.text.NumberFormat |
doubleformatter
Static formatter for debugging purposes. |
private boolean |
hasabsvalues
Internal markers to store whether absolute or relative values exist in the storage. |
private boolean |
hasrelvalues
Internal markers to store whether absolute or relative values exist in the storage. |
private EDate |
maxabsolutified
Maximum date with an absolute value. |
private EDate |
maxdate
minimum and maximum date. |
private EDate |
mindate
minimum and maximum date. |
private EDate |
minrelativified
Minimum date with a relative value. |
private EDate |
quantifier
quantifier for quantifiying on input. |
Constructor Summary | |
|
ValueHistoryStorage()
Initializes the storage without any date restrictions. |
|
ValueHistoryStorage(EDate mind,
EDate maxd)
Initializes the storage with an interval in which it should operate. |
|
ValueHistoryStorage(EDate mind,
EDate maxd,
EDate qx)
Initializes the storage with an interval in which it should operate and a quantifier. |
private |
ValueHistoryStorage(EDate mind,
EDate maxd,
EDate qx,
boolean hasabsx,
boolean hasrelx,
EDate maxabsx,
EDate minrelx,
java.util.TreeMap dx)
Internal constructor setting all values. |
Method Summary | |
void |
absolutify()
Absolutify the whole storage. |
void |
absolutify(EDate lastabsolute)
Absolutifies from beginning up to a certain date. |
void |
canonify()
Drops unneeded information. |
static ValueHistoryStorage |
createInstanceGJSA(java.lang.Object[] o)
Create an instance of this class by GJSA data. |
void |
cumulateRelative(EDate thedate,
int relval)
Cumulate a relative value for any point of time. |
private boolean |
dateEquals(EDate d1,
EDate d2)
Convenience function to compare possibly nulled dates. |
void |
ensureAvailability(EDate adate)
Ensures, that for a certain point of time, a value exists. |
boolean |
equals(java.lang.Object o)
Compare storage with another one. |
int |
get(EDate d)
Get absolute data at a certain point of time. |
java.lang.Object[] |
getGJSAData()
Returns the private content of the object as an array. |
EDate |
getMaxDate()
Get maximum date. |
EDate |
getMinDate()
Get minimum date. |
java.util.Iterator |
getQuantifiedIterator(EDate distance)
Get iterator for whole time range of the storage. |
java.util.Iterator |
getQuantifiedIterator(EDate from,
EDate until,
EDate distance)
Return an iterator with quantified average values for the stored data. |
java.util.Iterator |
getQuantifiedIterator(java.util.Iterator it)
Get iterator for whole time range of the storage. |
java.util.Iterator |
getQuantifiedIterator(java.util.Iterator it,
EDate until)
Return iterator with quantified average values for the stored data. |
java.util.SortedMap |
getQuantifiedMap(EDate distance)
Returns map with average values through the whole storage. |
java.util.SortedMap |
getQuantifiedMap(EDate from,
EDate until,
EDate distance)
Return quantified values as a map. |
void |
mergeWith(ValueHistoryStorage other)
Merges this storage with another. both storages should store data of disjunct time ranges. |
private EDate |
prepareDate(EDate thedate,
boolean dropoutranged)
Prepare date internally. |
void |
relativify()
Relativifies the whole storage. |
void |
relativify(EDate lastrelative)
Relativifies from a certain point of time to the end of the storage. |
void |
setAbsolute(EDate thedate,
int absval)
Set an absolute value for any point of time. |
void |
setMaxDate(EDate mdx)
Set maximum date. |
void |
setMinDate(EDate mdx)
Set minimum date. |
void |
setQuantifier(EDate qx)
Set quantifier. |
ValueHistoryStorage |
splitAt(EDate split)
Splits the storage into two independant parts. |
java.lang.String |
toString()
For debugging purposes only. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private java.util.TreeMap data
private EDate mindate
private EDate maxdate
private EDate quantifier
private boolean hasabsvalues
private boolean hasrelvalues
private EDate maxabsolutified
private EDate minrelativified
private static java.text.NumberFormat doubleformatter
Constructor Detail |
public ValueHistoryStorage()
public ValueHistoryStorage(EDate mind, EDate maxd)
mind
- Description of the Parametermaxd
- Description of the Parameterpublic ValueHistoryStorage(EDate mind, EDate maxd, EDate qx)
mind
- Description of the Parametermaxd
- Description of the Parameterqx
- Description of the Parameterprivate ValueHistoryStorage(EDate mind, EDate maxd, EDate qx, boolean hasabsx, boolean hasrelx, EDate maxabsx, EDate minrelx, java.util.TreeMap dx)
mind
- Description of the Parametermaxd
- Description of the Parameterqx
- Description of the Parameterhasabsx
- Description of the Parameterhasrelx
- Description of the Parametermaxabsx
- Description of the Parameterminrelx
- Description of the Parameterdx
- Description of the ParameterMethod Detail |
public java.lang.Object[] getGJSAData()
public static ValueHistoryStorage createInstanceGJSA(java.lang.Object[] o)
public void setMinDate(EDate mdx)
mdx
- The new minDate valuepublic EDate getMinDate()
public void setMaxDate(EDate mdx)
mdx
- The new maxDate valuepublic EDate getMaxDate()
public void setQuantifier(EDate qx)
qx
- The new quantifier valueprivate EDate prepareDate(EDate thedate, boolean dropoutranged)
thedate
- Description of the Parameterdropoutranged
- Description of the Parameter
public void setAbsolute(EDate thedate, int absval)
thedate
- The new absolute valueabsval
- The new absolute valuepublic void cumulateRelative(EDate thedate, int relval)
thedate
- Description of the Parameterrelval
- Description of the Parameterpublic int get(EDate d)
d
- Description of the Parameter
public void canonify()
public void absolutify()
public void absolutify(EDate lastabsolute)
lastabsolute
- Description of the Parameterpublic void relativify()
public void relativify(EDate lastrelative)
lastrelative
- Description of the Parameterpublic void ensureAvailability(EDate adate)
adate
- Description of the Parameterpublic ValueHistoryStorage splitAt(EDate split)
The returned storage contains only absolute values.
split
- Description of the Parameter
public void mergeWith(ValueHistoryStorage other)
other
- Description of the Parameterprivate boolean dateEquals(EDate d1, EDate d2)
d1
- Description of the Parameterd2
- Description of the Parameter
public boolean equals(java.lang.Object o)
o
- Description of the Parameter
public java.util.Iterator getQuantifiedIterator(EDate from, EDate until, EDate distance)
from
- Description of the Parameteruntil
- Description of the Parameterdistance
- Description of the Parameter
public java.util.Iterator getQuantifiedIterator(java.util.Iterator it, EDate until)
it
- Description of the Parameteruntil
- Description of the Parameter
public java.util.Iterator getQuantifiedIterator(EDate distance)
distance
- Description of the Parameter
public java.util.Iterator getQuantifiedIterator(java.util.Iterator it)
it
- Description of the Parameter
public java.util.SortedMap getQuantifiedMap(EDate from, EDate until, EDate distance)
from
- Description of the Parameteruntil
- Description of the Parameterdistance
- Description of the Parameter
public java.util.SortedMap getQuantifiedMap(EDate distance)
distance
- Description of the Parameter
public java.lang.String toString()
|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |