Class TimeValueImpl

java.lang.Object
de.digitalcollections.model.impl.TimeValueImpl
All Implemented Interfaces:
org.wikidata.wdtk.datamodel.interfaces.TimeValue, org.wikidata.wdtk.datamodel.interfaces.Value

public class TimeValueImpl
extends java.lang.Object
implements org.wikidata.wdtk.datamodel.interfaces.TimeValue
From interface "org.wikidata.wdtk.datamodel.interfaces.TimeValue":

Time values represent points and intervals in time, and additional information about their format. Information includes a specific time point, information about its precision, and the preferred calendar model and timezone (for display). Moreover, time values can describe some uncertainty regarding the exact position in time. This is achieved by tolerance values that specify how much before or after the given time point an event might have occurred.

Time points cannot describe durations (which are quantities), recurring events ("1st of May"), or time spans ( "He reigned from 1697 to 1706, i.e., during every moment of that time span" ). Intervals expressed by times always encode uncertainty ("He died in the year 546 BCE, i.e., in some moment within that interval").

The main time point of the value generally refers to the proleptic Gregorian calendar. However, if dates are imprecise (like "Jan 1512" or even "1200") then one cannot convert this reliably and Wikidata will just keep the value as entered.

"Y0K issue": Neither the Gregorian nor the Julian calendar assume a year 0, i.e., the year 1 BCE was followed by 1 CE in these calendars. See http://en.wikipedia.org/wiki/Year_zero. Wikibase internally uses the year 0. This is the same as ISO-8601, where 1 BCE is represented as "0000". However, note that XML Schema dates (1.0 and 2.0) do not have a year 0, so in their case 1BCE is represented as "-1". Understanding the difference is relevant for computing leap years, for computing temporal intervals, and for exporting data.

Timezone information is to be given in the form of a positive or negative offset with respect to UTC, measured in minutes. This information specifies the timezone that the time should be displayed in when shown to a user. The recorded time point is in UTC, so timezone can be ignored for comparing values. See getTimezoneOffset().

Author:
Markus Kroetzsch
  • Field Summary

    Fields inherited from interface org.wikidata.wdtk.datamodel.interfaces.TimeValue

    CM_GREGORIAN_PRO, CM_JULIAN_PRO, PREC_100KY, PREC_100MY, PREC_100Y, PREC_10KY, PREC_10MY, PREC_1GY, PREC_1KY, PREC_1MY, PREC_DAY, PREC_DECADE, PREC_HOUR, PREC_MINUTE, PREC_MONTH, PREC_SECOND, PREC_YEAR
  • Constructor Summary

    Constructors
    Constructor Description
    TimeValueImpl()  
    TimeValueImpl​(long year)  
    TimeValueImpl​(long year, byte month, byte day)  
    TimeValueImpl​(long year, byte month, byte day, byte hour, byte minute, byte second, byte precision, int beforeTolerance, int afterTolerance, int timezoneOffset, java.lang.String preferredCalendarModel)  
  • Method Summary

    Modifier and Type Method Description
    <T> T accept​(org.wikidata.wdtk.datamodel.interfaces.ValueVisitor<T> valueVisitor)  
    int getAfterTolerance()  
    int getBeforeTolerance()  
    byte getDay()  
    byte getHour()  
    byte getMinute()  
    byte getMonth()  
    byte getPrecision()  
    java.lang.String getPreferredCalendarModel()  
    org.wikidata.wdtk.datamodel.interfaces.ItemIdValue getPreferredCalendarModelItemId()  
    byte getSecond()  
    int getTimezoneOffset()  
    long getYear()  
    void setAfterTolerance​(int afterTolerance)  
    void setBeforeTolerance​(int beforeTolerance)  
    void setDay​(byte day)  
    void setHour​(byte hour)  
    void setMinute​(byte minute)  
    void setMonth​(byte month)  
    void setPrecision​(byte precision)  
    void setPreferredCalendarModel​(java.lang.String preferredCalendarModel)  
    void setSecond​(byte second)  
    void setTimezoneOffset​(int timezoneOffset)  
    void setYear​(long year)  
    org.wikidata.wdtk.datamodel.interfaces.TimeValue toGregorian()  

    Methods inherited from class java.lang.Object

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

    • TimeValueImpl

      public TimeValueImpl()
    • TimeValueImpl

      public TimeValueImpl​(long year, byte month, byte day, byte hour, byte minute, byte second, byte precision, int beforeTolerance, int afterTolerance, int timezoneOffset, java.lang.String preferredCalendarModel)
    • TimeValueImpl

      public TimeValueImpl​(long year)
    • TimeValueImpl

      public TimeValueImpl​(long year, byte month, byte day)
  • Method Details

    • accept

      public <T> T accept​(org.wikidata.wdtk.datamodel.interfaces.ValueVisitor<T> valueVisitor)
      Specified by:
      accept in interface org.wikidata.wdtk.datamodel.interfaces.Value
    • setAfterTolerance

      public void setAfterTolerance​(int afterTolerance)
    • getAfterTolerance

      public int getAfterTolerance()
      Specified by:
      getAfterTolerance in interface org.wikidata.wdtk.datamodel.interfaces.TimeValue
    • setBeforeTolerance

      public void setBeforeTolerance​(int beforeTolerance)
    • getBeforeTolerance

      public int getBeforeTolerance()
      Specified by:
      getBeforeTolerance in interface org.wikidata.wdtk.datamodel.interfaces.TimeValue
    • setPreferredCalendarModel

      public void setPreferredCalendarModel​(java.lang.String preferredCalendarModel)
    • getDay

      public byte getDay()
      Specified by:
      getDay in interface org.wikidata.wdtk.datamodel.interfaces.TimeValue
    • setDay

      public void setDay​(byte day)
    • getHour

      public byte getHour()
      Specified by:
      getHour in interface org.wikidata.wdtk.datamodel.interfaces.TimeValue
    • setHour

      public void setHour​(byte hour)
    • getMinute

      public byte getMinute()
      Specified by:
      getMinute in interface org.wikidata.wdtk.datamodel.interfaces.TimeValue
    • setMinute

      public void setMinute​(byte minute)
    • getMonth

      public byte getMonth()
      Specified by:
      getMonth in interface org.wikidata.wdtk.datamodel.interfaces.TimeValue
    • setMonth

      public void setMonth​(byte month)
    • getPrecision

      public byte getPrecision()
      Specified by:
      getPrecision in interface org.wikidata.wdtk.datamodel.interfaces.TimeValue
    • setPrecision

      public void setPrecision​(byte precision)
    • getPreferredCalendarModel

      public java.lang.String getPreferredCalendarModel()
      Specified by:
      getPreferredCalendarModel in interface org.wikidata.wdtk.datamodel.interfaces.TimeValue
    • getPreferredCalendarModelItemId

      public org.wikidata.wdtk.datamodel.interfaces.ItemIdValue getPreferredCalendarModelItemId()
      Specified by:
      getPreferredCalendarModelItemId in interface org.wikidata.wdtk.datamodel.interfaces.TimeValue
    • getSecond

      public byte getSecond()
      Specified by:
      getSecond in interface org.wikidata.wdtk.datamodel.interfaces.TimeValue
    • setSecond

      public void setSecond​(byte second)
    • setTimezoneOffset

      public void setTimezoneOffset​(int timezoneOffset)
    • getTimezoneOffset

      public int getTimezoneOffset()
      Specified by:
      getTimezoneOffset in interface org.wikidata.wdtk.datamodel.interfaces.TimeValue
    • getYear

      public long getYear()
      Specified by:
      getYear in interface org.wikidata.wdtk.datamodel.interfaces.TimeValue
    • setYear

      public void setYear​(long year)
    • toGregorian

      public org.wikidata.wdtk.datamodel.interfaces.TimeValue toGregorian()
      Specified by:
      toGregorian in interface org.wikidata.wdtk.datamodel.interfaces.TimeValue