Class Symbol

java.lang.Object
mars.assembler.Symbol

public class Symbol extends Object
Represents a MIPS program identifier to be stored in the symbol table.
Version:
June 2003
Author:
Jason Bumgarner, Jason Shrewsbury
  • Constructor Summary

    Constructors
    Constructor
    Description
    Symbol(String identifier, int address, boolean isData)
    Basic constructor, creates a symbol object.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the address of the the Symbol.
    Returns the label of the the Symbol.
    boolean
    Finds the type of symbol, text or data.
    boolean
    Finds the type of symbol, text or data.
    void
    setAddress(int address)
    Sets (replaces) the address of the the Symbol.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Symbol

      public Symbol(String identifier, int address, boolean isData)
      Basic constructor, creates a symbol object.
      Parameters:
      identifier - The name of the symbol.
      address - The address in memory which the symbol refers to.
      isData - true if the address is in a segment of memory containing data, or false if in a segment of memory containing text.
  • Method Details

    • getAddress

      public int getAddress()
      Returns the address of the the Symbol.
      Returns:
      The address of the Symbol.
    • getIdentifier

      public String getIdentifier()
      Returns the label of the the Symbol.
      Returns:
      The label of the Symbol.
    • isData

      public boolean isData()
      Finds the type of symbol, text or data.
      Returns:
      The type of the symbol. (true is data, false is text)
    • isText

      public boolean isText()
      Finds the type of symbol, text or data.
      Returns:
      The type of the symbol. (true is text, false is data)
    • setAddress

      public void setAddress(int address)
      Sets (replaces) the address of the the Symbol.
      Parameters:
      address - The revised address of the Symbol.