package runEnv; import java.util.*; public abstract class RunValue { /* Represents a run time value */ public int intValue() { throw new Error( "Can't cast runtime value to int" ); } public char charValue() { throw new Error( "Can't cast runtime value to char" ); } public double realValue() { throw new Error( "Can't cast runtime value to real" ); } public boolean boolValue() { throw new Error( "Can't cast runtime value to bool" ); } public String stringValue() { return toString(); } public ArrayValue arrayValue() { throw new Error( "Can't cast runtime " + this + " to array" ); } public InstanceValue instanceValue() { throw new Error( "Can't cast runtime " + this + " to structure" ); } public RunAddress addressValue() { throw new Error( "Can't cast runtime " + this + " to reference" ); } public RunEnv runEnv() { throw new Error( "Can't cast runtime " + this + " to method" ); } public abstract String toString(); public static String toString( RunValue value ) { if ( value == null ) return "null"; else return value.toString(); } }