|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.svrCore.vars.EventVariableValueSet
public final class EventVariableValueSet
Current and historical entries for all periods/intervals one event forming one "set". 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.
Mutator calls are synchronized, so that serialisation can take place on an instance providing that a lock is held on that instance.
Serializable for direct persistence if required, though an XML format rather than a binary one would probably be more robust.
Notes the last time an event was add()ed or a whole slot value was "set" so as to allow an observer to tell quickly when this instance may need a save.
| Field Summary | |
|---|---|
private java.util.EnumMap<EventPeriod,EventVariableValuePeriodRow> |
byPeriod
Non-empty Map from period to period row; never null. |
private SimpleVariableDefinition |
def
The variable definition; never null. |
private long |
lastEventTime
Time last event was added, or zero if none recorded or instance just deserialised. |
private static long |
serialVersionUID
Unique Serialisation class ID. |
| Constructor Summary | |
|---|---|
|
EventVariableValueSet(SimpleVariableDefinition def)
Construct a single event variable value set (for all periods/intervals). |
private |
EventVariableValueSet(SimpleVariableDefinition def,
java.util.EnumMap<EventPeriod,EventVariableValuePeriodRow> byPeriod)
Constructor for defensive copying on deserialisation. |
| Method Summary | |
|---|---|
void |
addEvent(SimpleVariableValue svv)
Record/add event to the tallies for each period. |
SimpleVariableDefinition |
getDef()
Get the variable definition; never null. |
(package private) EventVariableValue[] |
getEventValues(EventPeriod intervalSelector,
long intervalNumber,
java.util.BitSet whichValues)
Get the specified event sets for the specified intervals; never null. |
long |
getLastEventTime()
Get time last event was added, or zero if none recorded or instance just deserialised. |
protected java.lang.Object |
readResolve()
Deserialise: use constructor for validation, defensive copying, etc. |
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 java.util.EnumMap<EventPeriod,EventVariableValuePeriodRow> byPeriod
private transient volatile long lastEventTime
Is volatile to allow access without a lock.
private static final long serialVersionUID
| Constructor Detail |
|---|
public EventVariableValueSet(SimpleVariableDefinition def)
throws java.lang.IllegalArgumentException
def - the variable definition; never null and must be an event
java.lang.IllegalArgumentException - if the arguments are invalid
private EventVariableValueSet(SimpleVariableDefinition def,
java.util.EnumMap<EventPeriod,EventVariableValuePeriodRow> byPeriod)
throws java.lang.IllegalArgumentException
def - the variable definition; never null and must be an eventbyPeriod - the extant mapping from period to "period row" entries; never null
java.lang.IllegalArgumentException - if the arguments are invalid| Method Detail |
|---|
public SimpleVariableDefinition getDef()
public long getLastEventTime()
public void addEvent(SimpleVariableValue svv)
Note that for some types, not all periods/intervals are selected, ie we record data for some periods and not others.
Updates the lastEventTime to the current time.
svv - event to be recorded; must be non-null and of event type
EventVariableValue[] getEventValues(EventPeriod intervalSelector,
long intervalNumber,
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.
If data is requested for an interval/period excluded in the definition, an empty array is returned.
Usually not more than SystemVariables.EVENT_SAMPLES_RETAINED samples will be returned in response to any one request as a safety measure.
intervalSelector - never nullintervalNumber - 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 availablewhichValues - 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 valueprotected java.lang.Object readResolve()
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 | ||||||||