Class AFileSamplingAlgorithm

  • All Implemented Interfaces:
    java.lang.Iterable<org.api4.java.algorithm.events.IAlgorithmEvent>, java.util.concurrent.Callable<java.io.File>, java.util.Iterator<org.api4.java.algorithm.events.IAlgorithmEvent>, org.api4.java.algorithm.IAlgorithm<java.io.File,​java.io.File>, org.api4.java.common.control.ICancelable, org.api4.java.common.control.ILoggingCustomizable, org.api4.java.common.event.IEventEmitter<java.lang.Object>, org.api4.java.common.event.IRelaxedEventEmitter
    Direct Known Subclasses:
    ReservoirSampling, StratifiedFileSampling, SystematicFileSampling

    public abstract class AFileSamplingAlgorithm
    extends ai.libs.jaicore.basic.algorithm.AAlgorithm<java.io.File,​java.io.File>
    An abstract class for file-based sampling algorithms providing basic functionality of an algorithm.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.io.FileWriter outputFileWriter  
      protected java.lang.Integer sampleSize  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AFileSamplingAlgorithm​(java.io.File input)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.File call()  
      protected abstract void cleanUp()
      Implement custom clean up behaviour.
      void setOutputFileName​(java.lang.String outputFilePath)  
      void setSampleSize​(int size)  
      • Methods inherited from class ai.libs.jaicore.basic.algorithm.AAlgorithm

        activate, announceTimeoutDetected, avoidReinterruptionOnShutdownOnCurrentThread, cancel, checkAndConductTermination, checkTermination, computeTimeoutAware, getActivationTime, getConfig, getDeadline, getId, getInput, getListeners, getLoggerName, getNumCPUs, getRemainingTimeToDeadline, getState, getTimeout, getTimeoutPrecautionOffset, hasNext, hasThreadBeenInterruptedDuringShutdown, interruptThreadAsPartOfShutdown, isCanceled, isShutdownInitialized, isStopCriterionSatisfied, isTimeoutDefined, isTimeouted, iterator, next, post, registerActiveThread, registerListener, resolveShutdownInterruptOnCurrentThread, setConfig, setDeadline, setLoggerName, setMaxNumThreads, setNumCPUs, setState, setTimeout, setTimeout, setTimeoutPrecautionOffset, shutdown, terminate, unregisterActiveThread, unregisterThreadAndShutdown
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.api4.java.algorithm.IAlgorithm

        nextWithException
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, remove
    • Field Detail

      • sampleSize

        protected java.lang.Integer sampleSize
      • outputFileWriter

        protected java.io.FileWriter outputFileWriter
    • Constructor Detail

      • AFileSamplingAlgorithm

        protected AFileSamplingAlgorithm​(java.io.File input)
    • Method Detail

      • setSampleSize

        public void setSampleSize​(int size)
      • setOutputFileName

        public void setOutputFileName​(java.lang.String outputFilePath)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • call

        public java.io.File call()
                          throws java.lang.InterruptedException,
                                 org.api4.java.algorithm.exceptions.AlgorithmExecutionCanceledException,
                                 org.api4.java.algorithm.exceptions.AlgorithmException,
                                 org.api4.java.algorithm.exceptions.AlgorithmTimeoutedException
        Throws:
        java.lang.InterruptedException
        org.api4.java.algorithm.exceptions.AlgorithmExecutionCanceledException
        org.api4.java.algorithm.exceptions.AlgorithmException
        org.api4.java.algorithm.exceptions.AlgorithmTimeoutedException
      • cleanUp

        protected abstract void cleanUp()
        Implement custom clean up behaviour.