package runEnv; 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 instance" ); } public RunData dataValue() { throw new Error( "Can't cast runtime " + this + " to reference" ); } public abstract String toString(); public static String toString( RunValue value ) { if ( value == null ) return "null"; else return value.toString(); } }