jmce - 1_02

jmce.sim
Interface Hardware

All Known Subinterfaces:
CPU, CRT, Disk, DiskController, DiskCPM, I2cSlave, Memory, Peripheral, Register, SpectrumMemory, Tape
All Known Implementing Classes:
AbstractCPU, AbstractCRT, AbstractDisk, AbstractDiskController, AbstractHardware, AbstractMemory, AbstractPeripheral, AbstractRegister, AbstractTape, Altair, ArrayMemory, AT24C16, AT89C51RD2, BankedMemory, BootLoader, CMON51, CombinedMemory, Console, Console, Console, Console, CTC, Delay, Device, DirDiskCPM, Diseqc, DiseqcI2cBus, DiseqcMotor, Display, Display, DuplicateMemory, FastMemory, FDC, FDC, FDC, Hazeltine1500, I2cBus, I8080, I8086, I8237, ImageDisk, ImageDiskCPM, Imsai, Jmce, JPorts, Keyboard, KeyboardMatrix, Leds, Loadable, LoadableMemory, LPC764, LPC900, LPC936, M6502, M68HC05, M68HC08, MappedMemory, MCS51, MCS52, Memory, Memory, Memory, Memory128K, Memory48K, MemoryDisk, MemoryRegister, Monitor, Network, NullDisk, P2000T, PairRegister, PCXT, PD765, PersistentMemory, PlainMemory, PolledSerial, Port, Ports, Ports, Ports, Printer, ReadOnlyMemory, RXTX, S400, SAA5050, SampleTerminal, Screen, Serial, Serial, SerialFile, SerialRXTX, SIMH, Speaker, Speaker, Spectrum, Spectrum128K, Spectrum48K, StandardRegister, SwingCRT, SwingKeyboard, SysKit, Tape, Tape, TapeFile, TCPClient, TCPServer, TCPSocket, Terminal, Timer, Timer, Timer, Timer2, ttyCRT, Uart, V8052, VIA6522, VIC20, VIC6561, VIC6561, VT100, Yaze, Z19, Z80, Z80Pack

public interface Hardware

Generic hardware interface.

Every class involved in the simulator must implements this interface, the structure is like a tree and every Hardware have zero or more children.

Normally the children depend from the parent. For example a Simulator have one CPU children, the CPU one Disk Controller and the Disk Controller 4 Harddisk. This type of link is checked at runtime and is responsability of the implementation to add correct children class.

To permit serialization every hardware instance must add children in the init method after have verified that children is not present, this is not so comfortable but permit to use the XML Enmcoder/Decoder to configure new system using simple text file.

It is very important to make all the initialization in the iniit() method and not in the constructor, the constructor can only call method to set and get properties.

Version:
1.00
Author:
Mario Viara
See Also:
init(jmce.sim.Hardware)

Method Summary
 Hardware addHardware(Hardware h)
          Add a new child.
 void destroy()
          Destroy the device.
 Hardware[] getHardware()
           
 Hardware getHardware(java.lang.Class clazz)
          Get the first child of the specified Class.
 Hardware getHardware(java.lang.Class clazz, int n)
          Get the n occuurence of the specified class.
 Hardware getHardware(int n)
           
 int getHardwareCount()
          Return the number of child
 java.lang.Object[] getHardwareInstances(java.lang.Class c)
          Return one array with all instance of the specified Class
 Hardware getHardwareTree(java.lang.Class... classes)
          Return a class walking the current Hardware as a tree.
 java.lang.String getName()
          Return the name.
 Hardware getParent()
          Return the parent
 void init(Hardware parent)
          Initialize the hardware.
 void initSwing(Hardware parent)
          initialize if present the swing hardware.
 void removeHardware(Hardware h)
          Remove one child if present.
 void removeHardware(int n)
          Remove the child at postion.
 void reset()
          Reset the the device to the initial state.
 void setHardware(Hardware[] h)
           
 void setHardware(int n, Hardware h)
           
 void setName(java.lang.String name)
          Set the name.
 

Method Detail

setName

void setName(java.lang.String name)
Set the name.


getName

java.lang.String getName()
Return the name.


init

void init(Hardware parent)
          throws SIMException
Initialize the hardware. This method must be called before any use of the interface. Only set ... / get ... method are allowed to be called before the intialization.

Parameters:
parent - Parent of this hardware.
Throws:
SIMException

initSwing

void initSwing(Hardware parent)
               throws SIMException
initialize if present the swing hardware. Initialize all Hardware implementing SwingHardware.

Parameters:
parent - - Parent Hardware
Throws:
SIMException
See Also:
SwingHardware

reset

void reset()
           throws SIMException
Reset the the device to the initial state. This method will be called after init.

Throws:
SIMException

destroy

void destroy()
             throws SIMException
Destroy the device. This method can be called only one time

Throws:
SIMException

getParent

Hardware getParent()
Return the parent


addHardware

Hardware addHardware(Hardware h)
Add a new child.


getHardwareCount

int getHardwareCount()
Return the number of child


removeHardware

void removeHardware(Hardware h)
Remove one child if present.


removeHardware

void removeHardware(int n)
Remove the child at postion.


getHardwareInstances

java.lang.Object[] getHardwareInstances(java.lang.Class c)
Return one array with all instance of the specified Class


getHardwareTree

Hardware getHardwareTree(java.lang.Class... classes)
Return a class walking the current Hardware as a tree.

Parameters:
classes - - List of class to search.

getHardware

Hardware getHardware(java.lang.Class clazz)
Get the first child of the specified Class.

Parameters:
clazz - Class of the object to be retrivied.
Returns:
the firsrt child of the specified Class or null if no child is found.

getHardware

Hardware getHardware(java.lang.Class clazz,
                     int n)
Get the n occuurence of the specified class.

Parameters:
clazz - Class to be retrivied.
n - Occurence.
Returns:
The occurence n of Class clazz or null if no occurence can be found.

setHardware

void setHardware(int n,
                 Hardware h)

getHardware

Hardware getHardware(int n)

getHardware

Hardware[] getHardware()

setHardware

void setHardware(Hardware[] h)

jmce - 1_02