Package nl.tudelft.simulation.examples.dsol.timesharedcomputer

# Class CPU

java.lang.Object
org.djutils.event.EventProducer
nl.tudelft.simulation.dsol.formalisms.flow.Station<Double,​Double,​SimTimeDouble>
nl.tudelft.simulation.examples.dsol.timesharedcomputer.CPU

All Implemented Interfaces:
  `Serializable`, `Locatable`, `StationInterface<Double,​Double,​SimTimeDouble>`, `org.djutils.event.EventProducerInterface`

    public class CPU
    extends Station<Double,​Double,​SimTimeDouble>
    implements Locatable

The CPU example as published in Simulation Modeling and Analysis by A.M. Law & W.D. Kelton section 1.4 and 2.4. .

Copyright (c) 2003-2020 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://simulation.tudelft.nl/dsol/3.0/license.html.

Author:
  Peter Jacobs
See Also:
  Serialized Form

## Nested Class Summary

## Nested classes/interfaces inherited from class nl.tudelft.simulation.dsol.formalisms.flow.Station

`Station.CalendarDouble, Station.CalendarFloat, Station.CalendarLong, Station.TimeDouble, Station.TimeDoubleUnit, Station.TimeFloat, Station.TimeFloatUnit, Station.TimeLong`

## Field Summary

Fields
Modifier and Type | Field | Description
--- | --- | ---
`static boolean` | `BUSY` | BUSY defines the BUSY state.
`static boolean` | `IDLE` | IDLE defines the IDLE state.
`static double` | `QUANTUM` | QUANTUM is the QUANTUM of the CPU.
`static org.djutils.event.TimedEventType` | `QUEUE_LENGTH_EVENT` | QUEUE_LENGTH_EVENT is fired on changes in the Queue length.
`static double` | `SWAP` | SWAP is the swap of this cpu.
`static org.djutils.event.TimedEventType` | `UTILIZATION_EVENT` | UTILIZATION_EVENT are fired on utilization.

### Fields inherited from class nl.tudelft.simulation.dsol.formalisms.flow.Station

`destination, simulator`

### Fields inherited from class org.djutils.event.EventProducer

`eventProducerImpl`

### Fields inherited from interface org.djutils.event.EventProducerInterface

`FIRST_POSITION, LAST_POSITION`

### Fields inherited from interface nl.tudelft.simulation.dsol.formalisms.flow.StationInterface

`RECEIVE_EVENT, RELEASE_EVENT`

## Constructor Summary

Constructors
Constructor | Description
--- | ---
`CPU​(DEVSSimulatorInterface.TimeDouble simulator)` | constructs a new CPU.

## Method Summary

Modifier and Type | Method | Description
--- | --- | ---
`Bounds` | `getBounds()`
`DirectedPoint` | `getLocation()`
`List<Object>` | `getQueue()` | returns the queue.
`void` | `receiveObject​(Object object)`
`protected void` | `releaseObject​(Object object)`

### Methods inherited from class nl.tudelft.simulation.dsol.formalisms.flow.Station

`getDestination, getSimulator, getSourceId, setDestination`

### Methods inherited from class org.djutils.event.EventProducer

`addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.djutils.event.EventProducerInterface

`addListener, addListener, addListener, addListener, getEventTypesWithListeners, hasListeners, numberOfListeners, removeListener`

## Field Details

### UTILIZATION_EVENT

public static final org.djutils.event.TimedEventType UTILIZATION_EVENT
UTILIZATION_EVENT are fired on utilization.

### QUEUE_LENGTH_EVENT

public static final org.djutils.event.TimedEventType QUEUE_LENGTH_EVENT
QUEUE_LENGTH_EVENT is fired on changes in the Queue length.

### QUANTUM

public static final double QUANTUM
QUANTUM is the QUANTUM of the CPU.

See Also:
  Constant Field Values

### SWAP

public static final double SWAP
SWAP is the swap of this cpu.

See Also:
  Constant Field Values

### IDLE

public static final boolean IDLE
IDLE defines the IDLE state.

See Also:
  Constant Field Values

### BUSY

public static final boolean BUSY
BUSY defines the BUSY state.

See Also:
  Constant Field Values

## Constructor Details

### CPU

public CPU​(DEVSSimulatorInterface.TimeDouble simulator)
constructs a new CPU.

Parameters:
  `simulator` - DEVSSimulatorInterface.TimeDouble; a devs simulator

## Method Details

### getQueue

public List<Object> getQueue()
returns the queue.

Returns:
  List the queue

### receiveObject

public void receiveObject​(Object object)

Specified by:
  `receiveObject` in interface `StationInterface<Double,​Double,​SimTimeDouble>`
Overrides:
  `receiveObject` in class `Station<Double,​Double,​SimTimeDouble>`

### releaseObject

protected void releaseObject​(Object object)

Overrides:
  `releaseObject` in class `Station<Double,​Double,​SimTimeDouble>`

### getLocation

public DirectedPoint getLocation()

Specified by:
  `getLocation` in interface `Locatable`

### getBounds

public Bounds getBounds()

Specified by:
  `getBounds` in interface `Locatable`