weka.gui.scripting

## Class GroovyScript

- java.lang.Object
- - weka.gui.scripting.Script
  - - weka.gui.scripting.GroovyScript

- All Implemented Interfaces:
    java.io.Serializable, OptionHandler

      public class GroovyScript
      extends Script

  Represents a Groovy script.
  Version:
    $Revision: 8034 $
  Author:
    fracpete (fracpete at waikato dot ac dot nz)
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `GroovyScript.GroovyThread` Executes a Groovy script in a thread.

    - ### Nested classes/interfaces inherited from class weka.gui.scripting.Script

      `Script.ScriptThread`

  - ### Field Summary

    - ### Fields inherited from class weka.gui.scripting.Script

      `BACKUP_EXTENSION`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GroovyScript()` Initializes the script.
    `GroovyScript(javax.swing.text.Document doc)` Initializes the script.
    `GroovyScript(javax.swing.text.Document doc, java.io.File file)` Initializes the script.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getDefaultExtension()` Returns the default extension.
    `ExtensionFileFilter[]` | `getFilters()` Returns the extension filters for this type of script.
    `static void` | `main(java.lang.String[] args)` Runs the script from commandline.
    `Script.ScriptThread` | `newThread(java.lang.String[] args)` Returns a new thread to execute.

    - ### Methods inherited from class weka.gui.scripting.Script

      `addScriptFinishedListener, empty, getContent, getFilename, getNewLine, getOptions, isModified, isRunning, listOptions, open, removeScriptFinishedListener, run, runScript, save, saveAs, setContent, setOptions, start, stop, toString`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### GroovyScript

          public GroovyScript()

      Initializes the script.

    - #### GroovyScript

          public GroovyScript(javax.swing.text.Document doc)

      Initializes the script.
      Parameters:
        `doc` - the document to use as basis

    - #### GroovyScript

          public GroovyScript(javax.swing.text.Document doc,
                              java.io.File file)

      Initializes the script. Automatically loads the specified file, if not null.
      Parameters:
        `doc` - the document to use as basis
        `file` - the file to load (if not null)

  - ### Method Detail

    - #### getFilters

          public ExtensionFileFilter[] getFilters()

      Returns the extension filters for this type of script.
      Specified by:
        `getFilters` in class `Script`
      Returns:
        the filters

    - #### getDefaultExtension

          public java.lang.String getDefaultExtension()

      Returns the default extension. Gets automatically added to files if their name doesn't end with this.
      Specified by:
        `getDefaultExtension` in class `Script`
      Returns:
        the default extension (incl. the dot)
      See Also:
        `Script.saveAs(File)`

    - #### newThread

          public Script.ScriptThread newThread(java.lang.String[] args)

      Returns a new thread to execute.
      Specified by:
        `newThread` in class `Script`
      Parameters:
        `args` - optional commandline arguments
      Returns:
        the new thread object

    - #### main

          public static void main(java.lang.String[] args)
                           throws java.lang.Exception

      Runs the script from commandline. Use "-h" to list all options.
      Parameters:
        `args` - the commandline arguments
      Throws:
        `java.lang.Exception` - if execution fails