mavis
Class Session

java.lang.Object
  extended by mavis.Session

public class Session
extends java.lang.Object

This class functions as a common interface to all magnetic component related calculations and manipulations, and additionally allows to export all the components into a CSV file. Note: the component index starts at 0, and nearly all methods return null or 0 on errors.


Field Summary
(package private)  MagneticComponents components
           
private  javax.swing.event.EventListenerList listenerList
          Listeners for this project.
private  Project project
           
(package private)  boolean saved
           
 
Constructor Summary
Session(Project proj)
          Initialize a new Session instance.
 
Method Summary
 void addComponent(java.util.Vector<MeasurementStep> associatedSteps, int[] stepIndices)
          Adds a new component that consists of associates measurement steps and their indices in the measurement sequence (these are just for information).
 void addSessionListener(SessionListener listener)
          Adds a SessionListener to the session.
 boolean deleteComponent(int toBeDeleted)
          Deletes component and fires event to notify registered listeners.
protected  void fireSessionEvent(SessionEvent.Type type)
          Notifies all listeners that have registered for SessionEvents.
 boolean getAntipole(int component)
          Checks if the component is an antipole.
 double getAoE(int component)
          Returns angle of error (maximum angular deviation) of component.
 double getAvgIntensity(int component)
          Returns the average intensity of component.
 double getDeclination(int component)
          Returns the declination of component.
 javax.vecmath.Vector3d getEnd(int component)
          Returns the coordinate of the end point, in the normalized coordinate system.
 javax.vecmath.Vector2d getEnd2D(int component, ComponentCalculation.Axis axis)
          Returns the coords of the end point (2d), for component line fitting done in 2D i.e. as seen from specified axis.
 int[] getExcluded(int component)
          Returns the indices of the excluded steps in the component's step range.
 java.lang.String getExcludedString(int component)
          Returns the indexes of steps that are in the step range, but not included in the component, format is like "2-8,10,15,18-20"
 double getInclination(int component)
          Returns the inclination of component.
 double getLength(int component)
          Returns the length of the 3D component vector.
 double getMaxIntensity(int component)
          Returns maximum intensity of component.
 double getMinIntensity(int component)
          Returns the minimum intensity of component.
 int getNumOfComponents()
          Returns the number of magnetic components that the user has added.
 double getPoleLat(int component)
          Returns the ancient pole position (Latitude).
 double getPoleLong(int component)
          Returns ancient pole position (Longitude).
 Project getProject()
          Returns the Project associated with this Session.
 javax.vecmath.Vector3d getStart(int component)
          Returns the coordinate of the starting point, in the normalized coordinate system.
 javax.vecmath.Vector2d getStart2D(int component, ComponentCalculation.Axis axis)
          Returns the coords of the starting point (2d), for component line fitting done in 2D i.e. as seen from specified axis.
 javax.vecmath.Vector3d[] getStartAndEndpoints(int component)
          Returns the coords of the starting and ending points, corrected for the case of the origo being artificially forced to be one of the end points of the magnetic vector component.
 int[] getStepNumbers(int component)
          Returns the indexes of steps that component includes.
 java.lang.String getStepNumbersString(int component)
          Returns the indexes of steps that component includes, format is like "1-8,10,15,18-20"
 boolean isSaved()
          Tells whether the components in the session have been saved.
 void removeSessionListener(SessionListener listener)
          Removes a SessionListener from the session.
 boolean saveToTable(java.io.File file)
          Writes the magnetic components list to a file in CSV format.
 void setAntipole(boolean isAntipole, int component)
          Specifies if the component should be treated as an antipole.
 void setSaved(boolean saved)
          Sets the save status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

project

private Project project

components

MagneticComponents components

saved

boolean saved

listenerList

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

Constructor Detail

Session

public Session(Project proj)
Initialize a new Session instance.

Method Detail

addSessionListener

public void addSessionListener(SessionListener listener)
Adds a SessionListener to the session.

Parameters:
listener - the listener to be added.

removeSessionListener

public void removeSessionListener(SessionListener listener)
Removes a SessionListener from the session.

Parameters:
listener - the listener to be removed

fireSessionEvent

protected void fireSessionEvent(SessionEvent.Type type)
Notifies all listeners that have registered for SessionEvents.

Parameters:
type - type of the event.

deleteComponent

public boolean deleteComponent(int toBeDeleted)
Deletes component and fires event to notify registered listeners.


addComponent

public void addComponent(java.util.Vector<MeasurementStep> associatedSteps,
                         int[] stepIndices)
Adds a new component that consists of associates measurement steps and their indices in the measurement sequence (these are just for information). The component is placed at the end of the list of current components.


getNumOfComponents

public int getNumOfComponents()
Returns the number of magnetic components that the user has added.


getMaxIntensity

public double getMaxIntensity(int component)
Returns maximum intensity of component.


getMinIntensity

public double getMinIntensity(int component)
Returns the minimum intensity of component.


getAvgIntensity

public double getAvgIntensity(int component)
Returns the average intensity of component.


getInclination

public double getInclination(int component)
Returns the inclination of component.


getDeclination

public double getDeclination(int component)
Returns the declination of component.


getAoE

public double getAoE(int component)
Returns angle of error (maximum angular deviation) of component.


getPoleLat

public double getPoleLat(int component)
Returns the ancient pole position (Latitude).


getPoleLong

public double getPoleLong(int component)
Returns ancient pole position (Longitude).


getStart

public javax.vecmath.Vector3d getStart(int component)
Returns the coordinate of the starting point, in the normalized coordinate system.

Returns:
Vector3d of the starting point, or null on errors

setAntipole

public void setAntipole(boolean isAntipole,
                        int component)
Specifies if the component should be treated as an antipole. For antipoles, the direction of the magnetic component vector is reversed.


getAntipole

public boolean getAntipole(int component)
Checks if the component is an antipole.

Returns:
true if it is an antipole

getEnd

public javax.vecmath.Vector3d getEnd(int component)
Returns the coordinate of the end point, in the normalized coordinate system.

Returns:
Vector3d of the end point, or null on errors

getStartAndEndpoints

public javax.vecmath.Vector3d[] getStartAndEndpoints(int component)
Returns the coords of the starting and ending points, corrected for the case of the origo being artificially forced to be one of the end points of the magnetic vector component.

Returns:
Vector3d[2] with the first entry being the start and the second entry the end point of the 3D component line.

getStart2D

public javax.vecmath.Vector2d getStart2D(int component,
                                         ComponentCalculation.Axis axis)
Returns the coords of the starting point (2d), for component line fitting done in 2D i.e. as seen from specified axis.


getEnd2D

public javax.vecmath.Vector2d getEnd2D(int component,
                                       ComponentCalculation.Axis axis)
Returns the coords of the end point (2d), for component line fitting done in 2D i.e. as seen from specified axis.


getLength

public double getLength(int component)
Returns the length of the 3D component vector. The physical interpretation of this length remains unclear...

Returns:
euclidean length of the 3D component vector.

getStepNumbers

public int[] getStepNumbers(int component)
Returns the indexes of steps that component includes.


getStepNumbersString

public java.lang.String getStepNumbersString(int component)
Returns the indexes of steps that component includes, format is like "1-8,10,15,18-20"


getExcluded

public int[] getExcluded(int component)
Returns the indices of the excluded steps in the component's step range.

Parameters:
component - The magnetic component's index in the array.
Returns:
The excluded steps in an int array.

getExcludedString

public java.lang.String getExcludedString(int component)
Returns the indexes of steps that are in the step range, but not included in the component, format is like "2-8,10,15,18-20"

Parameters:
component - The magnetic component's index in the array.
Returns:
The String listing the excluded steps.

getProject

public Project getProject()
Returns the Project associated with this Session.

Returns:
The current Project

isSaved

public boolean isSaved()
Tells whether the components in the session have been saved.

Returns:
true, if the session has been saved, false otherwise.

setSaved

public void setSaved(boolean saved)
Sets the save status.

Parameters:
saved - true or false.

saveToTable

public boolean saveToTable(java.io.File file)
Writes the magnetic components list to a file in CSV format.

Parameters:
file - the file to write/append to.
Returns:
true if new component data was successfully added to the file.