Class Job

java.lang.Object
java.lang.Thread
eu.steffo.cleaver.logic.Job
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
ChopJob, StitchJob

public abstract class Job
extends java.lang.Thread
A Thread that allows access to the basic .
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Thread

    java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
  • Field Summary

    Fields inherited from class java.lang.Thread

    MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
  • Constructor Summary

    Constructors 
    Constructor Description
    Job()
    Construct a Job, setting its progress to Not started.
    Job​(java.lang.Runnable onProgressChange)
    Construct a Job, then add to it a Runnable that will be invoked through invokeLater on progress changes.
  • Method Summary

    Modifier and Type Method Description
    abstract CompressConfig getCompressConfig()  
    abstract CryptConfig getCryptConfig()  
    abstract java.io.File getFile()  
    Progress getProgress()  
    abstract SplitConfig getSplitConfig()  
    abstract java.lang.String getType()  
    abstract void run()
    The function that is run on a different thread when Thread.start() is called.
    protected void setProgress​(Progress progress)
    Set the progress of the job to a different value.

    Methods inherited from class java.lang.Thread

    activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Job

      public Job()
      Construct a Job, setting its progress to Not started.
    • Job

      public Job​(java.lang.Runnable onProgressChange)
      Construct a Job, then add to it a Runnable that will be invoked through invokeLater on progress changes.
      Parameters:
      onProgressChange - The Runnable that should be invoked when setProgress(Progress) is called.
      See Also:
      Job()
  • Method Details

    • getType

      public abstract java.lang.String getType()
      Returns:
      The name of the job type, such as "Chop" for a ChopJob.
    • getFile

      public abstract java.io.File getFile()
      Returns:
      The file path the job should act on.
    • getProgress

      public Progress getProgress()
      Returns:
      The current progress of the job.
      See Also:
      NotStartedProgress, WorkingProgress, FinishedProgress, ErrorProgress
    • getSplitConfig

      public abstract SplitConfig getSplitConfig()
      Returns:
      The SplitConfig of the job. If null, the job shouldn't handle file splitting/merging.
    • getCryptConfig

      public abstract CryptConfig getCryptConfig()
      Returns:
      The CryptConfig of the job. If null, the job shouldn't handle file encryption/decryption.
    • getCompressConfig

      public abstract CompressConfig getCompressConfig()
      Returns:
      The CompressConfig of the job. If null, the job shouldn't handle file compression/decompression.
    • setProgress

      protected void setProgress​(Progress progress)
      Set the progress of the job to a different value. If onProgressChange is set, schedule its invocation after the set, allowing for example the updating of a TableModel after the progress change.
      Parameters:
      progress - The value progress should be set to.
    • run

      public abstract void run()
      The function that is run on a different thread when Thread.start() is called. Child classes should override Thread.run().
      Specified by:
      run in interface java.lang.Runnable
      Overrides:
      run in class java.lang.Thread