package cc.monitors;



import cc.events.*;



public abstract class AbstractMonitor {

	private AbstractMonitor father = null;

	boolean lastEvaluationResult = true;



	public abstract void terminate();



	public void update(Event event) {

		//Do nothing

		System.out.println("Event received and not treated");

	}



	public abstract void evaluate();



	public final boolean getEvaluationResult() {

		return lastEvaluationResult;

	}



	public final void setEvaluationResult(boolean result) {

		if (lastEvaluationResult != result) {

			lastEvaluationResult = result;

			if (father != null) {

				father.evaluate();

			}

		}

	}



	final void setFather(AbstractMonitor abstractMonitor) {

		father = abstractMonitor;

	}



	private final AbstractMonitor getFather() {

		return father;

	}

}

