Package weka.datagenerators

Examples of weka.datagenerators.DataGenerator


   *
   * @return    TRUE if successful
   * @see #getInstances()
   */
  public boolean execute() {
    DataGenerator     generator;
    boolean           result;
    String            relName;
    String            cname;
    String            cmd;
   
    result    = true;
    generator = (DataGenerator) m_GeneratorEditor.getValue();
    relName   = generator.getRelationName();

    cname = generator.getClass().getName().replaceAll(".*\\.", "");
    cmd = generator.getClass().getName();
    if (generator instanceof OptionHandler)
      cmd += " " + Utils.joinOptions(((OptionHandler) generator).getOptions());
   
    try {
      m_Log.logMessage(Messages.getInstance().getString("DataGeneratorPanel_Execute_Log_LogMessage_Text_First") + cname);
      m_Log.logMessage(Messages.getInstance().getString("DataGeneratorPanel_Execute_Log_LogMessage_Text_Second") + cmd);
      m_Output = new StringWriter();
      generator.setOutput(new PrintWriter(m_Output));
      DataGenerator.makeData(generator, generator.getOptions());
      m_Instances = new Instances(new StringReader(getOutput()));
      m_Log.logMessage(Messages.getInstance().getString("DataGeneratorPanel_Execute_Log_LogMessage_Text_Third") + cname);
    }
    catch (Exception e) {
      e.printStackTrace();
      JOptionPane.showMessageDialog(
          this, Messages.getInstance().getString("DataGeneratorPanel_Execute_JOptionPaneShowMessageDialog_Text_First") + e.getMessage(),
          Messages.getInstance().getString("DataGeneratorPanel_Execute_JOptionPaneShowMessageDialog_Text_Second"), JOptionPane.ERROR_MESSAGE);
      m_Instances = null;
      m_Output    = new StringWriter();
      result      = false;
    }

    generator.setRelationName(relName);

    return result;
  }
View Full Code Here


   *
   * @return    TRUE if successful
   * @see #getInstances()
   */
  public boolean execute() {
    DataGenerator     generator;
    boolean           result;
    String            relName;
    String            cname;
    String            cmd;
   
    result    = true;
    generator = (DataGenerator) m_GeneratorEditor.getValue();
    relName   = generator.getRelationName();

    cname = generator.getClass().getName().replaceAll(".*\\.", "");
    cmd = generator.getClass().getName();
    if (generator instanceof OptionHandler)
      cmd += " " + Utils.joinOptions(((OptionHandler) generator).getOptions());
   
    try {
      m_Log.logMessage("Started " + cname);
      m_Log.logMessage("Command: " + cmd);
      m_Output = new StringWriter();
      generator.setOutput(new PrintWriter(m_Output));
      DataGenerator.makeData(generator, generator.getOptions());
      m_Instances = new Instances(new StringReader(getOutput()));
      m_Log.logMessage("Finished " + cname);
    }
    catch (Exception e) {
      e.printStackTrace();
      JOptionPane.showMessageDialog(
          this, "Error generating data:\n" + e.getMessage(),
          "Error", JOptionPane.ERROR_MESSAGE);
      m_Instances = null;
      m_Output    = new StringWriter();
      result      = false;
    }

    generator.setRelationName(relName);

    return result;
  }
View Full Code Here

TOP

Related Classes of weka.datagenerators.DataGenerator

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.