cds.simbad
Class Measurement

java.lang.Object
  extended bycds.simbad.Measurement

public class Measurement
extends java.lang.Object

Manages a measurement list. An instance of this class contains an homogeneous measurement list from one catalogue. Many methods are also devoted to metadata management: field definitions, headers, output formats, and so on.

Version:
1.0 May 2002
Author:
Marc Wenger/CDS

Field Summary
(package private)  java.lang.String acronym
           
(package private)  VotMeasurementField[] flds
           
(package private)  MeasurementDescription mdescr
           
(package private)  boolean meanValue
           
(package private)  java.util.ArrayList measurements
           
(package private)  VotTable mtable
           
(package private)  java.lang.String name
           
 
Constructor Summary
Measurement(java.lang.String acronym)
          Creates a Measurement object.
 
Method Summary
 void addMeasurement(java.lang.String measurement)
          Adds a measurement at the end of the list.
 void addMeasurement(java.lang.String[] fields)
          Adds a measurement at the end of the list.
 void addMeasurement(java.lang.String[] fields, int position)
          Adds a measurement at a given position.
 void addMeasurement(java.lang.String measurement, int position)
          Adds a measurement at a given position.
 java.lang.String format(java.lang.String[] fields)
          Format the field array and return the measurement as a formatted string
 java.lang.String getAcronym()
          Gets the catalogue acronym
 java.lang.String getMeasurement(int num)
          Gets the n-th measurement
 MeasurementDescription getMeasurementDescription()
          Gets the MeasurementDescription object associated with this measurement
 java.lang.String getMeasurementField(int num, int fnum)
          Gets a measurement field.
 java.lang.String getMeasurementField(int num, java.lang.String fldname)
          Gets a measurement field.
 java.lang.String[] getMeasurementFields(int num)
          Returns the array of all the individual fields included in the n-th measurement.
 int getMeasurementNumber()
          Returns the number of measurements
 java.lang.String getName()
          Gets the name of the measurement catalogue
 boolean isMeanValue()
          Checks if there is a mean measurement.
 java.util.Iterator iterator()
          Returns an iterator on the measurement strings
 void setMeanMeasurement()
          Sets the first measurement as meanValue
 void setMeanMeasurement(java.lang.String measurement)
          Sets the mean measurement.
 void setMeanMeasurement(java.lang.String[] fields)
          Sets the mean measurement.
 void setMeasurement(java.lang.String[] fields, int position)
          Sets a measurement at a given position.
 void setMeasurement(java.lang.String measurement, int position)
          Sets a measurement at a given position.
 void setName(java.lang.String name)
          Sets the name of the catalogue
 void setVotTable(VotTable votTable)
          Sets the votTable for this measurement type.
 java.lang.String[] split(java.lang.String measurement)
          Split a measurement given as parameter in all its fields
 void toXML(VOTable vot)
          Outputs all the measurements in XML structure to the given VOTable object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

acronym

java.lang.String acronym

name

java.lang.String name

meanValue

boolean meanValue

mdescr

MeasurementDescription mdescr

measurements

java.util.ArrayList measurements

mtable

VotTable mtable

flds

VotMeasurementField[] flds
Constructor Detail

Measurement

public Measurement(java.lang.String acronym)
            throws SimbadException
Creates a Measurement object. This object is initialized for one particular catalogue specified by its acronym.
Bootstrapping: before creating a measurement object, it is mandatory to have created the MeasurementDescription object. This object is accessed through a static method of class MeasurementDescription. This object is needed to access all the information for this particular measurement type (VotTable, Fields, header, format, ...)

Parameters:
acronym - Name of the catalogue, as it is defined in the parameters file.
Throws:
SimbadException
See Also:
MeasurementDescription
Method Detail

setName

public void setName(java.lang.String name)
Sets the name of the catalogue

Parameters:
name - of the catalogue. A full name, more complete than the acronym.

setVotTable

public void setVotTable(VotTable votTable)
Sets the votTable for this measurement type. This is generally done by the constructor. The votTable object defines all the parameters related to this measurement type. Among other, it contains the definition of all the measurement fields.

Parameters:
votTable - votTable object

addMeasurement

public void addMeasurement(java.lang.String measurement)
Adds a measurement at the end of the list. The measurement must be given as a string correctly formatted.
No validity control is performed. It is the responsability of the caller to ensure that the measurement respects the right structure.

Parameters:
measurement - Measurement string

addMeasurement

public void addMeasurement(java.lang.String measurement,
                           int position)
Adds a measurement at a given position. All measurements after this one are shifted by one place.

Parameters:
measurement - Measurement string
position - position where this measurement should be added
See Also:
addMeasurement(String measurement)

addMeasurement

public void addMeasurement(java.lang.String[] fields)
Adds a measurement at the end of the list. The measurement must be given as an array of strings, each of them containing one field of the measurement. The method builds the complete string correctly formatted. No validity control on the sequence of fields is performed. It is the responsability of the caller to ensure that the measurement respects the right structure.

Parameters:
fields - array of strings containing, in the right order, all the fields building the measurement.

addMeasurement

public void addMeasurement(java.lang.String[] fields,
                           int position)
Adds a measurement at a given position. All measurements after this one are shifted by one place. The measurement must be given as an array of strings, each of them containing one field of the measurement. The method builds the complete string correctly formatted.

Parameters:
fields - array of strings containing, in the right order, all the fields building the measurement.
position - position where this measurement should be added
See Also:
addMeasurement(String measurement)

setMeasurement

public void setMeasurement(java.lang.String measurement,
                           int position)
Sets a measurement at a given position. It replaces the measurement existing at this place.

Parameters:
measurement - Measurement string
position - position where this measurement should be added
See Also:
addMeasurement(String measurement)

setMeasurement

public void setMeasurement(java.lang.String[] fields,
                           int position)
Sets a measurement at a given position. It replaces the measurement existing at this place. The measurement must be given as an array of strings, each of them containing one field of the measurement. The method builds the complete string correctly formatted.

Parameters:
fields - array of strings containing, in the right order, all the fields building the measurement.
position - position where this measurement should be added
See Also:
addMeasurement(String measurement)

setMeanMeasurement

public void setMeanMeasurement(java.lang.String measurement)
Sets the mean measurement. Only one mean measurement is kept within one measurement object. It becomes the first measurement in the list. A previously defined mean measurement is pushed down on the list. It is not deleted. No validity control is performed. It is the responsability of the caller to ensure that the measurement respects the right structure.

Parameters:
measurement - Mean measurement string

setMeanMeasurement

public void setMeanMeasurement(java.lang.String[] fields)
Sets the mean measurement. It is given as an array of fields.

Parameters:
fields - array of strings containing, in the right order, all the fields building the measurement.
See Also:
setMeanMeasurement(String measurement)

setMeanMeasurement

public void setMeanMeasurement()
Sets the first measurement as meanValue


getMeasurementDescription

public MeasurementDescription getMeasurementDescription()
Gets the MeasurementDescription object associated with this measurement

Returns:
Measurement Description object

getName

public java.lang.String getName()
Gets the name of the measurement catalogue

Returns:
the measurement catalogue full name

getAcronym

public java.lang.String getAcronym()
Gets the catalogue acronym

Returns:
The catalogue acronym

iterator

public java.util.Iterator iterator()
Returns an iterator on the measurement strings

Returns:
an iterator on the measurement list

getMeasurementNumber

public int getMeasurementNumber()
Returns the number of measurements

Returns:
Number of measurements

getMeasurement

public java.lang.String getMeasurement(int num)
Gets the n-th measurement

Parameters:
num - sequential number of the measurement to retrieve
Returns:
the n-th measurement (or null, if it does not exist)

isMeanValue

public boolean isMeanValue()
Checks if there is a mean measurement. If it exists, the mean measureent itself is always the first measurement stored, and can be retrieved by the method getMeasurement(0);

Returns:
true if a mean measurement exists

getMeasurementFields

public java.lang.String[] getMeasurementFields(int num)
Returns the array of all the individual fields included in the n-th measurement. The fields are defined by their definition in the VotTable object.

Parameters:
num - sequential number of the measurement to retrive
Returns:
an array of strings containing the field values

getMeasurementField

public java.lang.String getMeasurementField(int num,
                                            int fnum)
Gets a measurement field. Defined by the measurement number and the field number

Parameters:
num - Measurement number
fnum - Field number
Returns:
the measurement field data as a string, or null if one of the numbers is out of bounds.

getMeasurementField

public java.lang.String getMeasurementField(int num,
                                            java.lang.String fldname)
Gets a measurement field. Defined by the measurement number and the field name

Parameters:
num - Measurement number
fldname - Name of the field
Returns:
the measurement field data as a string, or null if one of the numbers is out of bounds.

split

public java.lang.String[] split(java.lang.String measurement)
Split a measurement given as parameter in all its fields

Parameters:
measurement - measurement string
Returns:
the array of all the fields

format

public java.lang.String format(java.lang.String[] fields)
Format the field array and return the measurement as a formatted string

Parameters:
fields - array of fields. No validity check is made on the array
Returns:
the formatted measurement string

toXML

public void toXML(VOTable vot)
Outputs all the measurements in XML structure to the given VOTable object.

Parameters:
vot - VOTable object. This object manages the buffer which contains the XML output.