edu.northwestern.at.morphadorner.tools.sampletextfile
Class SampleTextFile

java.lang.Object
  extended by edu.northwestern.at.morphadorner.tools.sampletextfile.SampleTextFile
Direct Known Subclasses:
ExactlySampleTextFile, RandomlySampleTextFile

public abstract class SampleTextFile
extends java.lang.Object

Sample a text file.

Copies one text file to another with a selection criterion.

Subclasses must implement the setupSampling, lineSelected, and samplingDone methods.


Constructor Summary
SampleTextFile(java.lang.String inputFileName, java.lang.String outputFileName, double sample)
          Copy a text file to another while sampling the input lines.
SampleTextFile(java.lang.String inputFileName, java.lang.String outputFileName, int sample)
          Copy a text file to another while sampling the input lines.
 
Method Summary
protected abstract  boolean lineSelected()
          Check if line should be selected.
 boolean samplingDone()
          Determine if sampling done.
protected abstract  void setupSampling(java.lang.String inputFileName, java.lang.String outputFileName, double sample)
          Set up the sampling.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SampleTextFile

public SampleTextFile(java.lang.String inputFileName,
                      java.lang.String outputFileName,
                      double sample)
Copy a text file to another while sampling the input lines.

Parameters:
inputFileName - Input file name.
outputFileName - Output file name.
sample - Sample count, percentage, etc.

SampleTextFile

public SampleTextFile(java.lang.String inputFileName,
                      java.lang.String outputFileName,
                      int sample)
Copy a text file to another while sampling the input lines.

Parameters:
inputFileName - Input file name.
outputFileName - Output file name.
sample - Sample count, percentage, etc.
Method Detail

setupSampling

protected abstract void setupSampling(java.lang.String inputFileName,
                                      java.lang.String outputFileName,
                                      double sample)
Set up the sampling.

Parameters:
inputFileName - Input file name.
outputFileName - Output file name.
sample - Sample count, percentage, etc.

lineSelected

protected abstract boolean lineSelected()
Check if line should be selected.

Returns:
true to select line.

Subclasses must override this method.


samplingDone

public boolean samplingDone()
Determine if sampling done.

Returns:
true if sampling done.