|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mavis.Project
public class Project
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. |
|
|
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 |
---|
private static final boolean DEBUG
private static final boolean ALLOW_DELETING_COMPLETED_ROWS
public static final java.lang.String MEASUREMENT_TYPE_PROPERTY
public static final java.lang.String MEASUREMENT_TYPE_AUTO_VALUE
public static final java.lang.String MEASUREMENT_TYPE_MANUAL_VALUE
public static final java.lang.String OPERATOR_PROPERTY
public static final java.lang.String DATE_PROPERTY
public static final java.lang.String ROCK_TYPE_PROPERTY
public static final java.lang.String AREA_PROPERTY
public static final java.lang.String SITE_PROPERTY
public static final java.lang.String COMMENT_PROPERTY
public static final java.lang.String LATITUDE_PROPERTY
public static final java.lang.String LONGITUDE_PROPERTY
public static final java.lang.String STOP_ON_WARNING_PROPERTY
public static final java.lang.String TRUE
public static final java.lang.String FALSE
private static final java.util.Hashtable<java.io.File,Project> projectCache
private static final java.util.Hashtable<java.io.File,java.lang.Object> projectTypeCache
private final java.io.File file
private final Project.Type type
private Project.State state
private boolean closed
private final java.util.Properties properties
private MeasurementSequence sequence
private double strike
private double dip
private Project.SampleType sampleType
private Project.Orientation orientation
private Project.Normalization normalization
private javax.vecmath.Matrix3d transform
private double mass
private double volume
private java.lang.Double susceptibility
private final javax.swing.event.EventListenerList listenerList
private boolean modified
private final LastExecutor autosaveQueue
private java.lang.Runnable autosaveRunnable
private java.lang.String version
Constructor Detail |
---|
private Project(java.io.File file, Project.Type type)
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.
java.lang.NullPointerException
- if any of the parameters is null.private Project(java.io.File file, org.w3c.dom.Document document)
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.
java.lang.NullPointerException
- if any of the parameters is null.
java.lang.IllegalArgumentException
- if the document was not in the right format.Method Detail |
---|
public static Project createProject(java.io.File file, Project.Type type)
file
- path for the new project file.type
- type of the project.
java.lang.NullPointerException
- if file or type is null.public static Project loadProject(java.io.File file)
file
- project file to be loaded.
java.lang.NullPointerException
- if file is null.public static boolean closeProject(Project project)
project
- project to be closed.
java.lang.NullPointerException
- if the project is null.public static Project[] getCachedProjects()
public static Project.Type getType(java.io.File file)
file
- the path of the project file.
java.lang.NullPointerException
- if file is null.public org.w3c.dom.Document getDocument()
public boolean isModified()
public void save()
java.lang.IllegalStateException
- if this project has already been closed.public boolean saveNow()
java.lang.IllegalStateException
- if this project has already been closed.public java.io.File getFile()
public Project.Type getType()
public boolean isHolderCalibration()
public Project.State getState()
private void setState(Project.State state)
state
- the new state to change to.public boolean isClosed()
public java.lang.String getName()
public java.util.Date getTimestamp()
public java.lang.String getProperty(java.lang.String key)
key
- the key which is associated with the property.
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
key
- the key which is associated with the property.defaultValue
- a default value
public void setProperty(java.lang.String key, java.lang.String value)
key
- the key which is associated with the property.value
- new value for the property, or null to remove the property.public double getStrike()
public void setStrike(double strike)
public double getDip()
public void setDip(double dip)
public Project.SampleType getSampleType()
public Project.Orientation getOrientation()
public Project.Normalization getNormalization()
protected javax.vecmath.Matrix3d getTransform()
private void updateTransforms()
public double getMass()
public void setMass(double mass)
mass
- mass of the sample, or a negative number to clear it.public double getVolume()
public void setVolume(double volume)
volume
- volume of the sample, or a negative number to clear it.public java.lang.Double getSusceptibility()
public void setSusceptibility(java.lang.Double susceptibility)
susceptibility
- susceptibility of the sample, or null to clear it.public double getDensity()
public double getQ()
public void addProjectListener(ProjectListener l)
l
- the listener to be added.public void removeProjectListener(ProjectListener l)
l
- the listener to be removedprotected void fireProjectEvent(ProjectEvent.Type type)
type
- type of the event.public void addMeasurementListener(MeasurementListener l)
l
- the listener to be added.public void removeMeasurementListener(MeasurementListener l)
l
- the listener to be removedpublic MeasurementSequence copySequence(int start, int end)
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.
java.lang.IndexOutOfBoundsException
- if the index is out of range (start < 0 || end >= getSteps()).public boolean addStep(MeasurementStep step)
step
- the measurement step to be added.
java.lang.NullPointerException
- if step is null.public boolean addStep(int index, MeasurementStep step)
index
- the index to which the step will be added.step
- the measurement step to be added.
java.lang.IndexOutOfBoundsException
- if the index is out of range (index < getCompletedSteps() || index >
getSteps()).
java.lang.NullPointerException
- if step is null.public boolean removeStep(int index)
index
- the index of the step to be removed.
java.lang.IndexOutOfBoundsException
- if the index is out of range or the step was completed.public int getSteps()
public int getCompletedSteps()
public MeasurementStep getStep(int index)
index
- the index of the step.
java.lang.IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= getSteps()).public <A> A getValue(int index, MeasurementValue<A> algorithm)
index
- the measurement step from which the value is calculated.algorithm
- the algorithm for calculating the desired value.
java.lang.NullPointerException
- if algorithm is null.
java.lang.IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= getSteps()).public java.lang.String getVersion()
public int getStepIndex(MeasurementStep step)
MeasurementStep
object in the sequence or -1 if it isn't in the
sequence.
step
- a MeasurementStep
object whose index we need.
MeasurementStep
or -1 if the step is not in the sequence.private void runMeasurement()
java.lang.IllegalStateException
- if the project's state is IDLE or it has no Squid.public boolean isSequenceEditEnabled()
public boolean isAutoStepEnabled()
public boolean isSingleStepEnabled()
public boolean isAbortEnabled()
public boolean doAutoStep()
public boolean doPause()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |