public short getAddress(String functionName) throws ProgramException { Short address = (Short) functions.get(functionName); if (address != null) { return address.shortValue(); } else { String className = functionName.substring(0, functionName.indexOf(".")); if (staticRange.get(className) == null) { // The class is not implemented by a VM file - search for a // built-in implementation later. Display a popup to confirm // this as this is not a feature from the book but a later // addition. if (builtInAccessStatus == BUILTIN_ACCESS_UNDECIDED) { if (hasGUI && gui.confirmBuiltInAccess()) { builtInAccessStatus = BUILTIN_ACCESS_AUTHORIZED; } else { builtInAccessStatus = BUILTIN_ACCESS_DENIED; } } if (builtInAccessStatus == BUILTIN_ACCESS_AUTHORIZED) { return BUILTIN_FUNCTION_ADDRESS; } } // Either: // 1.The class is implemented by a VM file and no implementation // for the function is found - don't override with built-in // - or - // 2.The user did not authorize using built-in implementations. throw new ProgramException( className + ".vm not found " + "or function " + functionName + " not found in " + className + ".vm"); } }