|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.svrCore.vars.EventVariableValuePeriodRow
public final class EventVariableValuePeriodRow
Current and historical entries for one event forming one "row". This is mutable and used to hold live event stats in memory.
This maintains state incrementally on each new event, for example, shuffling out and discarding old historical event values if need be.
Thread-safe, with methods synchronized as necessary.
Serializable for direct persistence if required, though an XML format rather than a binary one would probably be more robust.
| Field Summary | |
|---|---|
(package private) static EventVariableValue[] |
_NO_EVENT_VALUES
Zero-length array corresponding to "no results", immutable so made available to the package; non-null. |
private EventVariableValueBuffer |
all
All events being collected, never null. |
private EventVariableValueBuffer |
current
"Current" events being collected, never null. |
private SimpleVariableDefinition |
def
The variable definition; never null. |
private EventVariableValue[] |
historical
Set of "historical" periods, most-recent at index 0, possibly containing nulls; never null. |
private EventPeriod |
period
The event period; never null. |
private static long |
serialVersionUID
Unique Serialisation class ID. |
| Constructor Summary | |
|---|---|
EventVariableValuePeriodRow(SimpleVariableDefinition def,
EventPeriod period)
Construct a single event variable value period "row". |
|
| Method Summary | |
|---|---|
private void |
_canonicaliseState()
Canonicalise our internal state, so that the current event collector covers "now". |
void |
addEvent(SimpleVariableValue svv)
Record/add event to the tally for this period. |
SimpleVariableDefinition |
getDef()
Get the variable definition; never null. |
(package private) EventVariableValue[] |
getEventValues(long firstIntervalNumber,
java.util.BitSet whichValues)
Get the specified event sets for the specified intervals; never null. |
EventPeriod |
getPeriod()
Get the event period; never null. |
private void |
readObject(java.io.ObjectInputStream ois)
Deserialise. |
void |
setEventValue(EventVariableValue evv)
Set/override the specified event sets for the specified intervals; never null. |
void |
validateObject()
Check that the object state is consistent and legal. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final SimpleVariableDefinition def
private final EventPeriod period
private EventVariableValueBuffer all
Will never be authoritative.
private EventVariableValueBuffer current
Initially created with value suitable to receive a new event immediately.
Will never be authoritative.
private final EventVariableValue[] historical
The intervalNumber of any entry at index i must be current.getIntervalNumber()-1-i.
FIXME: copy defensively during deserialisation.
static final EventVariableValue[] _NO_EVENT_VALUES
private static final long serialVersionUID
| Constructor Detail |
|---|
public EventVariableValuePeriodRow(SimpleVariableDefinition def,
EventPeriod period)
throws java.lang.IllegalArgumentException
def - the variable definition; never null and must be an eventperiod - the event period for this sample; never null
java.lang.IllegalArgumentException - if the arguments are invalid| Method Detail |
|---|
public SimpleVariableDefinition getDef()
public EventPeriod getPeriod()
public void addEvent(SimpleVariableValue svv)
If the "current" event buffer is too old to accept this incoming event, we move all the historical data up and insert an immutable copy of the buffered data as appropriate (though we must cope with the case where we have to move data up several slots due to an extended interval between updates).
svv - event to be recorded; must be non-null and of event typeprivate void _canonicaliseState()
EventVariableValue[] getEventValues(long firstIntervalNumber,
java.util.BitSet whichValues)
Requests for more than SystemVariables.EVENT_SAMPLES_RETAINED in the past (or for the future!) cannot be satisfied and data will not be returned for them.
Usually not more than SystemVariables.EVENT_SAMPLES_RETAINED samples will be returned in response to any one request as a safety measure.
firstIntervalNumber - the number of the first interval
for which data is potentially required;
if too far in the past or future then possibly no data
will be available;
using zero accesses the "all" bucketwhichValues - each true bit represents a slot for which data is
required, bit 0 indicating data from the slot within which
firstIntervalTime is located, bit 1 the previous slot, etc
public void setEventValue(EventVariableValue evv)
This may ignore the call, and certainly will if the intervalNumber is outside the current time window it holds.
This will generally accept the value and store it if:
evv - non-null event value
private void readObject(java.io.ObjectInputStream ois)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void validateObject()
throws java.io.InvalidObjectException
validateObject in interface java.io.ObjectInputValidationjava.io.InvalidObjectException
|
DHD Multimedia Gallery V1.53.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||