dioscuri.module
Class AbstractModule

java.lang.Object
  extended by dioscuri.module.AbstractModule
All Implemented Interfaces:
Module
Direct Known Subclasses:
DeviceDummy, DMAController, ModuleATA, ModuleBIOS, ModuleClock, ModuleCPU, ModuleDMA, ModuleFDC, ModuleKeyboard, ModuleMemory, ModuleMotherboard, ModuleMouse, ModuleParallelPort, ModulePIC, ModulePIT, ModuleRTC, ModuleScreen, ModuleSerialPort, ModuleVideo, PCI

public abstract class AbstractModule
extends java.lang.Object
implements Module

Abstract class representing a generic hardware module.


Nested Class Summary
 
Nested classes/interfaces inherited from interface dioscuri.interfaces.Module
Module.Type
 
Field Summary
protected  Module.Type type
          the Type of this AbstractModule
 
Constructor Summary
AbstractModule(Module.Type type, Module.Type... expectedConnections)
          Creates a new instance of a module.
 
Method Summary
 Module getConnection(Module.Type type)
          Returns the Module of a certain Type connected to this Module.
 java.util.Map<Module.Type,Module> getConnections()
          Returns all connected, or supposedly connected, Modules of this Module.
 boolean getDebugMode()
          Returns the state of debug mode
 java.lang.String getDump()
          Return a dump of module status
 Module.Type[] getExpectedConnections()
          Get all Module.Type's this AbstractModule is supposed to be connected to.
 Module.Type getType()
          Returns the Type of this Module.
 boolean isConnected()
          Checks if this module is connected to operate normally
abstract  boolean reset()
          Reset all parameters of module.
 boolean setConnection(Module module)
          Connect both Modules 'this' and 'module' to each other.
 void setDebugMode(boolean status)
          Set toggle to define if this module is in debug mode or not
 void start()
          Starts the module to become active.
 void stop()
          Stops the module from being active.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

protected final Module.Type type
the Type of this AbstractModule

Constructor Detail

AbstractModule

public AbstractModule(Module.Type type,
                      Module.Type... expectedConnections)
Creates a new instance of a module.

Parameters:
type - the type of this module.
expectedConnections - optional number of types this module is supposed to be connected to when the emulation process starts.
Method Detail

getConnection

public final Module getConnection(Module.Type type)
Returns the Module of a certain Type connected to this Module.

Specified by:
getConnection in interface Module
Parameters:
type - the Type of the Module to be fetched.
Returns:
the Module of a certain Type connected to this Module.
See Also:
Module

getConnections

public final java.util.Map<Module.Type,Module> getConnections()
Returns all connected, or supposedly connected, Modules of this Module.

Specified by:
getConnections in interface Module
Returns:
all connected, or supposedly connected, Modules of this Module.
See Also:
Module

getDebugMode

public final boolean getDebugMode()
Returns the state of debug mode

Specified by:
getDebugMode in interface Module
Returns:
true if this module is in debug mode, false otherwise
See Also:
Module

getDump

public java.lang.String getDump()
Return a dump of module status

Provides a dummy implementation since many of the subclasses of this abstract module class do not need or use a getDump() implementation. The ones that do, can override this method.

Specified by:
getDump in interface Module
Returns:
string containing a dump of this module
See Also:
Module

getExpectedConnections

public final Module.Type[] getExpectedConnections()
Get all Module.Type's this AbstractModule is supposed to be connected to.

Specified by:
getExpectedConnections in interface Module
Returns:
an array of Module.Type's this AbstractModule is supposed to be connected to.
See Also:
Module

getType

public final Module.Type getType()
Returns the Type of this Module.

Specified by:
getType in interface Module
Returns:
the Type of this Module.
See Also:
Module

isConnected

public final boolean isConnected()
Checks if this module is connected to operate normally

Specified by:
isConnected in interface Module
Returns:
true if this module is connected successfully, false otherwise
See Also:
Module

reset

public abstract boolean reset()
Reset all parameters of module.

Specified by:
reset in interface Module
Returns:
true iff the AbstractModule was reset properly.
See Also:
Module

setConnection

public final boolean setConnection(Module module)
Connect both Modules 'this' and 'module' to each other.

Specified by:
setConnection in interface Module
Parameters:
module - the other AbstractModule.
Returns:
true iff both Modules 'this' and 'module' are properly connected to each other.
See Also:
Module

setDebugMode

public final void setDebugMode(boolean status)
Set toggle to define if this module is in debug mode or not

Specified by:
setDebugMode in interface Module
Parameters:
status - the new debug mode for this AbstractModule.
See Also:
Module

start

public void start()
Starts the module to become active.

Provides an empty implementations since many of the subclasses of this abstract module class do not need a start() implementation. The ones that do, can override this method.

Specified by:
start in interface Module
See Also:
Module

stop

public void stop()
Stops the module from being active.

Provides an empty implementations since many of the subclasses of this abstract module class do not need a stop() implementation. The ones that do, can override this method.

Specified by:
stop in interface Module
See Also:
Module