Пример #1
0
  /**
   * Helper method to set the end date while parsing a date.
   *
   * @param firstDate The start date. Used as a basis for interpreting relative end dates such as
   *     1934/35.
   * @param endDate The string based representation of a date (number only).
   * @param separator The separator used to split date parts. This may indicate the certainty of the
   *     trailing date as distinct from the entire date, as in 1935 or possibly 36.
   * @param date The <tt>HistoricalDate</tt> object to be updated.
   */
  private void setEndDate(String firstDate, String endDate, String separator, HistoricalDate date) {
    if (endDate == null) {
      date.setEndDate(date.getStartDate());
      return;
    }

    // for dates like 1325/26, adjust the second to be a full four-year date
    if (firstDate.length() > endDate.length()) {
      int offset = firstDate.length() - endDate.length();
      endDate = firstDate.substring(0, offset) + endDate;
    }

    date.setEndDate(date.getStartDate());
    if (separator != null && (separator.indexOf("possibly") > 0)) {
      date.setEndCertainty(Certainty.POSSIBLE);
    }
  }