package rebelsky.pal; /** * A comment in PAL, the Pseudo-assembly language. * * @author Samuel A. Rebelsky * @version 1.0 of November 2002. */ public class Comment implements Instruction { // +--------+------------------------------------------------------------ // | Fields | // +--------+ /** The text of the comment. */ String comment; // +--------------+------------------------------------------------------ // | Constructors | // +--------------+ /** * Build a new comment with specified contents. */ public Comment(String contents) { this.comment = contents; } // Comment(String) // +---------+----------------------------------------------------------- // | Methods | // +---------+ /** * Execute the instruction on a machine. Comments are no-ops. */ public void execute(Computer hal) { } // execute(Computer) /** Convert the instruction to a string (usually for printing). */ public String toString() { return "# " + comment; } // toString() } // class Comment