Class Label

java.lang.Object
  extended by Asm
      extended by Label

public class Label
extends Asm

Represents a label definition. Extends the abstract class Asm.


Field Summary
protected  java.lang.String label
          String representation of the label.
 
Fields inherited from class Asm
addr, lineNumber
 
Constructor Summary
Label(java.lang.String label, int lineNumber)
          Constructor takes label as an argument.
 
Method Summary
static void addToMap(java.lang.String label, int addr)
          Add (label, address) pair to the label map
static int getFromMap(java.lang.String label)
          Get the address of some label that was previously added to the map Returns -1 if label was not added to the map
 java.lang.String getLabel()
          Gets the label
static boolean isLabel(java.lang.String str)
          Checks if string is a label
 java.lang.String toString()
          Returns string representation of label
 
Methods inherited from class Asm
getAddr, getLineNumber, setAddr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

label

protected java.lang.String label
String representation of the label.

Constructor Detail

Label

public Label(java.lang.String label,
             int lineNumber)
Constructor takes label as an argument.

Parameters:
label - string representation of the label.
lineNumber - line number of label.
Method Detail

getLabel

public java.lang.String getLabel()
Gets the label

Returns:
label

toString

public java.lang.String toString()
Returns string representation of label

Overrides:
toString in class java.lang.Object
Returns:
string representation of label

isLabel

public static boolean isLabel(java.lang.String str)
Checks if string is a label

Parameters:
str - string to check
Returns:
true if label, false otherwise

addToMap

public static void addToMap(java.lang.String label,
                            int addr)
Add (label, address) pair to the label map

Parameters:
label - name of label
addr - address of label

getFromMap

public static int getFromMap(java.lang.String label)
Get the address of some label that was previously added to the map Returns -1 if label was not added to the map

Returns:
address of label (-1 if not found)