fi.hu.cs.titokone
Class CompileInfo

java.lang.Object
  extended byfi.hu.cs.titokone.DebugInfo
      extended byfi.hu.cs.titokone.CompileInfo

public class CompileInfo
extends DebugInfo

This class is used to tell GUIBrain what compiler has done at the moment. CompileDebugger creates objects from this class and passes them to the GUIBrain.


Field Summary
(package private)  java.lang.String[] data
           
private  boolean finalFinal
          This field contains true if we have gone through all DS and DC commands and are setting FP and SP accordingly, or false if we are still going through DS and DC commands.
static short FINALIZING
           
static short FINALIZING_FIRST_ROUND
           
static short FIRST_ROUND
           
(package private)  java.lang.String[] instructions
          These arrays contain codelines, data and the symboltable after first round.
private  boolean labelDefined
          This field is true if found label was defined before.
private  boolean labelFound
          This field contains information if a label was found.
private  java.lang.String labelName
          This field contains the name of a label found from the beginning of this line.
private  int labelValue
          This field contains value of the current label.
private  int lineBinary
          This field contains line as a binary.
private  java.lang.String lineContents
          This field hold the contents of a compiled line.
private  boolean lineEmpty
          This field is by default false, but if the compiled line was empty (or consisted of whitespace only), the true value here says that other checks can be skipped.
private  int lineNumber
          This field contains the number of the line being processed or -1 during the finalizing phase.
private  short phase
           
static short SECOND_ROUND
           
private  int symbolAddress
          This field contains the address of the symbol.
private  boolean symbolDefined
          This field is true if the symbol's value was also defined on this line.
private  boolean symbolFound
          This field contains information if a symbol was foud.
private  java.lang.String symbolName
          This field contains the name of a symbol found on this line from the parameter field.
(package private)  java.lang.String[][] symbolTable
           
private  int symbolValue
          This field contains the value of the symbol found.
 
Fields inherited from class fi.hu.cs.titokone.DebugInfo
 
Constructor Summary
CompileInfo(short phase)
          This constructor is used when no actual line is compiled but other actions are made like finalizing the rounds.
CompileInfo(short phase, int lineNumber, java.lang.String lineContents)
          This is normal constructor for CompileInfo.
 
Method Summary
 java.lang.String[] getData()
          This method returns the variable values after compiler has finished first round of compilation.
 boolean getFinalPhase()
          This method returns true if field finalFinal is set.
 java.lang.String[] getInstructions()
          This method returns codelines of the memory after compiler has finished first round of compilation.
 boolean getLabelFound()
          This method returns true if a label was found.
 java.lang.String getLabelName()
          This method returns the name of the current label.
 int getLabelValue()
          This method returns value of the current label.
 int getLineBinary()
          This method returns compiled binary machinecommand represented as an integer value.
 java.lang.String getLineContents()
          This method return symbolic contents of the line.
 boolean getLineEmpty()
          This message tells that an empty line or line containing only whitespaces was compiled.
 int getLineNumber()
          This method tells which line was processed.
 short getPhase()
          This method returns current phase as a short.
 boolean getSymbolDefined()
          This method returns true if a symbol was defined.
 boolean getSymbolFound()
          This method returns true if a symbol was found.
 java.lang.String getSymbolName()
          This method returns found symbolname.
 java.lang.String[][] getSymbolTable()
          This method returns the symboltable gathered during the first round.
 int getSymbolValue()
          This method returns value of current symbol.
 void setData(java.lang.String[] data)
          This method sets data area of a memory to contain all codelines after first round of compilation.
 void setFinal()
          This method sets the boolean field finalFinal to true.
 void setInstructions(java.lang.String[] instructions)
          This method sets memory array to contain all codelines after first round of compilation.
 void setLabelDefined(java.lang.String name, int value)
          This method tells CompileInfo that a given label was defined and it's value.
 void setLabelFound()
          This method sets labelFound field.
 void setLabelName(java.lang.String name)
          This method sets the name of a found label and sets the labelDefined field to true.
 void setLineBinary(int binary)
          This method tells what integer represents the compiled line of the code.
 void setLineEmpty()
          This method sets lineEmpty value to true.
 void setMemoryline(int lineNumber, java.lang.String value)
          This method sets given line to given value.
 void setSymbolFound()
          This method sets symbolFound field.
 void setSymbolName(java.lang.String name)
          This method sets the name of a found symbol.
 void setSymbolName(java.lang.String name, int value)
          This method sets the name of a found symbol and its value.
 void setSymbolTable(java.lang.String[][] symbolTable)
           
 
Methods inherited from class fi.hu.cs.titokone.DebugInfo
getComments, getStatusMessage, setComments, setStatusMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIRST_ROUND

public static final short FIRST_ROUND
See Also:
Constant Field Values

FINALIZING_FIRST_ROUND

public static final short FINALIZING_FIRST_ROUND
See Also:
Constant Field Values

SECOND_ROUND

public static final short SECOND_ROUND
See Also:
Constant Field Values

FINALIZING

public static final short FINALIZING
See Also:
Constant Field Values

phase

private short phase

lineNumber

private int lineNumber
This field contains the number of the line being processed or -1 during the finalizing phase.


lineContents

private java.lang.String lineContents
This field hold the contents of a compiled line.


instructions

java.lang.String[] instructions
These arrays contain codelines, data and the symboltable after first round.


data

java.lang.String[] data

symbolTable

java.lang.String[][] symbolTable

lineEmpty

private boolean lineEmpty
This field is by default false, but if the compiled line was empty (or consisted of whitespace only), the true value here says that other checks can be skipped.


symbolName

private java.lang.String symbolName
This field contains the name of a symbol found on this line from the parameter field. It will be set to "" if no symbol was found on this line. See also symbolValue, symbolDefined and label variables.


symbolDefined

private boolean symbolDefined
This field is true if the symbol's value was also defined on this line. In this case, the value is set in symbolValue.


symbolValue

private int symbolValue
This field contains the value of the symbol found. If symbolDefined is false, the value in this field should be ignored.


symbolAddress

private int symbolAddress
This field contains the address of the symbol.


symbolFound

private boolean symbolFound
This field contains information if a symbol was foud.


labelFound

private boolean labelFound
This field contains information if a label was found.


labelName

private java.lang.String labelName
This field contains the name of a label found from the beginning of this line. It will be set to "" if no label was found on this line.


lineBinary

private int lineBinary
This field contains line as a binary.


labelDefined

private boolean labelDefined
This field is true if found label was defined before.


labelValue

private int labelValue
This field contains value of the current label.


finalFinal

private boolean finalFinal
This field contains true if we have gone through all DS and DC commands and are setting FP and SP accordingly, or false if we are still going through DS and DC commands.

Constructor Detail

CompileInfo

public CompileInfo(short phase,
                   int lineNumber,
                   java.lang.String lineContents)
This is normal constructor for CompileInfo. It sets initial values for phase, lineNumber and lineContents.

Parameters:
phase - Short indicating which phase is going on.
lineNumber - Integer value of the current line number.
lineContents - String containing symbolic command.

CompileInfo

public CompileInfo(short phase)
This constructor is used when no actual line is compiled but other actions are made like finalizing the rounds.

Parameters:
phase - short indicating which phase is going on.
Method Detail

setLineEmpty

public void setLineEmpty()
This method sets lineEmpty value to true.


setSymbolFound

public void setSymbolFound()
This method sets symbolFound field.


setSymbolName

public void setSymbolName(java.lang.String name)
This method sets the name of a found symbol.

Parameters:
name - String containing the symbol name.

setSymbolName

public void setSymbolName(java.lang.String name,
                          int value)
This method sets the name of a found symbol and its value.

Parameters:
name - Name of the symbol.
value - Value of the symbol.

setLabelFound

public void setLabelFound()
This method sets labelFound field.


setLabelName

public void setLabelName(java.lang.String name)
This method sets the name of a found label and sets the labelDefined field to true.

Parameters:
name - Name of the label.

setLabelDefined

public void setLabelDefined(java.lang.String name,
                            int value)
This method tells CompileInfo that a given label was defined and it's value. It sets labelDefined field to true.

Parameters:
name - String containing the name of the label.
value - An integer value where the label points.

setLineBinary

public void setLineBinary(int binary)
This method tells what integer represents the compiled line of the code.

Parameters:
binary - An integer value representing the symbolic command.

setFinal

public void setFinal()
This method sets the boolean field finalFinal to true.


setMemoryline

public void setMemoryline(int lineNumber,
                          java.lang.String value)
This method sets given line to given value.

Parameters:
lineNumber - Number of the line.
value - New value for the line.

setInstructions

public void setInstructions(java.lang.String[] instructions)
This method sets memory array to contain all codelines after first round of compilation. It contains only symbolic lines.

Parameters:
instructions - array containing code-lines.

setData

public void setData(java.lang.String[] data)
This method sets data area of a memory to contain all codelines after first round of compilation. It contains variable values.

Parameters:
data - array containing data-area.

setSymbolTable

public void setSymbolTable(java.lang.String[][] symbolTable)

getLineEmpty

public boolean getLineEmpty()
This message tells that an empty line or line containing only whitespaces was compiled.


getPhase

public short getPhase()
This method returns current phase as a short. 0 for first round, 1 for finalizing first round, 2 for second and 3 for final.

Returns:
Short containing phase.

getLineContents

public java.lang.String getLineContents()
This method return symbolic contents of the line.

Returns:
String containing symbolic representation of a compiled line.

getLineNumber

public int getLineNumber()
This method tells which line was processed.

Returns:
Int value of the line in question.

getSymbolName

public java.lang.String getSymbolName()
This method returns found symbolname.

Returns:
String containing the name.

getSymbolDefined

public boolean getSymbolDefined()
This method returns true if a symbol was defined.

Returns:
boolean containing information if symbol was defined.

getLabelFound

public boolean getLabelFound()
This method returns true if a label was found.

Returns:
boolean containing information if label was found.

getSymbolFound

public boolean getSymbolFound()
This method returns true if a symbol was found.

Returns:
boolean containing information if symbol was found.

getSymbolValue

public int getSymbolValue()
This method returns value of current symbol.

Returns:
An integer containing symbol's value.

getLineBinary

public int getLineBinary()
This method returns compiled binary machinecommand represented as an integer value.

Returns:
An integer representing machine command.

getLabelName

public java.lang.String getLabelName()
This method returns the name of the current label.

Returns:
Name of the current label.

getLabelValue

public int getLabelValue()
This method returns value of the current label.

Returns:
An integer containing value of the label.

getFinalPhase

public boolean getFinalPhase()
This method returns true if field finalFinal is set.

Returns:
Boolean.

getInstructions

public java.lang.String[] getInstructions()
This method returns codelines of the memory after compiler has finished first round of compilation. This array contains all codelines other than white spaces, empty lines and variable definitions has been removed.

Returns:
String array containing symbolic lines.

getData

public java.lang.String[] getData()
This method returns the variable values after compiler has finished first round of compilation. This array contains all codelines but all white spaces and empty lines has been removed.

Returns:
String array containing variable values.

getSymbolTable

public java.lang.String[][] getSymbolTable()
This method returns the symboltable gathered during the first round.

Returns:
Array representing the symboltable. Each entry has 2 values. First position (0) tells the name of the symbol and the second one (1) holds the value of that symbol. "" If it wasn't set.