Class SimResourceInstance
- java.lang.Object
-
- de.uka.ipd.sdq.simulation.abstractsimengine.SimulationElement
-
- de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimEntityDelegator
-
- de.uka.ipd.sdq.scheduler.entities.SchedulerEntity
-
- edu.kit.ipd.sdq.pcm.simulation.scheduler.exact.resources.active.SimResourceInstance
-
- All Implemented Interfaces:
de.uka.ipd.sdq.simulation.abstractsimengine.IEntity
,IResourceInstance
public class SimResourceInstance extends de.uka.ipd.sdq.scheduler.entities.SchedulerEntity implements IResourceInstance
-
-
Constructor Summary
Constructors Constructor Description SimResourceInstance(de.uka.ipd.sdq.scheduler.SchedulerModel model, int number, de.uka.ipd.sdq.scheduler.IActiveResource containing_resource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addObserver(de.uka.ipd.sdq.scheduler.sensors.IActiveResourceStateSensor observer)
void
assign(de.uka.ipd.sdq.scheduler.IRunningProcess process)
Assigns a new process to this instance.void
cancelSchedulingEvent()
Removes a pending SchedulingEvent.boolean
equals(Object obj)
int
getId()
de.uka.ipd.sdq.scheduler.IRunningProcess
getLastRunningProcess()
String
getName()
Unique name of the resource instance.double
getNextSchedEventTime()
int
getQueueLength()
de.uka.ipd.sdq.scheduler.IRunningProcess
getRunningProcess()
int
hashCode()
boolean
isIdle()
boolean
isScheduling()
boolean
processAssigned()
void
release()
Releases the current resource instance.void
removeObserver(de.uka.ipd.sdq.scheduler.sensors.IActiveResourceStateSensor observer)
void
scheduleSchedulingEvent(double time)
Schedules the next SchedulingEvent for the instance at the specified time.void
schedulingInterrupt(double time)
Schedules a SchedulingInterrupt.void
setIsScheduling(boolean b)
void
start()
void
stop()
String
toString()
-
Methods inherited from class de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimEntityDelegator
getEncapsulatedEntity, isScheduled, reschedule
-
-
-
-
Method Detail
-
getRunningProcess
public de.uka.ipd.sdq.scheduler.IRunningProcess getRunningProcess()
- Specified by:
getRunningProcess
in interfaceIResourceInstance
- Returns:
- Returns the process currently executing on the resource.
-
release
public void release()
Description copied from interface:IResourceInstance
Releases the current resource instance.- Specified by:
release
in interfaceIResourceInstance
-
addObserver
public void addObserver(de.uka.ipd.sdq.scheduler.sensors.IActiveResourceStateSensor observer)
- Specified by:
addObserver
in interfaceIResourceInstance
-
removeObserver
public void removeObserver(de.uka.ipd.sdq.scheduler.sensors.IActiveResourceStateSensor observer)
- Specified by:
removeObserver
in interfaceIResourceInstance
-
processAssigned
public boolean processAssigned()
- Specified by:
processAssigned
in interfaceIResourceInstance
- Returns:
- True, if there is process executing on this resource instance, false otherwise.
-
assign
public void assign(de.uka.ipd.sdq.scheduler.IRunningProcess process)
Description copied from interface:IResourceInstance
Assigns a new process to this instance. Note that the resource has to be idle to do so.- Specified by:
assign
in interfaceIResourceInstance
- Parameters:
process
- Process to execute on the resource instance.
-
getName
public String getName()
Description copied from interface:IResourceInstance
Unique name of the resource instance.- Specified by:
getName
in interfaceIResourceInstance
- Overrides:
getName
in classde.uka.ipd.sdq.simulation.abstractsimengine.SimulationElement
- Returns:
- The unique name of the resource instance.
-
scheduleSchedulingEvent
public void scheduleSchedulingEvent(double time)
Description copied from interface:IResourceInstance
Schedules the next SchedulingEvent for the instance at the specified time. The event my be deferred or canceled by other actions.- Specified by:
scheduleSchedulingEvent
in interfaceIResourceInstance
- Parameters:
time
- Time the event shall occur.
-
schedulingInterrupt
public void schedulingInterrupt(double time)
Description copied from interface:IResourceInstance
Schedules a SchedulingInterrupt. This event cannot be interrupted or moved and will occur at the specified time.- Specified by:
schedulingInterrupt
in interfaceIResourceInstance
-
cancelSchedulingEvent
public void cancelSchedulingEvent()
Description copied from interface:IResourceInstance
Removes a pending SchedulingEvent.- Specified by:
cancelSchedulingEvent
in interfaceIResourceInstance
-
getId
public int getId()
-
getNextSchedEventTime
public double getNextSchedEventTime()
- Specified by:
getNextSchedEventTime
in interfaceIResourceInstance
-
start
public void start()
- Specified by:
start
in interfaceIResourceInstance
-
stop
public void stop()
- Specified by:
stop
in interfaceIResourceInstance
-
setIsScheduling
public void setIsScheduling(boolean b)
- Specified by:
setIsScheduling
in interfaceIResourceInstance
-
isScheduling
public boolean isScheduling()
- Specified by:
isScheduling
in interfaceIResourceInstance
-
isIdle
public boolean isIdle()
- Specified by:
isIdle
in interfaceIResourceInstance
-
getLastRunningProcess
public de.uka.ipd.sdq.scheduler.IRunningProcess getLastRunningProcess()
- Specified by:
getLastRunningProcess
in interfaceIResourceInstance
-
getQueueLength
public int getQueueLength()
-
-