Class Generator
java.lang.Object
desmoj.core.simulator.NamedObject
desmoj.core.simulator.ModelComponent
desmoj.core.simulator.Schedulable
desmoj.core.simulator.Entity
de.rss.fachstudie.MiSim.entities.networking.RequestSender
de.rss.fachstudie.MiSim.entities.generator.Generator
- All Implemented Interfaces:
IRequestUpdateListener,IParsableSelfScheduled,ISelfScheduled,IParsable,Comparable<IRequestUpdateListener>
- Direct Known Subclasses:
IntervalGenerator,LIMBOGenerator
public abstract class Generator extends RequestSender implements IRequestUpdateListener, IParsableSelfScheduled
Superclass for all generators. Automatically takes care of the (re-)scheduling of the generation events, sending of
the
UserRequests and observation of send requests.- Author:
- Lion Wagner
- See Also:
UserRequest,IntervalGenerator,LIMBOGenerator
-
Field Summary
Fields Modifier and Type Field Description protected AccumulativeDataPointReporteraccReporterprotected desmoj.core.simulator.Modelmodelprotected OperationoperationTarget Operationprotected MultiDataPointReporterreporterFields inherited from class de.rss.fachstudie.MiSim.entities.networking.RequestSender
updateListenerProxyFields inherited from class desmoj.core.simulator.Schedulable
_schedule -
Constructor Summary
-
Method Summary
Modifier and Type Method Description voiddoInitialSelfSchedule()Does the initial scheduling of this generator.voideventRoutine()This method is automatically called by the Generator itself.protected abstract desmoj.core.simulator.TimeInstantgetFirstTargetTime()Method to compute the first or initial target time.desmoj.core.simulator.TimeInstantgetLastTargetTime()desmoj.core.simulator.TimeInstantgetNextTargetTime()protected abstract desmoj.core.simulator.TimeInstantgetNextTargetTime(desmoj.core.simulator.TimeInstant lastTargetTime)Method to compute the next target time.Class<? extends Parser<?>>getParserClass()Dummy to allow extension ofIParsableSelfScheduledbooleanonRequestFailed(Request request, desmoj.core.simulator.TimeInstant when, RequestFailedReason reason)Listener for the failure of the sending process.booleanonRequestResultArrivedAtRequester(Request request, desmoj.core.simulator.TimeInstant when)Listener for the successful receiving of the answer of a request.Methods inherited from class de.rss.fachstudie.MiSim.entities.networking.RequestSender
addUpdateListener, addUpdateListeners, sendRequest, sendRequest, sendRequest, sendRequestMethods inherited from class desmoj.core.simulator.Entity
clone, generateTraceForScheduling, getIdentNumber, getQueueingPriority, getQueues, getScheduledEvents, isEqual, isLarger, isLargerOrEqual, isNotEqual, isQueued, isSimProcess, isSmaller, isSmallerOrEqual, schedule, schedule, schedule, schedule, schedule, schedule, schedule, schedule, schedule, scheduleAfter, scheduleAfter, scheduleAfter, scheduleBefore, scheduleBefore, scheduleBefore, schedulePreempt, schedulePreempt, schedulePreempt, setQueueingPriorityMethods inherited from class desmoj.core.simulator.Schedulable
assignReporter, cancel, getCorrespondingReportable, isCurrent, isScheduled, rename, reSchedule, reSchedule, reSchedulePreempt, scheduledNext, setCorrespondingReportableMethods inherited from class desmoj.core.simulator.ModelComponent
current, currentEntity, currentEntityAll, currentEvent, currentlySendDebugNotes, currentlySendTraceNotes, currentModel, currentSimProcess, debugIsOn, debugOff, debugOn, getModel, isExperimentCompatible, isModelCompatible, presentTime, sendDebugNote, sendMessage, sendTraceNote, sendWarning, skipTraceNote, skipTraceNote, traceIsOn, traceOff, traceOnMethods inherited from class desmoj.core.simulator.NamedObject
getName, getQuotedName, toStringMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface de.rss.fachstudie.MiSim.entities.networking.IRequestUpdateListener
compareTo, getListeningPriority, onRequestArrivalAtTarget, onRequestSend
-
Field Details
-
model
protected final desmoj.core.simulator.Model model -
operation
Target Operation -
reporter
-
accReporter
-
-
Constructor Details
-
Generator
public Generator(desmoj.core.simulator.Model model, String name, boolean showInTrace, Operation operation)Superclass for all generators. Automatically takes care of the (re-)scheduling of the generation events, sending of the* UserRequests and observation of send requests.- Parameters:
model- Default desmoj parametername- Default desmoj parametershowInTrace- Default desmoj parameteroperation- Target Operation Instance
-
-
Method Details
-
getNextTargetTime
protected abstract desmoj.core.simulator.TimeInstant getNextTargetTime(desmoj.core.simulator.TimeInstant lastTargetTime)Method to compute the next target time. Called by the superclass upon need for a new target TimeInstance. Provides the TimeInstance of last scheduling.Can return
nullor throw aGeneratorStopExceptionto stop the generator.- Parameters:
lastTargetTime- last target time- Returns:
- the next target time
- Throws:
GeneratorStopException- when the Generator is stops.
-
getFirstTargetTime
protected abstract desmoj.core.simulator.TimeInstant getFirstTargetTime()Method to compute the first or initial target time. Called by the superclass upon need for the first TimeInstance. Should return a constant value.Can return
nullor throw aGeneratorStopExceptionto stop the generator.- Returns:
- the point in simulation time when the first request should be sent by this generator
- Throws:
GeneratorStopException- when the Generator is stops.
-
doInitialSelfSchedule
public void doInitialSelfSchedule()Does the initial scheduling of this generator.- Specified by:
doInitialSelfSchedulein interfaceISelfScheduled
-
eventRoutine
public void eventRoutine()This method is automatically called by the Generator itself. (by rescheduling via itsGeneratorTriggerEvent)If absolutely needed it can be manually called to send the next request immediately.
-
getLastTargetTime
public desmoj.core.simulator.TimeInstant getLastTargetTime() -
getNextTargetTime
public desmoj.core.simulator.TimeInstant getNextTargetTime() -
onRequestFailed
public boolean onRequestFailed(Request request, desmoj.core.simulator.TimeInstant when, RequestFailedReason reason)Listener for the failure of the sending process. This could for example be due to the receiving service not being available, the request being canceled or timed out. Provides a reference to the failed request.- Specified by:
onRequestFailedin interfaceIRequestUpdateListener- Parameters:
request- request that triggered this eventwhen- time of this eventreason- reason why the request failed- Returns:
- true if the request was terminally handled (consumed) by this instance
-
onRequestResultArrivedAtRequester
public boolean onRequestResultArrivedAtRequester(Request request, desmoj.core.simulator.TimeInstant when)Listener for the successful receiving of the answer of a request.- Specified by:
onRequestResultArrivedAtRequesterin interfaceIRequestUpdateListener- Parameters:
request- request that triggered this eventwhen- time of this event- Returns:
- true if the request was terminally handled (consumed) by this instance
-
getParserClass
Dummy to allow extension ofIParsableSelfScheduled- Specified by:
getParserClassin interfaceIParsable- Returns:
- The parser related to this class
-