fi.hu.cs.ttk91
Interface TTK91Core

All Known Implementing Classes:
Control

public interface TTK91Core


Method Summary
 TTK91Application compile(TTK91CompileSource source)
          This method compiles given TTK91CompileSource into a TTK91Application.
 java.lang.String getBinary(TTK91Application application)
          This function return the program in TTK91 binary file format
 TTK91Cpu getCpu()
          Returns a copy of the CPU in the virtual machine
 TTK91Memory getMemory()
          Returns a copy of the memory in the virtual machine
 TTK91Application loadBinary(java.lang.String binary)
          Loads TTK91 binary format into a TTK91Application
 void run(TTK91Application app, int steps)
          This method runs given TTK91Application in the TTK91 virtual machine.
 

Method Detail

compile

public TTK91Application compile(TTK91CompileSource source)
                         throws TTK91Exception,
                                TTK91CompileException
This method compiles given TTK91CompileSource into a TTK91Application. If source returned by TTK91CompileSource is null, then a null TTK91Application is to be returned.

Parameters:
source - TTK91CompileSource describin
Returns:
Represents the application that is runnable in this TTK91Core
Throws:
TTK91CompileException - thrown when encountered an invalid source code.
TTK91Exception - place holder for extension.
java.lang.IllegalArgumentException - thrown when TTK91CompileSource is not valid (null).

run

public void run(TTK91Application app,
                int steps)
         throws TTK91Exception,
                TTK91RuntimeException
This method runs given TTK91Application in the TTK91 virtual machine.

Parameters:
app - Application to be run, must be created using compile of the same TTK91Core. May not be null.
steps - number of cpu cycle's to operate without stop. Zero (0) means to the end. anything above zero means this much or the end. anything less than zero is error.
Throws:
TTK91RuntimeException - when encountered an invalid operation by the TTK91Application.
TTK91Exception - place holder for extension.
java.lang.IllegalArgumentException - thrown when TTK91Application is not valid, or int steps is less than zero.

getMemory

public TTK91Memory getMemory()
Returns a copy of the memory in the virtual machine

Returns:
Copy of the memory

getCpu

public TTK91Cpu getCpu()
Returns a copy of the CPU in the virtual machine

Returns:
copy of the CPU of the virtual machine

loadBinary

public TTK91Application loadBinary(java.lang.String binary)
                            throws java.text.ParseException
Loads TTK91 binary format into a TTK91Application

Parameters:
binary - binary to load from
Returns:
application ready for running
Throws:
java.text.ParseException - if binary is not of TTK91 binary format

getBinary

public java.lang.String getBinary(TTK91Application application)
This function return the program in TTK91 binary file format

Returns:
String representing the binary format or null if failed