import java.io.PrintWriter; import Instruction; /** * The standard "Compare" instruction for AAAL, the amazingly abstract * assembly language. Used with the Jump-if-Equal and Jump-if-not-Equal * instructions. * * @author Samuel A. Rebelsky * @version 1.0 of April 2001 */ public class Compare implements Instruction { // +--------+------------------------------------------------------------ // | Fields | // +--------+ /** The first thing to compare. */ protected Location first; /** The second thing to compare. */ protected Location second; // +--------------+------------------------------------------------------ // | Constructors | // +--------------+ /** * Build a new instruction to compare two values. */ public Compare(Location first, Location second) { this.first = first; this.second = second; } // Compare(Location, Location); // +---------------------+----------------------------------------------- // | Instruction Methods | // +---------------------+ /** * Print the instruction. */ public void print(PrintWriter out) { out.print(" CMP "); this.first.print(out); out.print(" to "); this.second.print(out); out.println(); } // print(PrintWriter) } // class Compare