miSim

misim.asm
Class Label

java.lang.Object
  |
  +--misim.asm.Label

public class Label
extends java.lang.Object

A lebel defines the value of a text label in the assembly listing. Labels are handled by Context objects, that define the scope of each label.


Field Summary
static int LABEL_ADDRESS
           
static int LABEL_CONSTANT
           
static int LABEL_UNKNOWN
           
static int LABEL_VARIABLE
           
 
Constructor Summary
Label(java.lang.String text, int labelType)
          Construct a new undefined label for the given text and type
Label(java.lang.String text, int value, int labelType)
          Construct a new defined label for the given text, value and type.
 
Method Summary
 int getType()
           
 int getValue(Token aToken)
          Get the numeric value for this label
 boolean isDefined()
           
 void setType(int newType)
           
 void setValue(int value, Token aToken)
          Set the numeric value for this label
 void undefine()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LABEL_CONSTANT

public static final int LABEL_CONSTANT

LABEL_VARIABLE

public static final int LABEL_VARIABLE

LABEL_ADDRESS

public static final int LABEL_ADDRESS

LABEL_UNKNOWN

public static final int LABEL_UNKNOWN
Constructor Detail

Label

public Label(java.lang.String text,
             int labelType)
Construct a new undefined label for the given text and type
Parameters:
text - The text for this label
labelType - The type of this label

Label

public Label(java.lang.String text,
             int value,
             int labelType)
Construct a new defined label for the given text, value and type.
Parameters:
text - The text for this label
value - The value for this label
labelType - The type of this label
Method Detail

getValue

public int getValue(Token aToken)
             throws EditorException
Get the numeric value for this label
Parameters:
aToken - The token that referred to this label
Returns:
The integer value of this label
Throws:
EditorException - If this label is undefined

setValue

public void setValue(int value,
                     Token aToken)
              throws EditorException
Set the numeric value for this label
Parameters:
value - The new value for this label
aToken - The token that referred to this label
Throws:
EditorException - if this label is a constant and cannot be changed

isDefined

public boolean isDefined()

undefine

public void undefine()

getType

public int getType()

setType

public void setType(int newType)

miSim