org.qi4j.library.alarm
Class SimpleAlarmModelService.SimpleAlarmModelMixin

java.lang.Object
  extended by org.qi4j.library.alarm.SimpleAlarmModelService.SimpleAlarmModelMixin
All Implemented Interfaces:
AlarmModel
Enclosing interface:
SimpleAlarmModelService

public static class SimpleAlarmModelService.SimpleAlarmModelMixin
extends Object
implements AlarmModel

The Simple Alarm Model is centered around the Normal and Activated. The triggers "activate" and "deactivate". The following matrix details the resulting grid;

Initial StateTriggerResulting StateEvent Generated
NormalactivateActivatedactivation
NormaldeactivateNormal-
ActivatedactivateActivated-
ActivateddeactivateDeactivateddeactivation


Constructor Summary
SimpleAlarmModelService.SimpleAlarmModelMixin()
           
 
Method Summary
 List<String> alarmTriggers()
          Returns all the supported Alarm triggers.
 boolean computeCondition(AlarmStatus status)
           
 String computeTrigger(AlarmStatus status, boolean condition)
           
 AlarmEvent evaluate(Alarm alarm, String trigger)
          Execute the required changes upon an AlarmTrigger.
 String modelDescription()
          Returns a Description of the AlarmModel in the default Locale.
 String modelDescription(Locale locale)
          Returns a Description of the AlarmModel.
 String modelName()
          Returns the Name of the AlarmModel.
 List<String> statusList()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleAlarmModelService.SimpleAlarmModelMixin

public SimpleAlarmModelService.SimpleAlarmModelMixin()
Method Detail

modelName

public String modelName()
Returns the Name of the AlarmModel. This normally returns the human readable technical name of the AlarmModel.

Specified by:
modelName in interface AlarmModel
Returns:
The system name of this Alarm Model.

modelDescription

public String modelDescription()
Returns a Description of the AlarmModel in the default Locale. This normally returns a full Description of the AlarmModel in the default Locale.

Specified by:
modelDescription in interface AlarmModel
Returns:
the description of the ModelProvider.

modelDescription

public String modelDescription(Locale locale)
Returns a Description of the AlarmModel. This normally returns a full Description of the AlarmModel in the Locale. If Locale is null, then the default Locale is used.

Specified by:
modelDescription in interface AlarmModel
Parameters:
locale - The locale for which the description is wanted.
Returns:
the description of th

statusList

public List<String> statusList()
Specified by:
statusList in interface AlarmModel

evaluate

public AlarmEvent evaluate(Alarm alarm,
                           String trigger)
Execute the required changes upon an AlarmTrigger. The AlarmSystem calls this method, for the AlarmStatus in the the Alarm to be updated, as well as an AlarmEvent to be created.

Specified by:
evaluate in interface AlarmModel
Parameters:
trigger - the AlarmTrigger that was used.
alarm - The Alarm the trigger is for.
Returns:
An AlarmEvent representing the state change for the given trigger.

alarmTriggers

public List<String> alarmTriggers()
Returns all the supported Alarm triggers.

Specified by:
alarmTriggers in interface AlarmModel
Returns:
an array of alarm triggers valid for this AlarmModel.

computeTrigger

public String computeTrigger(AlarmStatus status,
                             boolean condition)
Specified by:
computeTrigger in interface AlarmModel

computeCondition

public boolean computeCondition(AlarmStatus status)
Specified by:
computeCondition in interface AlarmModel