Example usage for weka.core AllJavadoc AllJavadoc

List of usage examples for weka.core AllJavadoc AllJavadoc

Introduction

In this page you can find the example usage for weka.core AllJavadoc AllJavadoc.

Prototype

AllJavadoc

Source Link

Usage

From source file:mulan.core.MulanJavadoc.java

License:Open Source License

/**
 * Updates comments//from   w  w  w . j ava2  s.com
 *
 * @param classname
 * @throws java.lang.Exception
 */
public static void updateJavadoc(String classname) throws Exception {

    AllJavadoc jdoc = new AllJavadoc();
    jdoc.setClassname(classname);
    jdoc.setDir(dir);
    jdoc.setUseStars(false);

    String result = "";

    try {
        result = jdoc.updateJavadoc();
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    //System.out.println(result + "\n");

    File file;
    BufferedWriter writer;

    if (!result.isEmpty()) {
        file = new File(jdoc.getDir() + "/" + jdoc.getClassname().replaceAll("\\.", "/") + ".java");
        if (!file.exists()) {
            System.out.println("File '" + file.getAbsolutePath() + "' doesn't exist!");
            return;
        }

        writer = new BufferedWriter(new FileWriter(file));
        writer.write(result);
        writer.close();

        System.out.println(jdoc.getClassname() + "'s Javadoc successfully updated.");

        return;
    } else {
        System.out.println(jdoc.getClassname() + "'s Javadoc update failed. Skipping file..");
    }

}