java.lang.Object
java.lang.Thread
eu.steffo.cleaver.logic.Job
- All Implemented Interfaces:
java.lang.Runnable
public abstract class Job
extends java.lang.Thread
A
Thread
that allows access to the basic .-
Nested Class Summary
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Job()
Construct a Job, setting its progress toNot started
.Job(java.lang.Runnable onProgressChange)
Construct a Job, then add to it aRunnable
that will be invoked throughinvokeLater
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 whenThread.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
-
Constructor Details
-
Job
public Job()Construct a Job, setting its progress toNot started
. -
Job
public Job(java.lang.Runnable onProgressChange)Construct a Job, then add to it aRunnable
that will be invoked throughinvokeLater
on progress changes.- Parameters:
onProgressChange
- TheRunnable
that should be invoked whensetProgress(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
- Returns:
- The current progress of the job.
- See Also:
NotStartedProgress
,WorkingProgress
,FinishedProgress
,ErrorProgress
-
getSplitConfig
- Returns:
- The
SplitConfig
of the job. If null, the job shouldn't handle file splitting/merging.
-
getCryptConfig
- Returns:
- The
CryptConfig
of the job. If null, the job shouldn't handle file encryption/decryption.
-
getCompressConfig
- Returns:
- The
CompressConfig
of the job. If null, the job shouldn't handle file compression/decompression.
-
setProgress
Set the progress of the job to a different value. IfonProgressChange
is set, schedule its invocation after the set, allowing for example the updating of aTableModel
after the progress change.- Parameters:
progress
- The valueprogress
should be set to.
-
run
public abstract void run()The function that is run on a different thread whenThread.start()
is called. Child classes should overrideThread.run()
.- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
-