mavis
Class Project

java.lang.Object
  extended by mavis.Project

public class Project
extends java.lang.Object

Represents a measurement project file. Project is responsible for managing and storing the data that is recieved from the magnetometer measurements. Any changes made to the project will be written to file regularly (autosave).

Project is responsible for controlling the magnetometer through the SQUID API. Controlling the SQUID will be done in a private worker thread. Only one project at a time may access the SQUID.

All operations are thread-safe.


Nested Class Summary
static class Project.Normalization
          The type of normalization to use for the measurement values.
static class Project.Orientation
          The orientation of the sample in the measurements.
static class Project.SampleType
          The type of a measured sample.
static class Project.State
          The state of the project's measurements.
static class Project.Type
          The type of the project.
 
Field Summary
private static boolean ALLOW_DELETING_COMPLETED_ROWS
           
static java.lang.String AREA_PROPERTY
           
private  LastExecutor autosaveQueue
          Scheduler for automatically writing the modified project to file after a short delay.
private  java.lang.Runnable autosaveRunnable
          Operation that will save the project to file.
private  boolean closed
          Tells if this project been closed with closeProject().
static java.lang.String COMMENT_PROPERTY
           
static java.lang.String DATE_PROPERTY
           
private static boolean DEBUG
           
private  double dip
          Dip of the sample.
static java.lang.String FALSE
           
private  java.io.File file
          Location of the project file in the local file system.
static java.lang.String LATITUDE_PROPERTY
           
private  javax.swing.event.EventListenerList listenerList
          Listeners for this project.
static java.lang.String LONGITUDE_PROPERTY
           
private  double mass
          Mass of the sample, or a negative value if no mass is defined.
static java.lang.String MEASUREMENT_TYPE_AUTO_VALUE
           
static java.lang.String MEASUREMENT_TYPE_MANUAL_VALUE
           
static java.lang.String MEASUREMENT_TYPE_PROPERTY
           
private  boolean modified
          true if the project has been modified, otherwise false.
private  Project.Normalization normalization
          The type of normalization to use.
static java.lang.String OPERATOR_PROPERTY
           
private  Project.Orientation orientation
          Orientation of the sample.
private static java.util.Hashtable<java.io.File,Project> projectCache
          Caches the created and loaded Project objects to make sure that no more than one object will be created for each physical file.
private static java.util.Hashtable<java.io.File,java.lang.Object> projectTypeCache
          Caches the types of the project files, as read by getType(Project).
private  java.util.Properties properties
          Custom properties of this project stored in a map.
static java.lang.String ROCK_TYPE_PROPERTY
           
private  Project.SampleType sampleType
          Type of the sample.
private  MeasurementSequence sequence
          Measurement sequence of this project.
static java.lang.String SITE_PROPERTY
           
private  Project.State state
          Current state of the measurements.
static java.lang.String STOP_ON_WARNING_PROPERTY
           
private  double strike
          Strike of the sample.
private  java.lang.Double susceptibility
          Susceptibility of the sample, or null if no susceptibility is defined.
private  javax.vecmath.Matrix3d transform
          Matrix for correcting the sample's orientation.
static java.lang.String TRUE
           
private  Project.Type type
          Type of the measurement project.
private  java.lang.String version
          The version number of the project.
private  double volume
          Volume of the sample, or a negative value if no volume is defined.
 
Constructor Summary
private Project(java.io.File file, org.w3c.dom.Document document)
          Creates a new project from the specified document.
private Project(java.io.File file, Project.Type type)
          Creates a new project of the specified type.
 
Method Summary
 void addMeasurementListener(MeasurementListener l)
          Adds a MeasurementListener to the project.
 void addProjectListener(ProjectListener l)
          Adds a ProjectListener to the project.
 boolean addStep(int index, MeasurementStep step)
          Adds a step to the specified index of this project's sequence.
 boolean addStep(MeasurementStep step)
          Appends a step to this project's sequence.
static boolean closeProject(Project project)
          Ensures that the project file is saved and frees the resources taken by the project.
 MeasurementSequence copySequence(int start, int end)
          Returns a copy of this project's sequence.
static Project createProject(java.io.File file, Project.Type type)
          Creates a project file of the specified type.
 boolean doAutoStep()
          Starts an auto step measurement.
 boolean doPause()
          Pauses the currently running measurement.
protected  void fireProjectEvent(ProjectEvent.Type type)
          Notifies all listeners that have registered for ProjectEvents.
static Project[] getCachedProjects()
          Returns an array containing all the projects that are in the project cache.
 int getCompletedSteps()
          Returns the number of completed steps in this project.
 double getDensity()
          Returns the density of the sample in kg/m^3
 double getDip()
          Returns the dip of the sample.
 org.w3c.dom.Document getDocument()
          Exports this project to a DOM document.
 java.io.File getFile()
          Returns the project file of this project.
 double getMass()
          Returns the mass of the sample.
 java.lang.String getName()
          Returns the name of this project.
 Project.Normalization getNormalization()
          Returns the normalization to be used for the measurement values.
 Project.Orientation getOrientation()
          Returns the orientation of the sample.
 java.lang.String getProperty(java.lang.String key)
          Returns a project information property.
 java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
          Returns a project information property.
 double getQ()
          Returns the Koenigsberger ratio Q of the project.
 Project.SampleType getSampleType()
          Returns the type of the sample.
 Project.State getState()
          Returns the current measurement state of this project.
 MeasurementStep getStep(int index)
          Returns a step from the sequence.
 int getStepIndex(MeasurementStep step)
          Returns the index of the given MeasurementStep object in the sequence or -1 if it isn't in the sequence.
 int getSteps()
          Returns the number of steps in this project.
 double getStrike()
          Returns the strike of the sample.
 java.lang.Double getSusceptibility()
          Returns the susceptibility of the sample.
 java.util.Date getTimestamp()
          Returns the timestamp of the last completed measurement.
protected  javax.vecmath.Matrix3d getTransform()
          Returns the current transformation matrix for the sample.
 Project.Type getType()
          Returns the type of this project.
static Project.Type getType(java.io.File file)
          Returns the type of a project file.
<A> A
getValue(int index, MeasurementValue<A> algorithm)
          Calculates and returns a value from a measurement step.
 java.lang.String getVersion()
          Returns the version number of the loaded project file.
 double getVolume()
          Returns the volume of the sample.
 boolean isAbortEnabled()
          Tells whether it is possible to abort the measurement.
 boolean isAutoStepEnabled()
          Tells whether it is allowed to do an auto step measurement.
 boolean isClosed()
          Returns true if this project has been closed with closeProject().
 boolean isHolderCalibration()
          Returns true if this project file has been set as the Sample Holder Calibration project in the program settings.
 boolean isModified()
          Tells whether the project has been modified and it needs to be saved.
 boolean isSequenceEditEnabled()
          Tells whether it is allowed to edit the sequence.
 boolean isSingleStepEnabled()
          Tells whether it is allowed to do a single step measurement.
static Project loadProject(java.io.File file)
          Loads a saved project file.
 void removeMeasurementListener(MeasurementListener l)
          Removes a MeasurementListener from the project.
 void removeProjectListener(ProjectListener l)
          Removes a ProjectListener from the project.
 boolean removeStep(int index)
          Removes a step from this project's sequence.
private  void runMeasurement()
          Runs a measurement sequence until it is paused, aborted or there are no more steps to measure.
 void save()
          Invokes autosaving.
 boolean saveNow()
          Writes this project to its project file and waits for the operation to complete.
 void setDip(double dip)
          Sets the dip of the sample and calls updateTransforms().
 void setMass(double mass)
          Sets the mass of the sample.
 void setProperty(java.lang.String key, java.lang.String value)
          Sets a project information property.
private  void setState(Project.State state)
          Sets the state of this project.
 void setStrike(double strike)
          Sets the strike of the sample and calls updateTransforms().
 void setSusceptibility(java.lang.Double susceptibility)
          Sets the susceptibility of the sample.
 void setVolume(double volume)
          Sets the volume of the sample.
private  void updateTransforms()
          Recalculates the transformation matrix and updates all measurements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

ALLOW_DELETING_COMPLETED_ROWS

private static final boolean ALLOW_DELETING_COMPLETED_ROWS
See Also:
Constant Field Values

MEASUREMENT_TYPE_PROPERTY

public static final java.lang.String MEASUREMENT_TYPE_PROPERTY
See Also:
Constant Field Values

MEASUREMENT_TYPE_AUTO_VALUE

public static final java.lang.String MEASUREMENT_TYPE_AUTO_VALUE
See Also:
Constant Field Values

MEASUREMENT_TYPE_MANUAL_VALUE

public static final java.lang.String MEASUREMENT_TYPE_MANUAL_VALUE
See Also:
Constant Field Values

OPERATOR_PROPERTY

public static final java.lang.String OPERATOR_PROPERTY
See Also:
Constant Field Values

DATE_PROPERTY

public static final java.lang.String DATE_PROPERTY
See Also:
Constant Field Values

ROCK_TYPE_PROPERTY

public static final java.lang.String ROCK_TYPE_PROPERTY
See Also:
Constant Field Values

AREA_PROPERTY

public static final java.lang.String AREA_PROPERTY
See Also:
Constant Field Values

SITE_PROPERTY

public static final java.lang.String SITE_PROPERTY
See Also:
Constant Field Values

COMMENT_PROPERTY

public static final java.lang.String COMMENT_PROPERTY
See Also:
Constant Field Values

LATITUDE_PROPERTY

public static final java.lang.String LATITUDE_PROPERTY
See Also:
Constant Field Values

LONGITUDE_PROPERTY

public static final java.lang.String LONGITUDE_PROPERTY
See Also:
Constant Field Values

STOP_ON_WARNING_PROPERTY

public static final java.lang.String STOP_ON_WARNING_PROPERTY
See Also:
Constant Field Values

TRUE

public static final java.lang.String TRUE
See Also:
Constant Field Values

FALSE

public static final java.lang.String FALSE
See Also:
Constant Field Values

projectCache

private static final java.util.Hashtable<java.io.File,Project> projectCache
Caches the created and loaded Project objects to make sure that no more than one object will be created for each physical file.


projectTypeCache

private static final java.util.Hashtable<java.io.File,java.lang.Object> projectTypeCache
Caches the types of the project files, as read by getType(Project). The value is a Type for valid project files, or an Object for invalid or unknown files.


file

private final java.io.File file
Location of the project file in the local file system. Autosaving will save the project to this file.


type

private final Project.Type type
Type of the measurement project. This will affect which features of the project are enabled and disabled.


state

private Project.State state
Current state of the measurements. If no measurement is running, then state is IDLE. Only one measurement may be running at a time.


closed

private boolean closed
Tells if this project been closed with closeProject().


properties

private final java.util.Properties properties
Custom properties of this project stored in a map. The project is not interested in what properties are stored; it only saves them.


sequence

private MeasurementSequence sequence
Measurement sequence of this project. In the beginning are all completed measurement steps, and in the end are planned measurement steps. Completed measurements may NOT be deleted.


strike

private double strike
Strike of the sample. Will be used to create the transform matrix. The unit is degrees (0 to 360).


dip

private double dip
Dip of the sample. Will be used to create the transform matrix. The unit is degrees (0 to 180).


sampleType

private Project.SampleType sampleType
Type of the sample. Will be used to create the transform matrix.


orientation

private Project.Orientation orientation
Orientation of the sample. Will be used to create the transform matrix.


normalization

private Project.Normalization normalization
The type of normalization to use.


transform

private javax.vecmath.Matrix3d transform
Matrix for correcting the sample's orientation. The matrix will be updated whenever the strike, dip, sampleType or orientation is changed. After that the updated matrix will be applied to all measurements.


mass

private double mass
Mass of the sample, or a negative value if no mass is defined. The unit is gram.


volume

private double volume
Volume of the sample, or a negative value if no volume is defined. The unit is cm^3.


susceptibility

private java.lang.Double susceptibility
Susceptibility of the sample, or null if no susceptibility is defined. The unit is 10^-6 SI.


listenerList

private final javax.swing.event.EventListenerList listenerList
Listeners for this project.


modified

private boolean modified
true if the project has been modified, otherwise false.


autosaveQueue

private final LastExecutor autosaveQueue
Scheduler for automatically writing the modified project to file after a short delay.


autosaveRunnable

private java.lang.Runnable autosaveRunnable
Operation that will save the project to file.


version

private java.lang.String version
The version number of the project.

Constructor Detail

Project

private Project(java.io.File file,
                Project.Type type)
Creates a new project of the specified type. This constructor will not write to file, so the user of this method should call the saveNow() method after the project is initialized.

Parameters:
file - path for this project file. The file should exist (may be empty) and be writable, but this constructor will not check it.
type - type of the project.
Throws:
java.lang.NullPointerException - if any of the parameters is null.

Project

private Project(java.io.File file,
                org.w3c.dom.Document document)
Creates a new project from the specified document. This constructor will assume that the specified file is the same from which the document was read.

Parameters:
file - path for this project file. The file should be the same from which document was read and be writable, but this constructor will not check it.
document - the document from which this project will be created.
Throws:
java.lang.NullPointerException - if any of the parameters is null.
java.lang.IllegalArgumentException - if the document was not in the right format.
Method Detail

createProject

public static Project createProject(java.io.File file,
                                    Project.Type type)
Creates a project file of the specified type. Ensures that the project file has been written to disk. Adds the created Project object to projectCache.

Parameters:
file - path for the new project file.
type - type of the project.
Returns:
the created project, or null if file was not writable or it already existed.
Throws:
java.lang.NullPointerException - if file or type is null.

loadProject

public static Project loadProject(java.io.File file)
Loads a saved project file. If the file has already been loaded, will return a reference to the existing Project object.

Parameters:
file - project file to be loaded.
Returns:
the loaded project, or null if file is not a valid project file or it was not readable.
Throws:
java.lang.NullPointerException - if file is null.

closeProject

public static boolean closeProject(Project project)
Ensures that the project file is saved and frees the resources taken by the project. The closed project will automatically detach itself from the Squid. The closed project is removed from the projectCache.

A project should not be used after it has been closed – any further use of the object is undefined (will create an IllegalStateException if somebody tries to modify it). A project can not be closed if it has a measurement running.

Parameters:
project - project to be closed.
Returns:
true if the project has been closed, false if a measurement is running and the project can not be closed.
Throws:
java.lang.NullPointerException - if the project is null.

getCachedProjects

public static Project[] getCachedProjects()
Returns an array containing all the projects that are in the project cache.


getType

public static Project.Type getType(java.io.File file)
Returns the type of a project file. Reads the type of the project from the specified file quickly, without fully loading the Project. The first request for each file reads from the file system, but after that the results are cached for an unspecified time.

Parameters:
file - the path of the project file.
Returns:
the type of the project, or null if the file was not a project file or it was not possible to read it.
Throws:
java.lang.NullPointerException - if file is null.

getDocument

public org.w3c.dom.Document getDocument()
Exports this project to a DOM document.

Returns:
the exported document, or null if there was a error.

isModified

public boolean isModified()
Tells whether the project has been modified and it needs to be saved.


save

public void save()
Invokes autosaving. This method will mark the project as modified and schedule a saving operation. After this method has not been called for a short while, the project will be written to file.

Throws:
java.lang.IllegalStateException - if this project has already been closed.

saveNow

public boolean saveNow()
Writes this project to its project file and waits for the operation to complete. Clears any delaying autosave operations. Will do nothing if the project file has already been saved.

Returns:
true if the file has been saved, otherwise false.
Throws:
java.lang.IllegalStateException - if this project has already been closed.

getFile

public java.io.File getFile()
Returns the project file of this project.


getType

public Project.Type getType()
Returns the type of this project.


isHolderCalibration

public boolean isHolderCalibration()
Returns true if this project file has been set as the Sample Holder Calibration project in the program settings.


getState

public Project.State getState()
Returns the current measurement state of this project.

Returns:
the state of the project, or null if the project has been closed.

setState

private void setState(Project.State state)
Sets the state of this project. Fires state change events.

Parameters:
state - the new state to change to.

isClosed

public boolean isClosed()
Returns true if this project has been closed with closeProject(). If it has been closed, no modifications to the project will be allowed.


getName

public java.lang.String getName()
Returns the name of this project. The name is equal to the name of the project file without the file extension.


getTimestamp

public java.util.Date getTimestamp()
Returns the timestamp of the last completed measurement. This is usually less than the last modified date of the file, because this is not affected by changing the project's properties.

Returns:
the timestamp of the last measurement, or null if no measurements are completed.

getProperty

public java.lang.String getProperty(java.lang.String key)
Returns a project information property.

Parameters:
key - the key which is associated with the property.
Returns:
the specified property, or null if the property is not set.

getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String defaultValue)
Returns a project information property.

Parameters:
key - the key which is associated with the property.
defaultValue - a default value
Returns:
the specified property, or defaultValue if the property is not set.

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Sets a project information property.

Parameters:
key - the key which is associated with the property.
value - new value for the property, or null to remove the property.

getStrike

public double getStrike()
Returns the strike of the sample. The unit is degrees (0 to 360).


setStrike

public void setStrike(double strike)
Sets the strike of the sample and calls updateTransforms(). The unit is degrees (0 to 360).


getDip

public double getDip()
Returns the dip of the sample. The unit is degrees (0 to 180).


setDip

public void setDip(double dip)
Sets the dip of the sample and calls updateTransforms(). The unit is degrees (0 to 180).


getSampleType

public Project.SampleType getSampleType()
Returns the type of the sample.


getOrientation

public Project.Orientation getOrientation()
Returns the orientation of the sample.


getNormalization

public Project.Normalization getNormalization()
Returns the normalization to be used for the measurement values.


getTransform

protected javax.vecmath.Matrix3d getTransform()
Returns the current transformation matrix for the sample. For performance reasons, this method returns a reference to the internal data structure and not a copy of it.

WARNING!!! Absolutely NO modification of the data contained in this matrix should be made – if any such manipulation is necessary, it should be done on a copy of the matrix returned rather than the matrix itself.

Returns:
reference to the transformation matrix.

updateTransforms

private void updateTransforms()
Recalculates the transformation matrix and updates all measurements. This method is called automatically by the setStrike(), setDip() and setSampleType() methods.


getMass

public double getMass()
Returns the mass of the sample. The unit is gram.

Returns:
mass of the sample, or a negative number if no mass is specified.

setMass

public void setMass(double mass)
Sets the mass of the sample. The unit is gram.

Parameters:
mass - mass of the sample, or a negative number to clear it.

getVolume

public double getVolume()
Returns the volume of the sample. The unit is cm^3.

Returns:
volume of the sample, or a negative number if no volume is specified.

setVolume

public void setVolume(double volume)
Sets the volume of the sample. The unit is cm^3.

Parameters:
volume - volume of the sample, or a negative number to clear it.

getSusceptibility

public java.lang.Double getSusceptibility()
Returns the susceptibility of the sample. The unit is 10^-6 SI.

Returns:
susceptibility of the sample, or null if no susceptibility is specified.

setSusceptibility

public void setSusceptibility(java.lang.Double susceptibility)
Sets the susceptibility of the sample. The unit is 10^-6 SI.

Parameters:
susceptibility - susceptibility of the sample, or null to clear it.

getDensity

public double getDensity()
Returns the density of the sample in kg/m^3

Returns:
the density of the sample or -1.0 if mass or volume isn't defined.

getQ

public double getQ()
Returns the Koenigsberger ratio Q of the project.

Returns:
Q or -1.0 if the project has no steps.

addProjectListener

public void addProjectListener(ProjectListener l)
Adds a ProjectListener to the project.

Parameters:
l - the listener to be added.

removeProjectListener

public void removeProjectListener(ProjectListener l)
Removes a ProjectListener from the project.

Parameters:
l - the listener to be removed

fireProjectEvent

protected void fireProjectEvent(ProjectEvent.Type type)
Notifies all listeners that have registered for ProjectEvents.

Parameters:
type - type of the event.

addMeasurementListener

public void addMeasurementListener(MeasurementListener l)
Adds a MeasurementListener to the project.

Parameters:
l - the listener to be added.

removeMeasurementListener

public void removeMeasurementListener(MeasurementListener l)
Removes a MeasurementListener from the project.

Parameters:
l - the listener to be removed

copySequence

public MeasurementSequence copySequence(int start,
                                        int end)
Returns a copy of this project's sequence. Only the stepValues will be copied from this project's sequence. The returned sequence will have no name.

Parameters:
start - index of the first step in the sequence.
end - index of the last step in the sequence. If end < start, then an empty sequence will be returned.
Returns:
copy of the sequence with only stepValues and no results.
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range (start < 0 || end >= getSteps()).

addStep

public boolean addStep(MeasurementStep step)
Appends a step to this project's sequence. Only the stepValue will be copied from the specified step and added as a new step to this project.

Parameters:
step - the measurement step to be added.
Returns:
true, it is always possible to append a step.
Throws:
java.lang.NullPointerException - if step is null.

addStep

public boolean addStep(int index,
                       MeasurementStep step)
Adds a step to the specified index of this project's sequence. Only the stepValue will be copied from the specified step and added as a new step to this project.

The index must be such, that the indices of the completed measurements will not change.

If isSequenceEditEnabled() is false, nothing will be done.

Parameters:
index - the index to which the step will be added.
step - the measurement step to be added.
Returns:
true if the step was added, or false if isSequenceEditEnabled() was false.
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range (index < getCompletedSteps() || index > getSteps()).
java.lang.NullPointerException - if step is null.

removeStep

public boolean removeStep(int index)
Removes a step from this project's sequence. Completed measurements can not be removed.

If isSequenceEditEnabled() is false, nothing will be done.

Parameters:
index - the index of the step to be removed.
Returns:
true if the step was removed, or false if isSequenceEditEnabled() was false.
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range or the step was completed.

getSteps

public int getSteps()
Returns the number of steps in this project.


getCompletedSteps

public int getCompletedSteps()
Returns the number of completed steps in this project. It does not count ongoing measurements as completed. Completed steps are usually, but not always, first in the sequence.

Returns:
the number of completed steps in total

getStep

public MeasurementStep getStep(int index)
Returns a step from the sequence.

Parameters:
index - the index of the step.
Returns:
the specified step.
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= getSteps()).

getValue

public <A> A getValue(int index,
                      MeasurementValue<A> algorithm)
Calculates and returns a value from a measurement step. The specified MeasurementValue's algorithm will be used and the results returned.

Parameters:
index - the measurement step from which the value is calculated.
algorithm - the algorithm for calculating the desired value.
Returns:
the value returned by the algorithm, or null if it was not possible to calculate it.
Throws:
java.lang.NullPointerException - if algorithm is null.
java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= getSteps()).

getVersion

public java.lang.String getVersion()
Returns the version number of the loaded project file.

Returns:
the version number of the loaded project file.

getStepIndex

public int getStepIndex(MeasurementStep step)
Returns the index of the given MeasurementStep object in the sequence or -1 if it isn't in the sequence.

Parameters:
step - a MeasurementStep object whose index we need.
Returns:
the index of the given MeasurementStep or -1 if the step is not in the sequence.

runMeasurement

private void runMeasurement()
Runs a measurement sequence until it is paused, aborted or there are no more steps to measure. The project must be in a non-IDLE state before starting a measurement with this method. The measurement should be run in a worker thread and only one at a time.

Throws:
java.lang.IllegalStateException - if the project's state is IDLE or it has no Squid.

isSequenceEditEnabled

public boolean isSequenceEditEnabled()
Tells whether it is allowed to edit the sequence. The returned value depends on the type and state of this project - calibration projects can not be edited. Editing is also disabled while a measurement is running i.e. when Ikayaki is not idle or paused.


isAutoStepEnabled

public boolean isAutoStepEnabled()
Tells whether it is allowed to do an auto step measurement. The returned value depends on the type and state of this project.


isSingleStepEnabled

public boolean isSingleStepEnabled()
Tells whether it is allowed to do a single step measurement. The returned value depends on the type and state of this project.


isAbortEnabled

public boolean isAbortEnabled()
Tells whether it is possible to abort the measurement. The returned value depends on the type and state of this project.


doAutoStep

public boolean doAutoStep()
Starts an auto step measurement. If isAutoStepEnabled() is false but is isSingleStepEnabled() is true, will start a single step measurement. Will do nothing if both are false. If there are no unmeasured steps in the sequence, will add one for a measurement without demagnetization.

The measurement will run in its own thread, and this method will not wait for it to finish.

Returns:
true if the measurement was started, otherwise false.

doPause

public boolean doPause()
Pauses the currently running measurement. A paused measurement will halt after it finishes the current measurement step. Will do nothing if isPauseEnabled() is false. Will work even if isPauseEnabled() is false.

This method will notify the measurement thread to pause, but will not wait for it to finish.

Returns:
true if the measurement will pause, otherwise false.