public class AutoSaver extends java.lang.Object implements ProverTaskListener
AutoSaver
instance saves periodically and the final proof state if it is closed.
The default save interval can be set using the static #init(int, boolean)
method.
Before the saver is registered as a listener, a proof must be set with setProof()
.
AutoSaver writes .key files to a temporary location (i.e., "/tmp" on most Linux machines).
These are possibly overwritten on each strategy run.
Write errors (e.g., missing permissions) are silently ignored.Modifier and Type | Field and Description |
---|---|
private static AutoSaver |
DEFAULT_INSTANCE |
private static boolean |
defaultSaveClosedProof |
private static int |
defaultSaveInterval |
private int |
interval |
private static java.lang.String |
PREFIX |
private Proof |
proof |
private boolean |
saveClosed |
static SettingsListener |
settingsListener |
private static java.io.File |
TMP_DIR |
Modifier | Constructor and Description |
---|---|
private |
AutoSaver() |
|
AutoSaver(int saveInterval,
boolean saveClosedProof)
Create a custom instance.
|
Modifier and Type | Method and Description |
---|---|
static AutoSaver |
getDefaultInstance()
Create a new instance using default values,
or null if auto save is disabled by default.
|
private void |
save(java.lang.String filename,
Proof proof) |
static void |
setDefaultValues(int saveInterval,
boolean saveClosedProof)
Set default values.
|
void |
setProof(Proof p)
Set the proof to be saved.
|
void |
taskFinished(TaskFinishedInfo info)
Called when a task is finished.
|
void |
taskProgress(int progress)
Saves the proof at the end of an interval.
|
void |
taskStarted(TaskStartedInfo info) |
private static final java.io.File TMP_DIR
private static final java.lang.String PREFIX
private Proof proof
private final int interval
private final boolean saveClosed
private static int defaultSaveInterval
private static boolean defaultSaveClosedProof
private static AutoSaver DEFAULT_INSTANCE
public static final SettingsListener settingsListener
private AutoSaver()
public AutoSaver(int saveInterval, boolean saveClosedProof)
saveInterval
- saveClosedProof
- public static void setDefaultValues(int saveInterval, boolean saveClosedProof)
saveInterval
- the interval (= number of proof steps) to periodically savesaveClosedProof
- whether to save the final closed proofpublic static AutoSaver getDefaultInstance()
AutoSaver.setDefaultValues()
public void setProof(Proof p)
p
- proof to save, must not be nullpublic void taskProgress(int progress)
taskProgress
in interface ProverTaskListener
progress
- indicates how much work has been done relative to the value of
size
passed in ProverTaskListener.taskStarted(TaskStartedInfo)
.java.lang.IllegalStateException
- if no proof was setpublic void taskStarted(TaskStartedInfo info)
taskStarted
in interface ProverTaskListener
public void taskFinished(TaskFinishedInfo info)
ProverTaskListener
taskFinished
in interface ProverTaskListener
info
- a TaskFinishedInfo object with additional informationprivate void save(java.lang.String filename, Proof proof)