at.tuwien.ifs.somtoolbox.data
Class SOMLibZeroVectorRemover

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.data.SOMLibZeroVectorRemover
All Implemented Interfaces:
SOMToolboxApp

public class SOMLibZeroVectorRemover
extends Object
implements SOMToolboxApp

Handles the removal of zero vectors in vector files in SOMLib format. This class can be run in standalone mode taking two arguments, i.e. input and output file. If the input file is gzip-compressed, the output will also be written gzip-compressed. The .gz suffix has to be specified manually in order not to alter filenames to something other than intended by the user.

Created on Mar 16, 2004

Version:
$Id: SOMLibZeroVectorRemover.java 3682 2010-07-15 09:12:22Z frank $
Author:
Michael Dittenbach

Nested Class Summary
 
Nested classes/interfaces inherited from interface at.tuwien.ifs.somtoolbox.apps.SOMToolboxApp
SOMToolboxApp.Type
 
Field Summary
static SOMToolboxApp.Type APPLICATION_TYPE
           
static String DESCRIPTION
           
private static String ERROR_FILE_FORMAT_CORRUPT
           
static String LONG_DESCRIPTION
           
static com.martiansoftware.jsap.Parameter[] OPTIONS
           
 
Fields inherited from interface at.tuwien.ifs.somtoolbox.apps.SOMToolboxApp
DEV_BY_STRING, HOMEPAGE, REQUIRED_MEMBERS, TYPE_GROUPED_COMPARATOR
 
Constructor Summary
SOMLibZeroVectorRemover()
           
 
Method Summary
static void main(String[] args)
          Static method for standalone invocation.
static void removeZeroVectors(BufferedReader inReader, BufferedWriter outWriter)
          Static method taking a Buffered Reader and BufferedWriter as argument.
static void removeZeroVectors(String inFileName, String outFileName)
          Static method taking input and output filename as argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTIONS

public static final com.martiansoftware.jsap.Parameter[] OPTIONS

ERROR_FILE_FORMAT_CORRUPT

private static final String ERROR_FILE_FORMAT_CORRUPT
See Also:
Constant Field Values

DESCRIPTION

public static final String DESCRIPTION
See Also:
Constant Field Values

LONG_DESCRIPTION

public static final String LONG_DESCRIPTION
See Also:
Constant Field Values

APPLICATION_TYPE

public static final SOMToolboxApp.Type APPLICATION_TYPE
Constructor Detail

SOMLibZeroVectorRemover

public SOMLibZeroVectorRemover()
Method Detail

main

public static void main(String[] args)
Static method for standalone invocation.

Parameters:
args - Usage: input-filename output-filename

removeZeroVectors

public static void removeZeroVectors(String inFileName,
                                     String outFileName)
                              throws FileNotFoundException,
                                     IOException
Static method taking input and output filename as argument. File handling is done in this method and throws a FileNotFoundException if the input file can not be found and an IOException if some other file handling error occurs. If the input file is gzip-compressed, the output will also be written gzip-compressed. The .gz suffix has to be specified manually in order not to alter filenames to something other than intended by the user.

Parameters:
inFileName - Name of input file.
outFileName - Name of output file.
Throws:
FileNotFoundException
IOException

removeZeroVectors

public static void removeZeroVectors(BufferedReader inReader,
                                     BufferedWriter outWriter)
Static method taking a Buffered Reader and BufferedWriter as argument. The method exits the program if the file format is corrupt. TODO: This should be weakened in future by throwing a SOMLibVectorFileFormatException.

Parameters:
inReader - BufferedReader reading the file continaing unnormalized vectors.
outWriter - BuffererWriter writing the normalized vector file.