net.sf.myra.datamining.io
Class Helper

java.lang.Object
  extended by net.sf.myra.datamining.io.Helper
Direct Known Subclasses:
ArffHelper, C45Helper, CN2Helper

public abstract class Helper
extends java.lang.Object

Base class for dataset file helper.

Version:
$Revision$ $Date:: $
Author:
Fernando Esteban Barril Otero

Constructor Summary
Helper()
           
 
Method Summary
static Helper getHelper(java.io.File file)
          Returns a Helper instance to read the specified file.
static Helper getHelper(java.lang.String filename)
          Returns a Helper instance to read the specified file.
 boolean isCompressed()
          Tests if the output should be compressed.
static Dataset open(java.io.File file)
          Returns a Dataset instance that represents the data of the specified file.
static Dataset open(java.lang.String filename)
          Returns a Dataset instance that represents the data of the specified file.
abstract  Dataset read(java.io.File file)
          Returns a Dataset instance that represents the data of the specified file.
 Dataset read(java.lang.String filename)
          Returns a Dataset instance that represents the data of the specified file.
 void setCompressed(boolean compressed)
          Sets the value of the compressed flag.
abstract  void write(java.io.File directory, Dataset dataset)
          Writes a file representing the specified dataset.
abstract  void write(java.io.Writer writer, Dataset dataset)
          Writes a file representing the specified dataset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Helper

public Helper()
Method Detail

isCompressed

public boolean isCompressed()
Tests if the output should be compressed.


setCompressed

public void setCompressed(boolean compressed)
Sets the value of the compressed flag.

Parameters:
compressed - the value to set.

write

public abstract void write(java.io.File directory,
                           Dataset dataset)
                    throws java.io.IOException
Writes a file representing the specified dataset.

Parameters:
directory - the output directory.
dataset - the dataset to be written.
Throws:
java.io.IOException

write

public abstract void write(java.io.Writer writer,
                           Dataset dataset)
                    throws java.io.IOException
Writes a file representing the specified dataset.

Parameters:
writer - the output writer.
dataset - the dataset to be written.
Throws:
java.io.IOException

read

public Dataset read(java.lang.String filename)
             throws java.io.IOException
Returns a Dataset instance that represents the data of the specified file.

Parameters:
filename - the name of the file to read the data from.
Returns:
a Dataset instance.
Throws:
java.io.IOException - if any file operation fails.

read

public abstract Dataset read(java.io.File file)
                      throws java.io.IOException
Returns a Dataset instance that represents the data of the specified file.

Parameters:
file - the file to read the data from.
Returns:
a Dataset instance.
Throws:
java.io.IOException - if any file operation fails.

getHelper

public static Helper getHelper(java.lang.String filename)
Returns a Helper instance to read the specified file.

Parameters:
file - the file to be read.
Returns:
a Helper instance to read the specified file.

getHelper

public static Helper getHelper(java.io.File file)
Returns a Helper instance to read the specified file.

Parameters:
file - the file to be read.
Returns:
a Helper instance to read the specified file.

open

public static Dataset open(java.lang.String filename)
                    throws java.io.IOException
Returns a Dataset instance that represents the data of the specified file.

Parameters:
filename - the filename to read the data from.
Returns:
a Dataset instance.
Throws:
java.io.IOException - if any file operation fails.

open

public static Dataset open(java.io.File file)
                    throws java.io.IOException
Returns a Dataset instance that represents the data of the specified file.

Parameters:
file - the file to read the data from.
Returns:
a Dataset instance.
Throws:
java.io.IOException - if any file operation fails.


Copyright © 2013. All Rights Reserved.