示例#1
0
文件: J48.java 项目: bigbigbug/wekax
  /**
   * Returns tree as an if-then statement.
   *
   * @return the tree as a Java if-then type statement
   * @exception Exception if something goes wrong
   */
  public String toSource(String className) throws Exception {

    StringBuffer[] source = m_root.toSource(className);
    return "class "
        + className
        + " {\n\n"
        + "  public static double classify(Object [] i)\n"
        + "    throws Exception {\n\n"
        + "    double p = Double.NaN;\n"
        + source[0] // Assignment code
        + "    return p;\n"
        + "  }\n"
        + source[1] // Support code
        + "}\n";
  }