data.importers
Class Importer

java.lang.Object
  extended by data.importers.Importer

public final class Importer
extends java.lang.Object

Data layer manager to import external files. It detects the kind of file and delegates (manually) the importation process to the appropiate filetype handler

Version:
1.0
Author:
Oscar Flores

Constructor Summary
Importer()
           
 
Method Summary
static void fillFileFilter(javax.swing.JFileChooser jfc)
          That method setups a FileChooser to allow only the supported filetypes.
static java.io.FilenameFilter getAllFilenameFilter()
           
private static java.lang.String getFreeName(java.lang.String name)
          Finds a free name (identificator) for the matrix
static Matrix importMatrix(java.io.File f)
          This function reads the given file and parse the data in it if applicable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Importer

public Importer()
Method Detail

importMatrix

public static final Matrix importMatrix(java.io.File f)
                                 throws DataException
This function reads the given file and parse the data in it if applicable. Returns the matrix with the data readed, ready to be saved

Parameters:
f - The File to be imported
Returns:
The parsed data in form of Matrix object
Throws:
DataException - If there is any problem opening or reading the file

fillFileFilter

public static void fillFileFilter(javax.swing.JFileChooser jfc)
That method setups a FileChooser to allow only the supported filetypes. IMPORTANT: This method has to be updated everytime a filetype is added/removed

Parameters:
jfc - The FileChooser to fill

getAllFilenameFilter

public static java.io.FilenameFilter getAllFilenameFilter()

getFreeName

private static java.lang.String getFreeName(java.lang.String name)
Finds a free name (identificator) for the matrix

Parameters:
name - The base name of the matrix
Returns:
A free name