Skip to content

Latest commit

 

History

History
77 lines (55 loc) · 2.36 KB

README.md

File metadata and controls

77 lines (55 loc) · 2.36 KB

command-to-code-weka-package

Adds a menu item to the GUIChooser's main menu for converting command-lines into code snippets (under Extensions).

Available converters

  • Instantiation -- instantiates an object specified by the command-line and sets its options (if a weka.core.OptionHandler).
  • Instantiation (with TryCatch) -- same as Instantiation, but guards the setting of the options with a try-catch block.
  • Java String -- simply escapes the command-line and generates a statement using a String.
  • String Array -- fills a String array with the options from the command.
  • Test class -- generates a little test class that instantiates the command including the necessary imports.

Releases

Click on one of the following links to download the corresponding Weka package:

How to use packages

For more information on how to install the package, see:

https://waikato.github.io/weka-wiki/packages/manager/

Maven

Use the following dependency to include it in your Maven project:

    <dependency>
      <groupId>com.github.fracpete</groupId>
      <artifactId>command-to-code-weka-packae</artifactId>
      <version>2017.10.9</version>
    </dependency>

Code

You can use the following class (derived from javax.swing.JPanel) in your Swing GUI:

weka.gui.CommandToCodePanel

You can use a converter to generate code on the fly:

import weka.core.code.StringArray;
...
String cmd = "...";   // command from somewhere
StringArray conv = new StringArray();
if (conv.handles(cmd)) {
  String code = conv.convert(cmd);
  System.out.println(code);
}