|
jmce - 1_02 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjmce.sim.AbstractHardware
jmce.sim.AbstractPeripheral
jmce.sim.Device<E>
public class Device<E>
The core class for device implementation.
This class implement a standard method to send / receive data between two or more devices.
The class Device use two DeviceProducer
to implements full duplex communications between the two or more class
involved to produce and consume data.
DeviceProducer
,
DeviceConsumer
Field Summary |
---|
Fields inherited from class jmce.sim.AbstractPeripheral |
---|
cpu |
Constructor Summary | |
---|---|
Device()
Default constructor |
|
Device(java.lang.String name)
Constructor with name |
Method Summary | |
---|---|
void |
addInputConsumer(DeviceConsumer<E> c)
Add a new consumer for data received. |
void |
addInputProducer(DeviceProducer<E> c)
Add a new producer for input |
void |
addOutputConsumer(DeviceConsumer<E> c)
Add new output consumer |
void |
addOutputProducer(DeviceProducer<E> c)
Add new output producer |
Device<E> |
getConnected()
Return the connected device |
E |
read()
Read data from input. |
E |
readOutput()
|
boolean |
readyRead()
Check if data area available on input. |
boolean |
readyReadOutput()
|
boolean |
readyWrite()
Check if the output buffer is full. |
void |
removeInputConsumer(DeviceConsumer<E> c)
Remove an input consumer |
void |
removeOutputConsumer(DeviceConsumer<E> c)
Remove a consumer from the output queue. |
void |
setConnected(Device<E> c)
Connect another device to this. |
void |
write(E c)
Write data in the output buffer |
void |
writeInput(E c)
Write data in the input buffer |
Methods inherited from class jmce.sim.AbstractPeripheral |
---|
idle, registerCPU, setIdle, setLive |
Methods inherited from class jmce.sim.AbstractHardware |
---|
addHardware, createFrame, destroy, getHardware, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareForName, getHardwareInstances, getHardwareTree, getName, getParent, init, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface jmce.sim.Hardware |
---|
addHardware, destroy, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareInstances, getHardwareTree, getName, getParent, init, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName |
Constructor Detail |
---|
public Device(java.lang.String name)
public Device()
Method Detail |
---|
public void removeInputConsumer(DeviceConsumer<E> c)
public void addInputConsumer(DeviceConsumer<E> c)
public void addInputProducer(DeviceProducer<E> c) throws SIMException
SIMException
public void removeOutputConsumer(DeviceConsumer<E> c)
public void addOutputConsumer(DeviceConsumer<E> c) throws SIMException
SIMException
public void addOutputProducer(DeviceProducer<E> c) throws SIMException
SIMException
public boolean readyRead()
public E read() throws SIMException
Read the next available data. If no data is available wait for new one.
SIMException
public boolean readyWrite()
public void write(E c) throws SIMException
SIMException
public boolean readyReadOutput()
public E readOutput() throws SIMException
SIMException
public void writeInput(E c) throws SIMException
SIMException
public Device<E> getConnected()
public void setConnected(Device<E> c) throws SIMException
produced
from this Device sill be
sent to the connected device and all data produced from the
connected device will be sent to this device.
c
- Device to connect.
SIMException
|
jmce - 1_02 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |