Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## nl.tudelft.simulation.dsol.formalisms.devs
Class AbstractSimEvent

    java.lang.Object
      nl.tudelft.simulation.dsol.formalisms.devs.AbstractSimEvent

All Implemented Interfaces:
  java.lang.Comparable, java.io.Serializable, SimEventInterface

Direct Known Subclasses:
  SimEvent

public abstract class AbstractSimEvent
extends java.lang.Object
implements SimEventInterface, java.lang.Comparable, java.io.Serializable

The AbstractSimEvent forms the basement for SimEvents and defines a compare method by which eventLists can compare priority of the event.

(c) copyright 2003 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: General Public License (GPL) , no warranty

Since:
  1.0
Version:
  1.11 2004-03-26
Author:
  Peter Jacobs
See Also:
  Serialized Form

Field Summary
`protected double` | `absoluteExecutionTime` absoluteExecutionTime reflects the time at which the event is scheduled
`protected long` | `id` the id used in compare statements
`protected short` | `priority` priority reflects the priority of the event

Fields inherited from interface nl.tudelft.simulation.dsol.formalisms.devs.SimEventInterface
`MAX_PRIORITY, MIN_PRIORITY, NORMAL_PRIORITY`

Constructor Summary
`AbstractSimEvent(double executionTime)` The constuctor of the event stores the time the event must be executed and the object and method to invoke
`AbstractSimEvent(double executionTime, short priority)` The constuctor of the event stores the time the event must be executed and the object and method to invoke

Method Summary
`int` | `compareTo(java.lang.Object object)`
`abstract void` | `execute()` executes the simEvent
`double` | `getAbsoluteExecutionTime()`
`long` | `getID()` sets the id of an event.
`short` | `getPriority()`
`void` | `setID(long id)` sets the id of an event.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### absoluteExecutionTime

    protected double absoluteExecutionTime

  absoluteExecutionTime reflects the time at which the event is scheduled

### priority

    protected short priority

  priority reflects the priority of the event

### id

    protected long id

  the id used in compare statements

Constructor Detail

### AbstractSimEvent

    public AbstractSimEvent(double executionTime)

  The constuctor of the event stores the time the event must be executed and the object and method to invoke

Parameters:
  `executionTime` - reflects the time the event has to be executed.

### AbstractSimEvent

    public AbstractSimEvent(double executionTime,
                            short priority)

  The constuctor of the event stores the time the event must be executed and the object and method to invoke

Parameters:
  `executionTime` - reflects the time the event has to be executed.
  `priority` - reflects the priority of the event

Method Detail

### compareTo

    public int compareTo(java.lang.Object object)

  Specified by:
    `compareTo` in interface `java.lang.Comparable`
  See Also:
    `Comparable.compareTo(java.lang.Object)`

### execute

    public abstract void execute()
                          throws SimRuntimeException

  executes the simEvent

  Specified by:
    `execute` in interface `SimEventInterface`
  Throws:
    `SimRuntimeException` - on execution failure

### getAbsoluteExecutionTime

    public double getAbsoluteExecutionTime()

  Specified by:
    `getAbsoluteExecutionTime` in interface `SimEventInterface`
  Returns:
    The execution time of a simulation event

### getPriority

    public short getPriority()

  Specified by:
    `getPriority` in interface `SimEventInterface`
  Returns:
    The priority of a simulation event. The priorities are programmed according to the Java thread priority. Use 10 (MAX_PRIORITY), -9, .. , 5 (NORMAL_PRIORITY), 1(MIN_PRIORITY)

### getID

    public long getID()

  Description copied from interface: `SimEventInterface`
  sets the id of an event. Whenever a simulation event is added or removed from an eventlist, the list might want to set an ID for comparison. This is the only way to ensure a comparison on equal priority and execution time.

  Specified by:
    `getID` in interface `SimEventInterface`
  Returns:
    Returns the id.

### setID

    public void setID(long id)

  Description copied from interface: `SimEventInterface`
  sets the id of an event. Whenever a simulation event is added or removed from an eventlist, the list might want to set an ID for comparison. This is the only way to ensure a comparison on equal priority and execution time.

  Specified by:
    `setID` in interface `SimEventInterface`
  Parameters:
    `id` - The id to set.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2004 Delft University of Technology, the Netherlands. All Rights Reserved.