⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 value.java

📁 是有关解释器的.用JAVA编写.可以解释一般的JAVA程序.
💻 JAVA
字号:
/** Superclass for all values saveable in an Environment. */
public abstract class Value extends FoundValue {
    boolean isValue() {
        return true;
    }

    /**
     * Checks the type of the value against the given string.
     * 
     * @param typeName
     *            string describing the type to check for
     */
    abstract boolean isOfType(String typeName);

    /**
     * Evaluates the mathematic operation denoted by the method name by
     * calculating "own value" "operation" "given value" and returning the
     * result in a new value.
     * 
     * @throws InterpreterException
     *             if the types for the operation don't match
     */
    Value plus(Value v) throws InterpreterException {
        throw new InterpreterException("This type does not support addition.");
    }

    /**
     * Evaluates the mathematic operation denoted by the method name by
     * calculating "own value" "operation" "given value" and returning the
     * result in a new value.
     * 
     * @throws InterpreterException
     *             if the types for the operation don't match
     */
    Value minus(Value v) throws InterpreterException {
        throw new InterpreterException(
                "This type does not support substraction.");
    }

    /**
     * Evaluates the mathematic operation denoted by the method name by
     * calculating "own value" "operation" "given value" and returning the
     * result in a new value.
     * 
     * @throws InterpreterException
     *             if the types for the operation don't match
     */
    Value multipliedBy(Value v) throws InterpreterException {
        throw new InterpreterException(
                "This type does not support multiplication.");
    }

    /**
     * Evaluates the mathematic operation denoted by the method name by
     * calculating "own value" "operation" "given value" and returning the
     * result in a new value.
     * 
     * @throws InterpreterException
     *             if the types for the operation don't match
     */
    Value dividedBy(Value v) throws InterpreterException {
        throw new InterpreterException("This type does not support division.");
    }

    /**
     * Evaluates the mathematic operation denoted by the method name by
     * calculating "own value" "operation" "given value" and returning the
     * result in a new value.
     * 
     * @throws InterpreterException
     *             if the types for the operation don't match
     */
    Value isLess(Value v) throws InterpreterException {
        throw new InterpreterException(
                "This type does not support less comparison.");
    }

    /**
     * Evaluates the mathematic operation denoted by the method name by
     * calculating "own value" "operation" "given value" and returning the
     * result in a new value.
     * 
     * @throws InterpreterException
     *             if the types for the operation don't match
     */
    Value isGreater(Value v) throws InterpreterException {
        throw new InterpreterException(
                "This type does not support greater comparison.");
    }

    /**
     * Evaluates the mathematic operation denoted by the method name by
     * calculating "own value" "operation" "given value" and returning the
     * result in a new value.
     * 
     * @throws InterpreterException
     *             if the types for the operation don't match
     */
    Value isEqual(Value v) throws InterpreterException {
        throw new InterpreterException("This type does not support equation.");
    }

    /**
     * Evaluates the mathematic operation denoted by the method name by
     * calculating "operation" "own value" and returning the result in a new
     * value.
     * 
     * @throws InterpreterException
     *             if the types for the operation don't match
     */
    Value negate() throws InterpreterException {
        throw new InterpreterException("This type does not support negation.");
    }

    /**
     * Evaluates the mathematic operation denoted by the method name by
     * calculating "own value" "operation" "given value" and returning the
     * result in a new value.
     * 
     * @throws InterpreterException
     *             if the types for the operation don't match
     */
    Value or(Value v) throws InterpreterException {
        throw new InterpreterException(
                "This type does not support disjunction.");
    }

    /**
     * Evaluates the mathematic operation denoted by the method name by
     * calculating "own value" "operation" "given value" and returning the
     * result in a new value.
     * 
     * @throws InterpreterException
     *             if the types for the operation don't match
     */
    Value and(Value v) throws InterpreterException {
        throw new InterpreterException(
                "This type does not support conjunction.");
    }

    /**
     * Assigns the given value to the own value and returns it. No new instance
     * is created.
     * 
     * @throws InterpreterException
     *             if the types for the operation don't match
     */
    Value assign(Value v) throws InterpreterException {
        throw new InterpreterException("This type does not support assignment.");
    }
    
    abstract Value cloneValue();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -