ikayaki
Class NormalizedValue

java.lang.Object
  extended by ikayaki.MeasurementValue<Double>
      extended by ikayaki.NormalizedValue

abstract class NormalizedValue
extends MeasurementValue<Double>

Specializes the MeasurementValue class with automatic value normalization.

Author:
Esko Luontola

Field Summary
 
Fields inherited from class ikayaki.MeasurementValue
DECLINATION, GEOGRAPHIC_X, GEOGRAPHIC_X_NORMALIZED, GEOGRAPHIC_Y, GEOGRAPHIC_Y_NORMALIZED, GEOGRAPHIC_Z, GEOGRAPHIC_Z_NORMALIZED, INCLINATION, MAGNETIZATION, MOMENT, RELATIVE_MAGNETIZATION, SAMPLE_X, SAMPLE_X_NORMALIZED, SAMPLE_Y, SAMPLE_Y_NORMALIZED, SAMPLE_Z, SAMPLE_Z_NORMALIZED, SIGNAL_TO_DRIFT, SIGNAL_TO_HOLDER, SIGNAL_TO_NOISE, THETA63
 
Constructor Summary
NormalizedValue(String caption, String description)
           
 
Method Summary
 String getUnit(Project project)
          Returns mA/m or Am^2/kg depending on the normalization that the project uses.
 Double getValue(MeasurementStep step)
          Calculates a specific normalized value from a measurement step.
protected abstract  Double getValue0(MeasurementStep step)
          Calculates a specific NOT NORMALIZED value from a measurement step.
private static Double normalize(MeasurementStep step, Double value)
          Normalizes a value by mass or volume, as specified in the project or step.
 
Methods inherited from class ikayaki.MeasurementValue
getCaption, getDescription
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NormalizedValue

public NormalizedValue(String caption,
                       String description)
Method Detail

getValue

public final Double getValue(MeasurementStep step)
Calculates a specific normalized value from a measurement step.

Specified by:
getValue in class MeasurementValue<Double>
Parameters:
step - the step from which the value will be calculated.
Returns:
the calculated value, or null if it was not possible to calculate it. The unit is mA/m or Am^2/kg depenging on the normalization that was used.
Throws:
NullPointerException - if step is null.

getValue0

protected abstract Double getValue0(MeasurementStep step)
Calculates a specific NOT NORMALIZED value from a measurement step.

Parameters:
step - the step from which the value will be calculated.
Returns:
the calculated value, or null if it was not possible to calculate it. The unit is Am^2.
Throws:
NullPointerException - if step is null.

getUnit

public String getUnit(Project project)
Returns mA/m or Am^2/kg depending on the normalization that the project uses.

Overrides:
getUnit in class MeasurementValue<Double>
Parameters:
project - the currently active project, or null if no project is active. Used for returning a different text depending on the project.

normalize

private static Double normalize(MeasurementStep step,
                                Double value)
Normalizes a value by mass or volume, as specified in the project or step.

Parameters:
step - the step whose value is being normalized.
value - the value to be normalised. The unit is Am^2.
Returns:
the normalized value if the mass/volume was specified, otherwise null. The unit is mAm^2 divided by m^3 or kg depending on the used normalization.