Class Directives

java.lang.Object
mars.assembler.Directives

public final class Directives extends Object
Class representing MIPS assembler directives. If Java had enumerated types, these would probably be implemented that way. Each directive is represented by a unique object. The directive name is indicative of the directive it represents. For example, DATA represents the MIPS .data directive.
Version:
August 2003
Author:
Pete Sanderson
  • Field Details

  • Method Details

    • matchDirective

      public static Directives matchDirective(String str)
      Find Directive object, if any, which matches the given String.
      Parameters:
      str - A String containing candidate directive name (e.g. ".ascii")
      Returns:
      If match is found, returns matching Directives object, else returns null.
    • prefixMatchDirectives

      public static ArrayList<Directives> prefixMatchDirectives(String str)
      Find Directive object, if any, which contains the given string as a prefix. For example, ".a" will match ".ascii", ".asciiz" and ".align"
      Parameters:
      str - A String
      Returns:
      If match is found, returns ArrayList of matching Directives objects, else returns null.
    • toString

      public String toString()
      Produces String-ified version of Directive object
      Overrides:
      toString in class Object
      Returns:
      String representing Directive: its MIPS name
    • getName

      public String getName()
      Get name of this Directives object
      Returns:
      name of this MIPS directive as a String
    • getDescription

      public String getDescription()
      Get description of this Directives object
      Returns:
      description of this MIPS directive (for help purposes)
    • getDirectiveList

      public static ArrayList<Directives> getDirectiveList()
      Produces List of Directive objects
      Returns:
      MIPS Directive
    • isIntegerDirective

      public static boolean isIntegerDirective(Directives direct)
      Lets you know whether given directive is for integer (WORD,HALF,BYTE).
      Parameters:
      direct - a MIPS directive
      Returns:
      true if given directive is WORD or HALF or BYTE, false otherwise
    • isFloatingDirective

      public static boolean isFloatingDirective(Directives direct)
      Lets you know whether given directive is for floating number (FLOAT,DOUBLE).
      Parameters:
      direct - a MIPS directive
      Returns:
      true if given directive is FLOAT or DOUBLE, false otherwise.