org.razvan.jzx
Class BaseComponent

java.lang.Object
  extended by org.razvan.jzx.BaseComponent
Direct Known Subclasses:
AY8912, BaseIO, BaseKeyboard, BaseMemory, BaseSpectrum, Z80

public abstract class BaseComponent
extends java.lang.Object

Base class extended by all components that comprise the emulator.

This class is part of a Composite pattern, whereby it contains a BaseSpectrum instance which, in turn, it exposes all the other relevant components that make up the Spectrum. Any component can get access to any other component by using the BaseSpectrum instance.

The class mandates four major lifetime events for any component:

Author:
Razvan Surdulescu (c) 2001 - 2006
You may use and distribute this software for free provided you include this copyright notice. You may not sell this software, use my name for publicity reasons or modify the code without permission from me.
See Also:
BaseSpectrum

Field Summary
protected  ILogger m_logger
          The ILogger object used to log error and output information.
protected  BaseSpectrum m_spectrum
          The BaseSpectrum instance, of which this BaseComponent is a part.
 
Constructor Summary
BaseComponent()
           
 
Method Summary
 BaseSpectrum getSpectrum()
          Trivial accessor for the BaseSpectrum instance.
 void init(BaseSpectrum spectrum, ILogger logger)
          Initialize the component.
abstract  void load(BaseLoader loader)
          Load previously saved state into the component.
abstract  void reset()
          Reset the state of the component.
 void terminate()
          Terminate the component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_spectrum

protected BaseSpectrum m_spectrum
The BaseSpectrum instance, of which this BaseComponent is a part.


m_logger

protected ILogger m_logger
The ILogger object used to log error and output information.

Constructor Detail

BaseComponent

public BaseComponent()
Method Detail

getSpectrum

public BaseSpectrum getSpectrum()
Trivial accessor for the BaseSpectrum instance.


init

public void init(BaseSpectrum spectrum,
                 ILogger logger)
Initialize the component.

This method can only be called once at the beginning, or after terminate() is called.


terminate

public void terminate()
Terminate the component.

This method can only be called once after init() is called.


reset

public abstract void reset()
Reset the state of the component.

This method can be called as many times as you wish in between a call to init() and a call to terminate().


load

public abstract void load(BaseLoader loader)
Load previously saved state into the component.

This method can be called as many times as you wish in between a call to init() and a call to terminate(). This method is undone by a call to reset().