jfrace
Class Emulator

java.lang.Object
  |
  +--jfrace.Emulator

public class Emulator
extends java.lang.Object

The Emulator configurates a system and emulates it. It is a singleton and can be used as an application or inside an applet.

The configuration is done with the help of a configuration files. They are similar to Java properties files. For more details see SystemConfigurator.

Author:
Franz-Josef Elmer

Method Summary
 boolean analyseOption(java.lang.String option)
          Analyse a command line option.
 void configure(java.lang.String configSource, java.lang.String[] args)
          Build and configurate the system in accordance with the configuration file.
 java.net.URL getAbsoluteURL(java.lang.String relativeOrAbsoluteURL)
          Return the absolute URL built from relativeOrAbsoluteURL.
 AddressSpace getAddressSpace()
          Return the address space.
 java.applet.Applet getApplet()
          Return applet.
static Emulator getEmulator()
          Return the single instance of Emulator.
 boolean insideAnApplet()
          Return true if the emulator runs inside an Applet.
 boolean isNoEmulation()
          Return true if the no-emulation flag is set.
 boolean isWithGUI()
          Return true if GUI flag is set.
static void main(java.lang.String[] args)
          Configure a system and run it.
 void runEmulation()
          Run emulation.
 void setDocumentBase(java.net.URL anURL)
          Set the document base for relative URL sources.
 void stopEmulation()
          Stop emulation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getEmulator

public static Emulator getEmulator()
Return the single instance of Emulator.

main

public static void main(java.lang.String[] args)
Configure a system and run it. The usage is:
  java ce.Emulator [<options>] <configSource> [<additional options>]
  
where
<options>
Command line options
<configSource>
Source of the configuration file either an URL or a (local) file
<additional options>
These additional options will be delivered to configurators inside the configuration files

List of the valid command line options:

-d
-dstart
-dstart.end
-dstart.end.step
Debug mode. It starts after the start-th instruction has been executed and ends just before the end-th instruction. Every step-th step the CPUs will be printed on the console. The default values of start, end, and step are 0, infinity, and 1 resp.
-p
Print effective clock frequency in regular time steps. The time step is given (in msec) by the property adaptationTime of the configuration file.
-g
Show GUI which visualize CPU state and memory.
-n
Does not start emulation.
-t
In the case of more than one processor each processor will be emulated in its own thread.

getApplet

public java.applet.Applet getApplet()
Return applet.

insideAnApplet

public boolean insideAnApplet()
Return true if the emulator runs inside an Applet.

isNoEmulation

public boolean isNoEmulation()
Return true if the no-emulation flag is set. Is happens if a command line option was "-n".

isWithGUI

public boolean isWithGUI()
Return true if GUI flag is set. Is happens if a command line option was "-g".

getAddressSpace

public AddressSpace getAddressSpace()
Return the address space.

setDocumentBase

public void setDocumentBase(java.net.URL anURL)
Set the document base for relative URL sources.

getAbsoluteURL

public java.net.URL getAbsoluteURL(java.lang.String relativeOrAbsoluteURL)
Return the absolute URL built from relativeOrAbsoluteURL. If relativeOrAbsoluteURL starts with "http://" it is an absolute URL otherwise a relative one is assumed and an URL will be returned which is built by the document base (as it is set by the method setDocumentBase()) and relativeOrAbsoluteURL.

analyseOption

public boolean analyseOption(java.lang.String option)
Analyse a command line option.
Parameters:
option - Command line option including '-'.
Returns:
true if the option was a valid one.

configure

public void configure(java.lang.String configSource,
                      java.lang.String[] args)
               throws ConfigurationException
Build and configurate the system in accordance with the configuration file.
Parameters:
configSource - Source of the configuration file.
args - Additional arguments.
Throws:
ConfigurationException - in the case of an error (including syntax errors in the configuration file).

runEmulation

public void runEmulation()
Run emulation.

stopEmulation

public void stopEmulation()
Stop emulation.