Class AAVSODownloadFormatValidator
java.lang.Object
org.aavso.tools.vstar.data.validation.CommonTextFormatValidator
org.aavso.tools.vstar.data.validation.AAVSODownloadFormatValidator
This class accepts a line of text for tokenising, validation, and
ValidObservation instance creation given an AAVSO Download text format
source:
JD(0), MAGNITUDE(1), UNCERTAINTY(2), HQ_UNCERTAINTY(3), BAND(4),
OBSERVER_CODE(5), COMMENT_CODE(6), COMP_STAR_1(7), COMP_STAR_2(8), CHARTS(9),
COMMENTS(10), TRANSFORMED(11), AIRMASS(12), VALFLAG(13), CMAG(14), KMAG(15),
HJD(16), NAME(17), MTYPE(18)
REQ_VSTAR_AAVSO_DATA_DOWNLOAD_FILE_READ
From Doc, Dec 22 2009: "OK, the data download has been changed so that the
end of it is now Star Name, affiliation, mtype, group. I'll get the wiki page
changed." and "Affiliation is a tinyint(4) right now. It's not greatly
populated yet. Once it is I may make it an ASCII representation in the data
download. Group is a varchar(5) and has to do with filter wheels."
-
Field Summary
Fields inherited from class org.aavso.tools.vstar.data.validation.CommonTextFormatValidator
COMMON_VALFLAG_PATTERN, fieldIndexMap, fields, fieldSplitter, julianDayValidator, lineReader, magnitudeFieldValidator, observerCodeValidator, uncertaintyValueValidator, valflagValidator -
Constructor Summary
ConstructorsConstructorDescriptionAAVSODownloadFormatValidator(com.csvreader.CsvReader lineReader, int minFields, int maxFields, IFieldInfoSource fieldInfoSource) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvalidate()Validate an observation line and either return a ValidObservation instance, or throw an exception indicating the error.Methods inherited from class org.aavso.tools.vstar.data.validation.CommonTextFormatValidator
getRawRecord, next
-
Constructor Details
-
AAVSODownloadFormatValidator
public AAVSODownloadFormatValidator(com.csvreader.CsvReader lineReader, int minFields, int maxFields, IFieldInfoSource fieldInfoSource) throws IOException Constructor.- Parameters:
lineReader- The CsvReader that will be used to return fields, created with the appropriate delimiter and data source.minFields- The minimum number of fields permitted in an observation line.maxFields- The maximum number of fields permitted in an observation line.fieldInfoSource- A mapping from field name to field index that makes sense for the source.- Throws:
IOException
-
-
Method Details
-
validate
public ValidObservation validate() throws IOException, ObservationValidationError, ObservationValidationWarningValidate an observation line and either return a ValidObservation instance, or throw an exception indicating the error. Given that the AAVSO download format should contain observations that have been scrutinised by AAVSO staff, field validation should in principle be unnecessary, but it cannot be harmful either. Some fields below are unvalidated (or sometimes just checked for optionality) however for the reason just stated.- Overrides:
validatein classCommonTextFormatValidator- Returns:
- The validated ValidObservation object.
- Throws:
IOExceptionObservationValidationErrorObservationValidationWarning
-