Class TimeValue
- java.lang.Object
-
- de.digitalcollections.model.time.TimeValue
-
- All Implemented Interfaces:
org.wikidata.wdtk.datamodel.interfaces.TimeValue,org.wikidata.wdtk.datamodel.interfaces.Value
public class TimeValue extends 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
beforeorafterthe 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
-
-
Constructor Summary
Constructors Constructor Description TimeValue()TimeValue(long year)TimeValue(long year, byte month, byte day)TimeValue(long year, byte month, byte day, byte hour, byte minute, byte second, byte precision, int beforeTolerance, int afterTolerance, int timezoneOffset, String preferredCalendarModel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Taccept(org.wikidata.wdtk.datamodel.interfaces.ValueVisitor<T> valueVisitor)intgetAfterTolerance()intgetBeforeTolerance()bytegetDay()bytegetHour()bytegetMinute()bytegetMonth()bytegetPrecision()StringgetPreferredCalendarModel()org.wikidata.wdtk.datamodel.interfaces.ItemIdValuegetPreferredCalendarModelItemId()bytegetSecond()intgetTimezoneOffset()longgetYear()voidsetAfterTolerance(int afterTolerance)voidsetBeforeTolerance(int beforeTolerance)voidsetDay(byte day)voidsetHour(byte hour)voidsetMinute(byte minute)voidsetMonth(byte month)voidsetPrecision(byte precision)voidsetPreferredCalendarModel(String preferredCalendarModel)voidsetSecond(byte second)voidsetTimezoneOffset(int timezoneOffset)voidsetYear(long year)TimeValuetoGregorian()
-
-
-
Constructor Detail
-
TimeValue
public TimeValue()
-
TimeValue
public TimeValue(long year, byte month, byte day, byte hour, byte minute, byte second, byte precision, int beforeTolerance, int afterTolerance, int timezoneOffset, String preferredCalendarModel)
-
TimeValue
public TimeValue(long year)
-
TimeValue
public TimeValue(long year, byte month, byte day)
-
-
Method Detail
-
accept
public <T> T accept(org.wikidata.wdtk.datamodel.interfaces.ValueVisitor<T> valueVisitor)
- Specified by:
acceptin interfaceorg.wikidata.wdtk.datamodel.interfaces.Value
-
getAfterTolerance
public int getAfterTolerance()
- Specified by:
getAfterTolerancein interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getBeforeTolerance
public int getBeforeTolerance()
- Specified by:
getBeforeTolerancein interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getDay
public byte getDay()
- Specified by:
getDayin interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getHour
public byte getHour()
- Specified by:
getHourin interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getMinute
public byte getMinute()
- Specified by:
getMinutein interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getMonth
public byte getMonth()
- Specified by:
getMonthin interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getPrecision
public byte getPrecision()
- Specified by:
getPrecisionin interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getPreferredCalendarModel
public String getPreferredCalendarModel()
- Specified by:
getPreferredCalendarModelin interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getPreferredCalendarModelItemId
public org.wikidata.wdtk.datamodel.interfaces.ItemIdValue getPreferredCalendarModelItemId()
- Specified by:
getPreferredCalendarModelItemIdin interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getSecond
public byte getSecond()
- Specified by:
getSecondin interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getTimezoneOffset
public int getTimezoneOffset()
- Specified by:
getTimezoneOffsetin interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getYear
public long getYear()
- Specified by:
getYearin interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
setAfterTolerance
public void setAfterTolerance(int afterTolerance)
-
setBeforeTolerance
public void setBeforeTolerance(int beforeTolerance)
-
setDay
public void setDay(byte day)
-
setHour
public void setHour(byte hour)
-
setMinute
public void setMinute(byte minute)
-
setMonth
public void setMonth(byte month)
-
setPrecision
public void setPrecision(byte precision)
-
setPreferredCalendarModel
public void setPreferredCalendarModel(String preferredCalendarModel)
-
setSecond
public void setSecond(byte second)
-
setTimezoneOffset
public void setTimezoneOffset(int timezoneOffset)
-
setYear
public void setYear(long year)
-
toGregorian
public TimeValue toGregorian()
- Specified by:
toGregorianin interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
-