Package mars.tools

Interface MarsTool

All Known Implementing Classes:
AbstractMarsTool, BHTSimulator, BitmapDisplay, CacheSimulator, DigitalLabSimulator, FloatRepresentation, InstructionCounter, InstructionStatistics, IntroToTools, KeyboardAndDisplaySimulator, MemoryReferenceVisualization, MipsXray, VisualStack

public interface MarsTool
Interface for any tool that interacts with an executing MIPS program. A qualifying tool must be a class in the Tools package that implements the MarsTool interface, must be compiled into a .class file, and its .class file must be in the same Tools folder as MarsTool.class. Mars will detect a qualifying tool upon startup, create an instance using its no-argument constructor and add it to its Tools menu. When its menu item is selected, the action() method will be invoked.

A tool may receive communication from MIPS system resources (registers or memory) by registering as an observer with Memory and/or Register objects.

It may also communicate directly with those resources through their published methods, provided any such communication is done using Simulator.changeState(Runnable).

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Performs tool functions.
    default Icon
    Return the icon you have chosen for this tool, which will be used for the menu item.
    default String
    Return the name you have chosen for this tool, which will be used for the menu item.
    default int
    Return the tool menu order number.
  • Method Details

    • getName

      default String getName()
      Return the name you have chosen for this tool, which will be used for the menu item. If not implemented, uses the class name.
    • getIcon

      default Icon getIcon()
      Return the icon you have chosen for this tool, which will be used for the menu item. If not implemented, no icon is displayed.
    • getToolMenuOrder

      default int getToolMenuOrder()
      Return the tool menu order number. Tools in the tool menu list are sorted by this number, then alphabetically - to get your tool at the top, choose a lesser number. Likewise, to get your tool at the bottom, choose a greater number.
    • action

      void action()
      Performs tool functions. It will be invoked when the tool is selected from the Tools menu.