Package org.aavso.tools.vstar.data.validation

Examples of org.aavso.tools.vstar.data.validation.CommonTextFormatValidator


    assert (ObservationSourceAnalyser.TAB_DELIM.equals(delimiter)
        || ObservationSourceAnalyser.COMMA_DELIM.equals(delimiter) || ObservationSourceAnalyser.SPACE_DELIM
        .equals(delimiter));

    CommonTextFormatValidator validator = null;

    CsvReader lineReader = new CsvReader(obsSource);
    lineReader.setDelimiter(delimiter.charAt(0));

    if (NewStarType.NEW_STAR_FROM_SIMPLE_FILE.equals(newStarType)) {
View Full Code Here


   * @see org.aavso.tools.vstar.input.AbstractObservationRetriever#retrieveObservations()
   */
  public void retrieveObservations() throws ObservationReadError {

    try {
      CommonTextFormatValidator validator = this.analyser
          .getTextFormatValidator(reader);

      int lineNum = 0;

      while (validator.next() && !wasInterrupted()) {
        // Ignore comment, blank line or column header line
        // (e.g. JD,Magnitude,...).
        String line = validator.getRawRecord();
        lineNum++;

        if (!line.startsWith("#") && !line.matches("^\\s*$")
            && !isColumnHeaderLine(line)) {

          try {
            ValidObservation validOb = validator.validate();
            if (validOb != null) {
              addValidObservation(validOb, lineNum);
            }
          } catch (ObservationValidationError e) {
            InvalidObservation invalidOb = new InvalidObservation(
                validator.getRawRecord(), e.getMessage());
            invalidOb.setRecordNumber(lineNum);
            addInvalidObservation(invalidOb);
          } catch (ObservationValidationWarning e) {
            InvalidObservation invalidOb = new InvalidObservation(
                validator.getRawRecord(), e.getMessage(), true);
            invalidOb.setRecordNumber(lineNum);
            addInvalidObservation(invalidOb);

            addValidObservation(e.getObservation(), lineNum);
          }
View Full Code Here

TOP

Related Classes of org.aavso.tools.vstar.data.validation.CommonTextFormatValidator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.