• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java AbstractFileSaver类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中weka.core.converters.AbstractFileSaver的典型用法代码示例。如果您正苦于以下问题:Java AbstractFileSaver类的具体用法?Java AbstractFileSaver怎么用?Java AbstractFileSaver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

AbstractFileSaver类属于weka.core.converters包,在下文中一共展示了AbstractFileSaver类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: save

点赞 3

import weka.core.converters.AbstractFileSaver; //导入依赖的package包/类
/**
 * Saves the data to the specified file.
 * 
 * @param file the file to save the data to
 * @param saver the saver to use, determines it automatically if null
 */
public void save(File file, AbstractFileSaver saver) {
	if (saver == null)
		saver = ConverterUtils.getSaverForFile(file);
	try {
		saver.setInstances(m_Data);
		if ((saver.retrieveFile() == null) || !saver.retrieveFile().equals(file))
			saver.setFile(file);
		saver.writeBatch();
		m_CurrentFile = file;
	}
	catch (Exception e) {
		System.err.println("Failed to save data to '" + file + "':");
		e.printStackTrace();
		JOptionPane.showMessageDialog(
				this, 
				"Failed to save dataset to '" + file + "':\n" + e, 
				"Error saving",
				JOptionPane.ERROR_MESSAGE);
	}

	updateMenu();
}
 

开发者ID:IsaacHaze,
项目名称:meka,
代码行数:29,
代码来源:Explorer.java

示例2: closingOK

点赞 2

import weka.core.converters.AbstractFileSaver; //导入依赖的package包/类
@Override
public void closingOK() {
  m_saver.getConfig().setHDFSHost(m_hdfsHostText.getText());
  m_saver.getConfig().setHDFSPort(m_hdfsPortText.getText());
  m_saver.setHDFSPath(m_hdfsPathText.getText());
  m_saver.setDFSReplicationFactor(m_dfsReplicationText.getText());
  m_saver.setSaver((AbstractFileSaver) m_baseSaverEditor.getValue());

  m_saver.setFilePrefix(m_filePrefixText.getText());
}
 

开发者ID:mydzigear,
项目名称:repo.kmeanspp.silhouette_score,
代码行数:11,
代码来源:HDFSSaverCustomizer.java

示例3: saveInstancesToFile

点赞 2

import weka.core.converters.AbstractFileSaver; //导入依赖的package包/类
/**
  * saves the data with the specified saver
  * 
  * @param saver	the saver to use for storing the data
  * @param inst	the data to save
  */
 public void saveInstancesToFile(final AbstractFileSaver saver, final Instances inst) {
   if (m_IOThread == null) {
     m_IOThread = new Thread() {
  @Override
  public void run() {
    try {
      m_Log.statusMessage("Saving to file...");

      saver.setInstances(inst);
      saver.writeBatch();
      
      m_Log.statusMessage("OK");
    }
    catch (Exception ex) {
      ex.printStackTrace();
      m_Log.logMessage(ex.getMessage());
    }
    m_IOThread = null;
  }
};
     m_IOThread.setPriority(Thread.MIN_PRIORITY); // UI has most priority
     m_IOThread.start();
   }
   else {
     JOptionPane.showMessageDialog(this,
			    "Can't save at this time,\n"
			    + "currently busy with other IO",
			    "Saving instances",
			    JOptionPane.WARNING_MESSAGE);
   } 
 }
 

开发者ID:mydzigear,
项目名称:repo.kmeanspp.silhouette_score,
代码行数:38,
代码来源:PreprocessPanel.java

示例4: getLoader

点赞 2

import weka.core.converters.AbstractFileSaver; //导入依赖的package包/类
/**
 * returns the loader that was chosen by the user, can be null in case the
 * user aborted the dialog or the save dialog was shown.
 * 
 * @return the chosen loader, if any
 */
public AbstractFileLoader getLoader() {
  configureCurrentConverter(LOADER_DIALOG);

  if (m_CurrentConverter instanceof AbstractFileSaver) {
    return null;
  } else {
    return (AbstractFileLoader) m_CurrentConverter;
  }
}
 

开发者ID:mydzigear,
项目名称:repo.kmeanspp.silhouette_score,
代码行数:16,
代码来源:ConverterFileChooser.java

示例5: getSaver

点赞 2

import weka.core.converters.AbstractFileSaver; //导入依赖的package包/类
/**
 * returns the saver that was chosen by the user, can be null in case the user
 * aborted the dialog or the open dialog was shown.
 * 
 * @return the chosen saver, if any
 */
public AbstractFileSaver getSaver() {
  configureCurrentConverter(SAVER_DIALOG);

  if (m_CurrentConverter instanceof AbstractFileLoader) {
    return null;
  } else {
    return (AbstractFileSaver) m_CurrentConverter;
  }
}
 

开发者ID:mydzigear,
项目名称:repo.kmeanspp.silhouette_score,
代码行数:16,
代码来源:ConverterFileChooser.java

示例6: main

点赞 2

import weka.core.converters.AbstractFileSaver; //导入依赖的package包/类
/**
 * For testing the file chooser.
 * 
 * @param args the commandline options - ignored
 * @throws Exception if something goes wrong with loading/saving
 */
public static void main(String[] args) throws Exception {
  ConverterFileChooser fc;
  int retVal;
  AbstractFileLoader loader;
  AbstractFileSaver saver;
  Instances data;

  fc = new ConverterFileChooser();
  retVal = fc.showOpenDialog(null);

  // load file
  if (retVal == ConverterFileChooser.APPROVE_OPTION) {
    loader = fc.getLoader();
    data = loader.getDataSet();
    retVal = fc.showSaveDialog(null);

    // save file
    if (retVal == ConverterFileChooser.APPROVE_OPTION) {
      saver = fc.getSaver();
      saver.setInstances(data);
      saver.writeBatch();
    } else {
      System.out.println("Saving aborted!");
    }
  } else {
    System.out.println("Loading aborted!");
  }
}
 

开发者ID:mydzigear,
项目名称:repo.kmeanspp.silhouette_score,
代码行数:35,
代码来源:ConverterFileChooser.java

示例7: saveInstancesToFile

点赞 2

import weka.core.converters.AbstractFileSaver; //导入依赖的package包/类
/**
  * saves the data with the specified saver
  * 
  * @param saver	the saver to use for storing the data
  * @param inst	the data to save
  */
 public void saveInstancesToFile(final AbstractFileSaver saver, final Instances inst) {
   if (m_IOThread == null) {
     m_IOThread = new Thread() {
  public void run() {
    try {
      m_Log.statusMessage("Saving to file...");

      saver.setInstances(inst);
      saver.writeBatch();
      
      m_Log.statusMessage("OK");
    }
    catch (Exception ex) {
      ex.printStackTrace();
      m_Log.logMessage(ex.getMessage());
    }
    m_IOThread = null;
  }
};
     m_IOThread.setPriority(Thread.MIN_PRIORITY); // UI has most priority
     m_IOThread.start();
   }
   else {
     JOptionPane.showMessageDialog(this,
			    "Can't save at this time,\n"
			    + "currently busy with other IO",
			    "Saving instances",
			    JOptionPane.WARNING_MESSAGE);
   } 
 }
 

开发者ID:dsibournemouth,
项目名称:autoweka,
代码行数:37,
代码来源:PreprocessPanel.java

示例8: getLoader

点赞 2

import weka.core.converters.AbstractFileSaver; //导入依赖的package包/类
/**
 * returns the loader that was chosen by the user, can be null in case the
 * user aborted the dialog or the save dialog was shown.
 * 
 * @return		the chosen loader, if any
 */
public AbstractFileLoader getLoader() {
  configureCurrentConverter(LOADER_DIALOG);
  
  if (m_CurrentConverter instanceof AbstractFileSaver)
    return null;
  else
    return (AbstractFileLoader) m_CurrentConverter;
}
 

开发者ID:dsibournemouth,
项目名称:autoweka,
代码行数:15,
代码来源:ConverterFileChooser.java

示例9: getSaver

点赞 2

import weka.core.converters.AbstractFileSaver; //导入依赖的package包/类
/**
 * returns the saver that was chosen by the user, can be null in case the
 * user aborted the dialog or the open dialog was shown.
 * 
 * @return		the chosen saver, if any
 */
public AbstractFileSaver getSaver() {
  configureCurrentConverter(SAVER_DIALOG);
  
  if (m_CurrentConverter instanceof AbstractFileLoader)
    return null;
  else
    return (AbstractFileSaver) m_CurrentConverter;
}
 

开发者ID:dsibournemouth,
项目名称:autoweka,
代码行数:15,
代码来源:ConverterFileChooser.java

示例10: main

点赞 2

import weka.core.converters.AbstractFileSaver; //导入依赖的package包/类
/**
  * For testing the file chooser.
  * 
  * @param args	the commandline options - ignored
  * @throws Exception	if something goes wrong with loading/saving
  */
 public static void main(String[] args) throws Exception {
   ConverterFileChooser	fc;
   int				retVal;
   AbstractFileLoader		loader;
   AbstractFileSaver		saver;
   Instances			data;
   
   fc     = new ConverterFileChooser();
   retVal = fc.showOpenDialog(null);
   
   // load file
   if (retVal == ConverterFileChooser.APPROVE_OPTION) {
     loader = fc.getLoader();
     data   = loader.getDataSet();
     retVal = fc.showSaveDialog(null);

     // save file
     if (retVal == ConverterFileChooser.APPROVE_OPTION) {
saver = fc.getSaver();
saver.setInstances(data);
saver.writeBatch();
     }
     else {
System.out.println("Saving aborted!");
     }
   }
   else {
     System.out.println("Loading aborted!");
   }
 }
 

开发者ID:dsibournemouth,
项目名称:autoweka,
代码行数:37,
代码来源:ConverterFileChooser.java

示例11: saveInstancesToFile

点赞 2

import weka.core.converters.AbstractFileSaver; //导入依赖的package包/类
/**
  * saves the data with the specified saver
  * 
  * @param saver	the saver to use for storing the data
  * @param inst	the data to save
  */
 public void saveInstancesToFile(final AbstractFileSaver saver, final Instances inst) {
   if (m_IOThread == null) {
     m_IOThread = new Thread() {
  public void run() {
    try {
      m_Log.statusMessage(Messages.getInstance().getString("PreprocessPanel_SaveInstancesToFile_Run_Log_StatusMessage_Text_First"));

      saver.setInstances(inst);
      saver.writeBatch();
      
      m_Log.statusMessage(Messages.getInstance().getString("PreprocessPanel_SaveInstancesToFile_Run_Log_StatusMessage_Text_Second"));
    }
    catch (Exception ex) {
      ex.printStackTrace();
      m_Log.logMessage(ex.getMessage());
    }
    m_IOThread = null;
  }
};
     m_IOThread.setPriority(Thread.MIN_PRIORITY); // UI has most priority
     m_IOThread.start();
   }
   else {
     JOptionPane.showMessageDialog(this,
   		  Messages.getInstance().getString("PreprocessPanel_SaveInstancesToFile_Run_JOptionPaneShowMessageDialog_Text_First"),
			    Messages.getInstance().getString("PreprocessPanel_SaveInstancesToFile_Run_JOptionPaneShowMessageDialog_Text_Second"),
			    JOptionPane.WARNING_MESSAGE);
   } 
 }
 

开发者ID:williamClanton,
项目名称:jbossBA,
代码行数:36,
代码来源:PreprocessPanel.java

示例12: getLoader

点赞 2

import weka.core.converters.AbstractFileSaver; //导入依赖的package包/类
/**
 * returns the loader that was chosen by the user, can be null in case the
 * user aborted the dialog or the save dialog was shown
 * 
 * @return		the chosen loader, if any
 */
public AbstractFileLoader getLoader() {
  configureCurrentConverter(LOADER_DIALOG);
  
  if (m_CurrentConverter instanceof AbstractFileSaver)
    return null;
  else
    return (AbstractFileLoader) m_CurrentConverter;
}
 

开发者ID:williamClanton,
项目名称:jbossBA,
代码行数:15,
代码来源:ConverterFileChooser.java

示例13: getSaver

点赞 2

import weka.core.converters.AbstractFileSaver; //导入依赖的package包/类
/**
 * returns the saver that was chosen by the user, can be null in case the
 * user aborted the dialog or the open dialog was shown
 * 
 * @return		the chosen saver, if any
 */
public AbstractFileSaver getSaver() {
  configureCurrentConverter(SAVER_DIALOG);
  
  if (m_CurrentConverter instanceof AbstractFileLoader)
    return null;
  else
    return (AbstractFileSaver) m_CurrentConverter;
}
 

开发者ID:williamClanton,
项目名称:jbossBA,
代码行数:15,
代码来源:ConverterFileChooser.java

示例14: main

点赞 2

import weka.core.converters.AbstractFileSaver; //导入依赖的package包/类
/**
  * For testing the file chooser
  * 
  * @param args	the commandline options - ignored
  * @throws Exception	if something goes wrong with loading/saving
  */
 public static void main(String[] args) throws Exception {
   ConverterFileChooser	fc;
   int				retVal;
   AbstractFileLoader		loader;
   AbstractFileSaver		saver;
   Instances			data;
   
   fc     = new ConverterFileChooser();
   retVal = fc.showOpenDialog(null);
   
   // load file
   if (retVal == ConverterFileChooser.APPROVE_OPTION) {
     loader = fc.getLoader();
     data   = loader.getDataSet();
     retVal = fc.showSaveDialog(null);

     // save file
     if (retVal == ConverterFileChooser.APPROVE_OPTION) {
saver = fc.getSaver();
saver.setInstances(data);
saver.writeBatch();
     }
     else {
System.out.println(Thread.currentThread().getStackTrace()[1].getClassName() +Messages.getInstance().getString("ConverterFileChooser_Main_Text_First"));
     }
   }
   else {
     System.out.println(Thread.currentThread().getStackTrace()[1].getClassName() +Messages.getInstance().getString("ConverterFileChooser_Main_Text_Second"));
   }
 }
 

开发者ID:williamClanton,
项目名称:jbossBA,
代码行数:37,
代码来源:ConverterFileChooser.java

示例15: initGUI

点赞 2

import weka.core.converters.AbstractFileSaver; //导入依赖的package包/类
/**
 * initializes the GUI.
 * 
 * @param dialogType the type of dialog to setup the GUI for
 */
protected void initGUI(int dialogType) {
  Vector<ExtensionFileFilter> list;
  int i;
  boolean acceptAll;

  // backup current state
  acceptAll = isAcceptAllFileFilterUsed();

  // setup filters
  resetChoosableFileFilters();
  setAcceptAllFileFilterUsed(acceptAll);
  if (dialogType == LOADER_DIALOG) {
    list = filterNonCoreLoaderFileFilters(m_LoaderFileFilters);
  } else {
    list = filterSaverFileFilters(filterNonCoreSaverFileFilters(m_SaverFileFilters));
  }
  for (i = 0; i < list.size(); i++) {
    addChoosableFileFilter(list.get(i));
  }
  if (list.size() > 0) {
    if ((m_LastFilter == null) || (!list.contains(m_LastFilter))) {
      setFileFilter(list.get(0));
    } else {
      setFileFilter(m_LastFilter);
    }
  }

  // listener
  if (m_Listener != null) {
    removePropertyChangeListener(m_Listener);
  }
  m_Listener = new PropertyChangeListener() {
    @Override
    public void propertyChange(PropertyChangeEvent evt) {
      // filter changed
      if (evt.getPropertyName().equals(FILE_FILTER_CHANGED_PROPERTY)) {
        updateCurrentConverter();
      }
    }
  };
  addPropertyChangeListener(m_Listener);

  // initial setup
  if (dialogType == LOADER_DIALOG) {
    m_Editor.setClassType(AbstractFileLoader.class);
    m_Editor.setValue(new weka.core.converters.ArffLoader());
  } else {
    m_Editor.setClassType(AbstractFileSaver.class);
    m_Editor.setValue(new weka.core.converters.ArffSaver());
  }

  updateCurrentConverter();
}
 

开发者ID:mydzigear,
项目名称:repo.kmeanspp.silhouette_score,
代码行数:59,
代码来源:ConverterFileChooser.java

示例16: initGUI

点赞 2

import weka.core.converters.AbstractFileSaver; //导入依赖的package包/类
/**
  * initializes the GUI.
  * 
  * @param dialogType		the type of dialog to setup the GUI for
  */
 protected void initGUI(int dialogType) {
   Vector<ExtensionFileFilter>	list;
   int				i;
   boolean 			acceptAll;

   // backup current state
   acceptAll = isAcceptAllFileFilterUsed();

   // setup filters
   resetChoosableFileFilters();
   setAcceptAllFileFilterUsed(acceptAll);
   if (dialogType == LOADER_DIALOG)
     list = filterNonCoreLoaderFileFilters(m_LoaderFileFilters);
   else
     list = filterSaverFileFilters(filterNonCoreSaverFileFilters(m_SaverFileFilters));
   for (i = 0; i < list.size(); i++) {
     addChoosableFileFilter(list.get(i));
   }
   if (list.size() > 0) {
     if ( (m_LastFilter == null) || (!list.contains(m_LastFilter)) )
setFileFilter(list.get(0));
     else
setFileFilter(m_LastFilter);
   }

   // listener
   if (m_Listener != null)
     removePropertyChangeListener(m_Listener);
   m_Listener = new PropertyChangeListener() {
     public void propertyChange(PropertyChangeEvent evt) {
// filter changed
if (evt.getPropertyName().equals(FILE_FILTER_CHANGED_PROPERTY)) {
  updateCurrentConverter();
}
     }
   };
   addPropertyChangeListener(m_Listener);
   
   // initial setup
   if (dialogType == LOADER_DIALOG) {
     m_Editor.setClassType(AbstractFileLoader.class);
     m_Editor.setValue(new weka.core.converters.ArffLoader());
   }
   else {
     m_Editor.setClassType(AbstractFileSaver.class);
     m_Editor.setValue(new weka.core.converters.ArffSaver());
   }
   
   updateCurrentConverter();
 }
 

开发者ID:dsibournemouth,
项目名称:autoweka,
代码行数:56,
代码来源:ConverterFileChooser.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)