Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

desmoj
Class Schedulable  view Schedulable download Schedulable.java

java.lang.Object
  extended bydesmoj.NamedObject
      extended bydesmoj.ModelComponent
          extended bydesmoj.Schedulable
Direct Known Subclasses:
Entity, Event

public class Schedulable
extends ModelComponent

All objects that want to be handled by the scheduler must extend this class. These are events (including external events), entities and simprocesses. All functionality common to schedulable objects are encapsulated here.

Version:
DESMO-J, Ver. 1.5 copyright (c) 2001 licensed under GNU GPL

Field Summary
(package private)  EventNote myNote
          The eventnote associated to this schedulable object when it is inserted in the eventlist.
private static NameCatalog nameChecker
          The catalog for the names of schedulables.
 
Fields inherited from class desmoj.ModelComponent
 
Fields inherited from class desmoj.NamedObject
 
Constructor Summary
Schedulable(Model owner, java.lang.String name, boolean showInTrace)
          Constructs a schedulable object with the given name.
 
Method Summary
 void cancel()
          Removes the schedulable object from the eventlist.
(package private)  EventNote getEventNote()
          Returns the eventnote associated to this schedulable object.
 boolean isCurrent()
          Shows if this schedulable is the currently active object.
 boolean isScheduled()
          Tests if this schedulable has already been scheduled.
 Entity nextEntity()
          Returns the next following scheduled entity on the eventlist relative to this schedulable object or null if the next entry in the eventlist is an external event.
 Event nextEvent()
          Returns the next following scheduled event on the eventList relative to this schedulable object or null if the next entry in the eventlist is a simprocess.
 Schedulable nextSchedulable()
          Returns the next following scheduled schedulable object on the eventList relative to this schedulable object.
(package private)  void removeEventNote()
          Removes the eventnote associated to this schedulable and the link of the eventnote to this schedulable object.
 void rename(java.lang.String newName)
          Allows to rename a schedulable object while keeping its internally added serial number to keep track of the individual object.
 void reSchedule(SimTime dt)
          Re-schedules the schedulable at some other point in simulation time than it already had been scheduled before.
 SimTime scheduledAt()
          Returns the point of simulation time this Schedulable is scheduled at.
(package private)  void setEventNote(EventNote e)
          Connects the schedulable object to an eventnote to be inserted into the eventlist.
 
Methods inherited from class desmoj.ModelComponent
current, currentEntity, currentEvent, currentModel, currentSimProcess, currentTime, debugIsOn, debugOff, debugOn, epsilon, getModel, isExperimentCompatible, isModelCompatible, sendDebugNote, sendMessage, sendTraceNote, sendWarning, setOwner, skipTraceNote, skipTraceNote, traceIsOn, traceOff, traceOn
 
Methods inherited from class desmoj.NamedObject
getName, getQuotedName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myNote

EventNote myNote
The eventnote associated to this schedulable object when it is inserted in the eventlist.


nameChecker

private static NameCatalog nameChecker
The catalog for the names of schedulables. It reassures that no two schedulables are given the same name.

Constructor Detail

Schedulable

public Schedulable(Model owner,
                   java.lang.String name,
                   boolean showInTrace)
Constructs a schedulable object with the given name. Note that to identify the multiple objects that can be created of one type of schedulable, each has a unique number added to its name as a suffix. The numbers represent the amount of objects being created with the same name.

Method Detail

cancel

public void cancel()
Removes the schedulable object from the eventlist. The schedulable object will not become active unless scheduled again. A warning is given if the schedulable has not scheduled and the method simply returns.


getEventNote

EventNote getEventNote()
Returns the eventnote associated to this schedulable object. If the schedulable object is not currently scheduled, null will be returned.


isCurrent

public boolean isCurrent()
Shows if this schedulable is the currently active object.


isScheduled

public boolean isScheduled()
Tests if this schedulable has already been scheduled.


nextEntity

public Entity nextEntity()
Returns the next following scheduled entity on the eventlist relative to this schedulable object or null if the next entry in the eventlist is an external event.


nextEvent

public Event nextEvent()
Returns the next following scheduled event on the eventList relative to this schedulable object or null if the next entry in the eventlist is a simprocess.


nextSchedulable

public Schedulable nextSchedulable()
Returns the next following scheduled schedulable object on the eventList relative to this schedulable object. The type of object returned will be determined by following rules
  1. an entity if an entity or simprocess is scheduled
  2. an event if an external event is scheduled where neither event nor simprocess are involved


removeEventNote

void removeEventNote()
Removes the eventnote associated to this schedulable and the link of the eventnote to this schedulable object.


rename

public void rename(java.lang.String newName)
Allows to rename a schedulable object while keeping its internally added serial number to keep track of the individual object. Note that invalid string parameters will result in renaming the schedulable to 'unnamed'.

Overrides:
rename in class NamedObject

reSchedule

public void reSchedule(SimTime dt)
Re-schedules the schedulable at some other point in simulation time than it already had been scheduled before.


scheduledAt

public SimTime scheduledAt()
Returns the point of simulation time this Schedulable is scheduled at. Returns null, if it has not been scheduled and thus can not return an appropriate point of siulation time.


setEventNote

void setEventNote(EventNote e)
Connects the schedulable object to an eventnote to be inserted into the eventlist. Becomes necessary whenever a schedulable object is actually scheduled.