sema
Class Event

java.lang.Object
  extended bysema.Event
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
Element.ElementEvent

public abstract class Event
extends java.lang.Object
implements java.lang.Comparable

An event is used to plan the execution of a task in the futur.
An Event is linked with an Engine. It contains a 'whatToDo' and a date at which to execute the task.


Field Summary
 java.lang.Double date
          the date in milliseconde of simulated secs.
 
Constructor Summary
Event(double date, Engine e)
          Constructs an event at the given date and ask that it is registered in the given engine.
 
Method Summary
 int compareTo(java.lang.Object o)
          The comparable interface is used to sort events by date.
protected  void delete()
          Delete the event.
 boolean execute()
          It is the method called by the engine at run time.
protected abstract  void whatToDo()
          The action to override in order to execute something.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

date

public java.lang.Double date
the date in milliseconde of simulated secs.

Constructor Detail

Event

public Event(double date,
             Engine e)
Constructs an event at the given date and ask that it is registered in the given engine.

Method Detail

whatToDo

protected abstract void whatToDo()
The action to override in order to execute something.


execute

public boolean execute()
It is the method called by the engine at run time. before executing the todo, it verify it is still enable Returns true if the task is done, false otherwise.


delete

protected void delete()
Delete the event.


compareTo

public int compareTo(java.lang.Object o)
The comparable interface is used to sort events by date.

Specified by:
compareTo in interface java.lang.Comparable