nl.tudelft.simulation.examples.dsol.timesharedcomputer

## Class CPU

- java.lang.Object
- - nl.tudelft.simulation.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>, 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-2018 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
`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 EventType` `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 EventType` `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 nl.tudelft.simulation.event.EventProducer

`listeners`

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

`RECEIVE_EVENT, RELEASE_EVENT`

### Fields inherited from interface nl.tudelft.simulation.event.EventProducerInterface

`FIRST_POSITION, LAST_POSITION`

### Constructor Summary

Constructors
Constructor and Description
`CPU(DEVSSimulatorInterface.TimeDouble simulator)` constructs a new CPU.

### Method Summary

All Methods Instance Methods Concrete Methods
`javax.media.j3d.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, setDestination`

### Methods inherited from class nl.tudelft.simulation.event.EventProducer

`addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, 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 nl.tudelft.simulation.event.EventProducerInterface

`addListener, addListener, addListener, addListener, removeListener`

### Field Detail

#### UTILIZATION_EVENT

    public static final EventType UTILIZATION_EVENT

UTILIZATION_EVENT are fired on utilization.

#### QUEUE_LENGTH_EVENT

    public static final EventType 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 Detail

#### CPU

    public CPU(DEVSSimulatorInterface.TimeDouble simulator)

constructs a new CPU.

Parameters:
  `simulator` - a devs simulator

### Method Detail

#### 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 javax.media.j3d.Bounds getBounds()

Specified by:
  `getBounds` in interface `Locatable`