edu.northwestern.at.morphadorner.tools.sampletextfile

## Class SampleTextFile

- java.lang.Object
- - 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.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.String` | `inputFileName` Input file name.
    `protected java.lang.String` | `outputFileName` Output file name.
    `protected double` | `sample` Sample count, percentage, etc.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `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

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract boolean` | `lineSelected(java.lang.String inputLine)` Check if line should be selected.
    `void` | `sample()` Perform the sampling.
    `boolean` | `samplingDone()` Determine if sampling done.
    `protected void` | `setupSampling()` Set up the sampling.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### inputFileName

          protected java.lang.String inputFileName

      Input file name.

    - #### outputFileName

          protected java.lang.String outputFileName

      Output file name.

    - #### sample

          protected double sample

      Sample count, percentage, etc.

  - ### 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 void setupSampling()

      Set up the sampling.

    - #### sample

          public void sample()

      Perform the sampling.

    - #### lineSelected

          protected abstract boolean lineSelected(java.lang.String inputLine)

      Check if line should be selected.
      Parameters:
        `inputLine` - The input line.
      Returns:
        true to select line.

        Subclasses must override this method.

    - #### samplingDone

          public boolean samplingDone()

      Determine if sampling done.
      Returns:
        true if sampling done.