/** This class is for representation of object code for translated function blocks in the simulation of Assignment 2, CS 152, Section 4, Fall 2005. Use of the block naming facility is optional. It may be useful for debugging. Since the class is abstract, it needs to have subclasses. It is acceptable to have more than one subclass, some of which implement the execute method trivially. */ public abstract class Code { // the name of the block whose code is // being represented private String blockName; /** A constructor that uses a default block name */ public Code() { blockName = "none"; } /** A constructor that uses a given block name @param s the block name to be used */ public Code(String s) {blockName = s;} /** @return the name of the block whose code is being represented */ public String getBlockName() { return blockName; } public String toString() { return blockName + ": " + System.getProperty("line.separator"); } /** simulates execution of the code */ public abstract void execute(); }