Commit 8ce9408f authored by Mufaddal Makati's avatar Mufaddal Makati

initial commit


Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

File added
<!-- File: build.xml-->
<!-- Author: Nick Nielsen <>-->
<!-- Date: Mon Feb 06 15:05:09 2012-->
<!-- Description: build.xml-->
<project name="alarm" default="dist" basedir=".">
<property name="eyes.base.dir" location=".." />
<property file="${eyes.base.dir}/" />
<property name="src" location="src/main/java"/>
<property name="build" location="build"/>
<property name="lib" location="../lib"/>
<property name="destfile" location="${lib}/alarm.jar" />
<property name="cp" value="${lib}/thirdparty/log4j-1.2.16.jar" /> <!--:${lib}/thirdparty/junit-4.10.jar:${lib}/thirdparty/easymock-3.1.jar"/> -->
<target name="init">
<mkdir dir="${build}"/>
<target name="compile" depends="init">
<javac debug="${javac.DEBUG}" srcdir="${src}" destdir="${build}" classpath="${cp}:${lib}/event.jar"/>
<target name="dist" depends="compile">
<jar destfile="${destfile}" basedir="${build}"/>
<target name="clean">
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete file="${destfile}"/>
# File:
# Author: Nick Nielsen <>
# Date: Fri Mar 16 14:07:38 2012
# Description: builds all dependencies for alarm.
set -e
cd ../event && ant clean dist
cd ../alarm && ant clean dist
<?xml version="1.0"?>
<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">
<!-- The artifact Id for this module -->
<!-- The packaging for this module (jar, war) -->
<!-- The name for this module -->
<name>CableLabs - Alarm Module</name>
<!-- Description for this module -->
<description>CableLabs - Alarm Module</description>
Parent information; should reference group, artifactId, and version of
the parent POM.
package org.cablelabs.alarm;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Iterator;
import org.cablelabs.alarm.expression.EventCriteriaExpression;
import org.cablelabs.alarm.expression.EventCriteriaOperand;
import org.cablelabs.alarm.expression.OperandQueue;
import org.cablelabs.event.Event;
* Represents an active or in-progress alarm that has matched an event against
* one or more positive event criteria in an event criteria expression
public class Alarm
// List of events that track the history of this alarm in the
// RAISED state. This includes:
// - all events that had produced positive operands at the
// time the alarm transitions to the RAISED state
// - all events that produced any operand change during the
// time the alarm was in the RAISED state
// - the final event that transitioned the event from the
// RAISED to the CLEARED state
private List<Event<?>> m_events = new ArrayList<Event<?>>();
private State m_state = State.CLEARED;
private AlarmDescription m_description;
private EventCriteriaExpression m_expression;
private OperandQueue m_operands;
private Alarm m_lastRetired;
* The states of an alarm
public enum State
* One or more of the positive event criteria has been matched, but the
* alarm is not yet raised
* The alarm is currently in the raised state
* The alarm was cleared by a negative event
* The alarm was cleared manually by calling {@link Alarm#clear}
* This alarm has none of its operands set to true, and is eligible to
* be disposed
* Creates a new in-progress or raised alarm.
* @param description
* the alarm description
* @param expression
* the alarm event criteria expression
* @param operands
* the initial operands for the expression
* @param initialState
* the initial state of this alarm. Must be one of
* {@link State#IN_PROGRESS} or {@link State#RAISED}
public Alarm(AlarmDescription description,
EventCriteriaExpression expression, OperandQueue operands,
State initialState)
this(description, initialState);
if (expression == null