Java 类weka.core.converters.URLSourcedLoader 实例源码

项目:repo.kmeanspp.silhouette_score    文件:PreprocessPanel.java   
/**
  * Loads instances from a URL.
  *
  * @param u the URL to load from.
  */
 public void setInstancesFromURL(final URL u) {

   if (m_IOThread == null) {
     m_IOThread = new Thread() {
@Override
public void run() {

  try {
    m_Log.statusMessage("Reading from URL...");
    AbstractFileLoader loader = ConverterUtils.getURLLoaderForFile(u.toString());
    if (loader == null)
      throw new Exception("No suitable URLSourcedLoader found for URL!\n" + u);
    ((URLSourcedLoader) loader).setURL(u.toString());
    setInstances(loader.getDataSet());
  } catch (Exception ex) {
    ex.printStackTrace();
    m_Log.statusMessage("Problem reading " + u);
    JOptionPane.showMessageDialog(PreprocessPanel.this,
                  "Couldn't read from URL:\n"
                  + u + "\n"
                  + ex.getMessage(),
                  "Load Instances",
                  JOptionPane.ERROR_MESSAGE);
  }

  m_IOThread = null;
}
     };
     m_IOThread.setPriority(Thread.MIN_PRIORITY); // UI has most priority
     m_IOThread.start();
   } else {
     JOptionPane.showMessageDialog(this,
                "Can't load at this time,\n"
                + "currently busy with other IO",
                "Load Instances",
                JOptionPane.WARNING_MESSAGE);
   }
 }
项目:repo.kmeanspp.silhouette_score    文件:SetInstancesPanel.java   
/**
 * Loads instances from a URL.
 * 
 * @param u the URL to load from.
 */
protected void setInstancesFromURL(URL u) {
  boolean incremental = m_readIncrementally;

  try {
    m_Loader = ConverterUtils.getURLLoaderForFile(u.toString());
    if (m_Loader == null)
      throw new Exception("No suitable URLSourcedLoader found for URL!\n" + u);

    // not an incremental loader?
    if (!(m_Loader instanceof IncrementalConverter))
      incremental = false;

    // load
    ((URLSourcedLoader) m_Loader).setURL(u.toString());
    if (incremental) {
      m_Summary.setShowZeroInstancesAsUnknown(m_showZeroInstancesAsUnknown);
      setInstances(m_Loader.getStructure());
    } else {
      m_Summary.setShowZeroInstancesAsUnknown(false);
      setInstances(m_Loader.getDataSet());
    }
  } catch (Exception ex) {
    JOptionPane.showMessageDialog(this, "Couldn't read from URL:\n" + u,
        "Load Instances", JOptionPane.ERROR_MESSAGE);
  }
}
项目:autoweka    文件:PreprocessPanel.java   
/**
  * Loads instances from a URL.
  *
  * @param u the URL to load from.
  */
 public void setInstancesFromURL(final URL u) {

   if (m_IOThread == null) {
     m_IOThread = new Thread() {
public void run() {

  try {
    m_Log.statusMessage("Reading from URL...");
    AbstractFileLoader loader = ConverterUtils.getURLLoaderForFile(u.toString());
    if (loader == null)
      throw new Exception("No suitable URLSourcedLoader found for URL!\n" + u);
    ((URLSourcedLoader) loader).setURL(u.toString());
    setInstances(loader.getDataSet());
  } catch (Exception ex) {
    ex.printStackTrace();
    m_Log.statusMessage("Problem reading " + u);
    JOptionPane.showMessageDialog(PreprocessPanel.this,
                  "Couldn't read from URL:\n"
                  + u + "\n"
                  + ex.getMessage(),
                  "Load Instances",
                  JOptionPane.ERROR_MESSAGE);
  }

  m_IOThread = null;
}
     };
     m_IOThread.setPriority(Thread.MIN_PRIORITY); // UI has most priority
     m_IOThread.start();
   } else {
     JOptionPane.showMessageDialog(this,
                "Can't load at this time,\n"
                + "currently busy with other IO",
                "Load Instances",
                JOptionPane.WARNING_MESSAGE);
   }
 }
项目:autoweka    文件:SetInstancesPanel.java   
/**
  * Loads instances from a URL.
  *
  * @param u the URL to load from.
  */
 protected void setInstancesFromURL(URL u) {
   boolean incremental = m_readIncrementally;

   try {
     m_Loader = ConverterUtils.getURLLoaderForFile(u.toString());
     if (m_Loader == null)
throw new Exception("No suitable URLSourcedLoader found for URL!\n" + u);

     // not an incremental loader?
     if (!(m_Loader instanceof IncrementalConverter))
incremental = false;

     // load
     ((URLSourcedLoader) m_Loader).setURL(u.toString());
     if (incremental) {
       m_Summary.setShowZeroInstancesAsUnknown(m_showZeroInstancesAsUnknown);
setInstances(m_Loader.getStructure());
     } else {
       m_Summary.setShowZeroInstancesAsUnknown(false);
setInstances(m_Loader.getDataSet());
     }
   } catch (Exception ex) {
     JOptionPane.showMessageDialog(this,
                "Couldn't read from URL:\n"
                + u,
                "Load Instances",
                JOptionPane.ERROR_MESSAGE);
   }
 }
项目:umple    文件:PreprocessPanel.java   
/**
  * Loads instances from a URL.
  *
  * @param u the URL to load from.
  */
 public void setInstancesFromURL(final URL u) {

   if (m_IOThread == null) {
     m_IOThread = new Thread() {
@Override
public void run() {

  try {
    m_Log.statusMessage("Reading from URL...");
    AbstractFileLoader loader = ConverterUtils.getURLLoaderForFile(u.toString());
    if (loader == null)
      throw new Exception("No suitable URLSourcedLoader found for URL!\n" + u);
    ((URLSourcedLoader) loader).setURL(u.toString());
    setInstances(loader.getDataSet());
  } catch (Exception ex) {
    ex.printStackTrace();
    m_Log.statusMessage("Problem reading " + u);
    JOptionPane.showMessageDialog(PreprocessPanel.this,
                  "Couldn't read from URL:\n"
                  + u + "\n"
                  + ex.getMessage(),
                  "Load Instances",
                  JOptionPane.ERROR_MESSAGE);
  }

  m_IOThread = null;
}
     };
     m_IOThread.setPriority(Thread.MIN_PRIORITY); // UI has most priority
     m_IOThread.start();
   } else {
     JOptionPane.showMessageDialog(this,
                "Can't load at this time,\n"
                + "currently busy with other IO",
                "Load Instances",
                JOptionPane.WARNING_MESSAGE);
   }
 }
项目:umple    文件:SetInstancesPanel.java   
/**
 * Loads instances from a URL.
 * 
 * @param u the URL to load from.
 */
protected void setInstancesFromURL(URL u) {
  boolean incremental = m_readIncrementally;

  try {
    m_Loader = ConverterUtils.getURLLoaderForFile(u.toString());
    if (m_Loader == null)
      throw new Exception("No suitable URLSourcedLoader found for URL!\n" + u);

    // not an incremental loader?
    if (!(m_Loader instanceof IncrementalConverter))
      incremental = false;

    // load
    ((URLSourcedLoader) m_Loader).setURL(u.toString());
    if (incremental) {
      m_Summary.setShowZeroInstancesAsUnknown(m_showZeroInstancesAsUnknown);
      setInstances(m_Loader.getStructure());
    } else {
      m_Summary.setShowZeroInstancesAsUnknown(false);
      setInstances(m_Loader.getDataSet());
    }
  } catch (Exception ex) {
    JOptionPane.showMessageDialog(this, "Couldn't read from URL:\n" + u,
        "Load Instances", JOptionPane.ERROR_MESSAGE);
  }
}
项目:jbossBA    文件:PreprocessPanel.java   
/**
  * Loads instances from a URL.
  *
  * @param u the URL to load from.
  */
 public void setInstancesFromURL(final URL u) {

   if (m_IOThread == null) {
     m_IOThread = new Thread() {
public void run() {

  try {
    m_Log.statusMessage(Messages.getInstance().getString("PreprocessPanel_SetInstancesFromURL_Run_Log_StatusMessage_Text_First"));
    AbstractFileLoader loader = ConverterUtils.getURLLoaderForFile(u.toString());
    if (loader == null)
      throw new Exception(Messages.getInstance().getString("PreprocessPanel_SetInstancesFromURL_Run_Exception_Text_First") + u);
    ((URLSourcedLoader) loader).setURL(u.toString());
    setInstances(loader.getDataSet());
  } catch (Exception ex) {
    ex.printStackTrace();
    m_Log.statusMessage(Messages.getInstance().getString("PreprocessPanel_SetInstancesFromURL_Run_Log_StatusMessage_Text_Second") + u);
    JOptionPane.showMessageDialog(PreprocessPanel.this,
            Messages.getInstance().getString("PreprocessPanel_SetInstancesFromDB_Run_JOptionPaneShowMessageDialog_Text_Fifth")
                  + u + Messages.getInstance().getString("PreprocessPanel_SetInstancesFromDB_Run_JOptionPaneShowMessageDialog_Text_Sixth")
                  + ex.getMessage(),
                  Messages.getInstance().getString("PreprocessPanel_SetInstancesFromDB_Run_JOptionPaneShowMessageDialog_Text_Seventh"),
                  JOptionPane.ERROR_MESSAGE);
  }

  m_IOThread = null;
}
     };
     m_IOThread.setPriority(Thread.MIN_PRIORITY); // UI has most priority
     m_IOThread.start();
   } else {
     JOptionPane.showMessageDialog(this,
          Messages.getInstance().getString("PreprocessPanel_SetInstancesFromDB_Run_JOptionPaneShowMessageDialog_Text_Eighth"),
                Messages.getInstance().getString("PreprocessPanel_SetInstancesFromDB_Run_JOptionPaneShowMessageDialog_Text_Nineth"),
                JOptionPane.WARNING_MESSAGE);
   }
 }
项目:jbossBA    文件:SetInstancesPanel.java   
/**
 * Loads instances from a URL.
 * 
 * @param u the URL to load from.
 */
protected void setInstancesFromURL(URL u) {
  boolean incremental = m_readIncrementally;

  try {
    m_Loader = ConverterUtils.getURLLoaderForFile(u.toString());
    if (m_Loader == null)
      throw new Exception(Messages.getInstance().getString(
          "SetInstancesPanel_SetInstancesFromURL_Exception_Text_First")
          + u);

    // not an incremental loader?
    if (!(m_Loader instanceof IncrementalConverter))
      incremental = false;

    // load
    ((URLSourcedLoader) m_Loader).setURL(u.toString());
    if (incremental) {
      m_Summary.setShowZeroInstancesAsUnknown(m_showZeroInstancesAsUnknown);
      setInstances(m_Loader.getStructure());
    } else {
      m_Summary.setShowZeroInstancesAsUnknown(false);
      setInstances(m_Loader.getDataSet());
    }
  } catch (Exception ex) {
    JOptionPane
        .showMessageDialog(
            this,
            Messages
                .getInstance()
                .getString(
                    "SetInstancesPanel_SetInstancesFromURL_Exception_JOptionPaneShowMessageDialog_Text_First")
                + u,
            Messages
                .getInstance()
                .getString(
                    "SetInstancesPanel_SetInstancesFromURL_Exception_JOptionPaneShowMessageDialog_Text_Second"),
            JOptionPane.ERROR_MESSAGE);
  }
}