java.lang.Object
java.lang.Thread
eu.steffo.cleaver.logic.Job
- All Implemented Interfaces:
Runnable
public abstract class Job extends Thread
A
Thread
that allows access to the basic .-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields Modifier and Type Field Description private Runnable
onProgressChange
private Progress
progress
-
Constructor Summary
Constructors Constructor Description Job()
Construct a Job, setting its progress toNot started
.Job(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 File
getFile()
Progress
getProgress()
abstract SplitConfig
getSplitConfig()
abstract 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, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, toString, yield
-
Field Details
-
Constructor Details
-
Job
public Job()Construct a Job, setting its progress toNot started
. -
Job
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
- Returns:
- The name of the job type, such as "Chop" for a
ChopJob
.
-
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()
.
-