Class InterpreterMessage

This class defines an interpreter message which consists of a message only. This is typically thrown by the Java methods which do not have access to the stack. The interpreter message class cannot be sub-classed by the application programmer. But the application programmer can create and also throw interpreter messages.

The application programmer can provide an arbitrary message term. A copy will be created and stored when the constructor is invoked. The copy can be retrieved via the method getValue().

The methods toString() will unparse the message term. The method without a knowledge base argument will only display the skeleton. The method without a knowledge base argu-ment will attempt to produce a user-friendly display by taking into account the message defi-nitions from the given toolkit.

The xxxError() methods provide conveniences to create message terms known from the ISO core standard. The checkXXX() methods provide convenience methods to check terms for certain conditions, and if these conditions are not met, a corresponding message is thrown. The castXXX() methods also return a type casted or unboxed value.

The method messageType() will return the Type when the original message term does have the form <fun>(Type). Otherwise the method will return null. The method mapIOException() will map an IOException to a InterpreterMessage. The latter method shouldn’t be used for InterruptedIOException, which should be handled by the Controller’s setSignal() method.

package jekpro.tools.call;

public class InterpreterMessage extends Exception {
public InterpreterMessage(Object t);

public Object getValue();
public String toString();
public String toString(Knowledgebase k);
public Object messageType(String fun);

public static String instantiationError();
public static Object typeError(String type, Object t);
public static Object domainError(String type, Object t);
public static Object representationError(String type);
public static Object existenceError(String type, Object t);
public static Object syntaxError(String type);
public static Object syntaxError(String type, Object t);
public static Object permissionError(String operation,
String type, Object t);
public static Object systemError(String type);
public static Object resourceError(String type);
public static Object licenseError(String type);
public static Object evaluationError(String type);

public static void checkInstantiated(Object t)
throws InterpreterMessage;
public static void checkCallable(Object t)
throws InterpreterMessage;

public static String castString(Object t)
throws InterpreterMessage;
public static TermAtomic castStringWrapped(Object t)
throws InterpreterMessage;
 public static Number castNumber(Object t)
throws InterpreterMessage;
public static Number castInteger(Object t)
throws InterpreterMessage;
public static Number castDecimal(Object t)
throws InterpreterMessage;
public static Object castRef(Object t)
throws InterpreterMessage;

public static InterpreterMessage mapIOException(IOException exception);
}

Comments