Package org.encog.ml.ea.exception

Examples of org.encog.ml.ea.exception.EARuntimeError


      this.floatValue = 0;
      this.stringValue = null;
      this.enumType = other.enumType;
      break;
    default:
      throw new EARuntimeError("Unsupported type.");

    }
  }
View Full Code Here


   *         possible.
   */
  public boolean toBooleanValue() {
    switch (this.expressionType) {
    case intType:
      throw new EARuntimeError("Type Mismatch: can't convert "
          + this.intValue + " to boolean.");
    case floatingType:
      throw new EARuntimeError("Type Mismatch: can't convert "
          + this.floatValue + " to boolean.");
    case booleanType:
      return this.boolValue;
    case stringType:
      throw new EARuntimeError("Type Mismatch: can't convert "
          + this.stringValue + " to boolean.");
    case enumType:
      throw new EARuntimeError(
          "Type Mismatch: can't convert enum to boolean.");
    default:
      throw new EARuntimeError("Unknown type: " + this.expressionType);
    }
  }
View Full Code Here

    case intType:
      return this.intValue;
    case floatingType:
      return this.floatValue;
    case booleanType:
      throw new EARuntimeError(
          "Type Mismatch: can't convert float to boolean.");
    case stringType:
      try {
        return Double.parseDouble(this.stringValue);
      } catch (final NumberFormatException ex) {
        throw new EARuntimeError("Type Mismatch: can't convert "
            + this.stringValue + " to floating point.");
      }
    case enumType:
      throw new EARuntimeError(
          "Type Mismatch: can't convert enum to float.");
    default:
      throw new EARuntimeError("Unknown type: " + this.expressionType);
    }
  }
View Full Code Here

    case intType:
      return this.intValue;
    case floatingType:
      return (int) this.floatValue;
    case booleanType:
      throw new EARuntimeError(
          "Type Mismatch: can't convert int to boolean.");
    case stringType:
      try {
        return Long.parseLong(this.stringValue);
      } catch (final NumberFormatException ex) {
        throw new EARuntimeError("Type Mismatch: can't convert "
            + this.stringValue + " to int.");
      }
    case enumType:
      return this.intValue;
    default:
      throw new EARuntimeError("Unknown type: " + this.expressionType);
    }
  }
View Full Code Here

    case stringType:
      return this.stringValue;
    case enumType:
      return "[" + this.enumType + ":" + this.intValue + "]";
    default:
      throw new EARuntimeError("Unknown type: " + this.expressionType);
    }
  }
View Full Code Here

      }
      break;
    }

    if (!success) {
      throw new EARuntimeError("EncogProgram produced "
          + v.getExpressionType().toString() + " but "
          + resultMapping.getVariableType().toString()
          + " was expected.");
    }
View Full Code Here

   * @param mapping
   *            The variable mapping.
   */
  public void defineVariable(final VariableMapping mapping) {
    if (this.varMap.containsKey(mapping.getName())) {
      throw new EARuntimeError(
          "Variable "
              + mapping.getName()
              + " already defined, simply set its value, do not redefine.");
    } else {
      this.varMap.put(mapping.getName(), this.variables.size());
View Full Code Here

   *            The variable name.
   * @return The index of the specified variable.
   */
  public int getVariableIndex(final String varName) {
    if (!variableExists(varName)) {
      throw new EARuntimeError("Undefined variable: " + varName);
    }

    return this.varMap.get(varName);
  }
View Full Code Here

      if (entry.getValue() == idx) {
        return entry.getKey();
      }
    }

    throw new EARuntimeError("No variable defined for index " + idx);
  }
View Full Code Here

   * @param mapping
   *            The variable mapping.
   */
  public void defineVariable(final VariableMapping mapping) {
    if (this.map.containsKey(mapping.getName())) {
      throw new EARuntimeError("Variable " + mapping.getName()
          + " already defined.");
    }
    this.map.put(mapping.getName(), mapping);
    this.definedVariables.add(mapping);
  }
View Full Code Here

TOP

Related Classes of org.encog.ml.ea.exception.EARuntimeError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.