Class YearGuesser


  • public class YearGuesser
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      YearGuesser()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.time.LocalDateTime guessYearForDate​(java.time.LocalDateTime dateWithoutYear)  
      static java.time.LocalDateTime guessYearForDate​(java.time.LocalDateTime dateWithoutYear, java.time.LocalDateTime referenceDateTime)
      We try to guess the missing year for the given dateWithoutYear by assigning the year which brings the dateWithoutYear closest (smallest time gap) to the referenceDateTime.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • YearGuesser

        public YearGuesser()
    • Method Detail

      • guessYearForDate

        public static java.time.LocalDateTime guessYearForDate​(java.time.LocalDateTime dateWithoutYear,
                                                               java.time.LocalDateTime referenceDateTime)
        We try to guess the missing year for the given dateWithoutYear by assigning the year which brings the dateWithoutYear closest (smallest time gap) to the referenceDateTime. Assumptions: - dateTime and referenceDateTime have the same time zone. - dateTime.getYear() == 0 || dateTime.getYear() == 1970, otherwise we won't do anything
        Returns:
        the LocalDateTime with the best guessed year
      • guessYearForDate

        public static java.time.LocalDateTime guessYearForDate​(java.time.LocalDateTime dateWithoutYear)