org.qi4j.library.alarm
Interface AlarmHistory

All Known Implementing Classes:
AlarmHistory.AlarmHistoryMixin

@Mixins(value=AlarmHistory.AlarmHistoryMixin.class)
public interface AlarmHistory

History of an AlarmPoint. AlarmPoint system should implement AlarmHistory classes to record the events of an AlarmPoint.


Nested Class Summary
static class AlarmHistory.AlarmHistoryMixin
           
 
Method Summary
 int activateCounter()
          Returns the Counter of activate triggers.
 void addEvent(AlarmEvent event, java.lang.String trigger)
           
 Property<java.util.List<AlarmEvent>> allAlarmEvents()
          Returns a java.util.List of all recorded AlarmEvents.
 Property<java.util.Map<java.lang.String,java.lang.Integer>> counters()
          Returns all the Counters of triggers.
 AlarmEvent eventAt(int position)
          Returns the recorded AlarmEvent at the given position in the buffer.
 AlarmEvent eventAtEnd(int position)
          Returns the recorded AlarmEvent at the given position in the buffer counted from the end.
 AlarmEvent firstEvent()
          Returns the oldest recorded AlarmEvent.
 AlarmEvent lastEvent()
          Returns the newest recorded AlarmEvent.
 Property<java.lang.Integer> maxSize()
          The maximum size of the history buffer.
 void resetActivateCounter()
          Resets the Activate counter.
 void resetAllCounters()
          Resets all counters.
 

Method Detail

lastEvent

AlarmEvent lastEvent()
Returns the newest recorded AlarmEvent.

Returns:
the last AlarmEvent in the buffer. This is the newest event.

firstEvent

AlarmEvent firstEvent()
Returns the oldest recorded AlarmEvent.

Returns:
the first AlarmEvent in the buffer. This is the oldest event.

eventAt

AlarmEvent eventAt(int position)
Returns the recorded AlarmEvent at the given position in the buffer.

Parameters:
position - the position in the buffer, counted from the beginning to obtain the AlarmEvent from. 0 means the first element.
Returns:
the recorded AlarmEvent at the given position in the buffer.

eventAtEnd

AlarmEvent eventAtEnd(int position)
Returns the recorded AlarmEvent at the given position in the buffer counted from the end.

Parameters:
position - the position in the buffer, counted from the end to obtain the AlarmEvent from. 0 means the last element.
Returns:
the recorded AlarmEvent at the given position in the buffer counted from the end.

allAlarmEvents

@UseDefaults
Property<java.util.List<AlarmEvent>> allAlarmEvents()
Returns a java.util.List of all recorded AlarmEvents.

Returns:
a java.util.List of all recorded AlarmEvents.

maxSize

@UseDefaults
Property<java.lang.Integer> maxSize()
The maximum size of the history buffer. If the sizes shrinks, the oldest AlarmEvents should be removed so that the number of stored events are equal to the new MaxSize.

Returns:
The maxSize Property instance.

counters

@UseDefaults
Property<java.util.Map<java.lang.String,java.lang.Integer>> counters()
Returns all the Counters of triggers. Each time the trigger() method is called, a Counter is incremented. That means that after the first time the following the sequence is called
 activate();
 acknowledge();
 deactivate();
 
, the Map contains
(String) activate(Integer) 1
(String) deactivate(Integer) 1
(String) acknowledge(Integer) 1

Returns:
all the Counters of triggers.

resetAllCounters

void resetAllCounters()
Resets all counters.


activateCounter

int activateCounter()
Returns the Counter of activate triggers. This method will return the number of times the activate() method and the trigger() method with an activate trigger is called.

Returns:
the Counter of activate triggers.

resetActivateCounter

void resetActivateCounter()
Resets the Activate counter.


addEvent

void addEvent(AlarmEvent event,
              java.lang.String trigger)