edu.stanford.nlp.time
Class JodaTimeUtils

java.lang.Object
  extended by edu.stanford.nlp.time.JodaTimeUtils

public class JodaTimeUtils
extends java.lang.Object

Extensions to joda time

Author:
Angel Chang, Gabor Angeli

Nested Class Summary
static class JodaTimeUtils.ConversionOptions
           
 
Field Summary
static org.joda.time.DurationFieldType Centuries
           
static org.joda.time.DateTimeFieldType DecadeOfCentury
           
static org.joda.time.DurationFieldType Decades
           
static org.joda.time.Partial EMPTY_ISO_DATE_PARTIAL
           
static org.joda.time.Partial EMPTY_ISO_PARTIAL
           
static org.joda.time.Partial EMPTY_ISO_TIME_PARTIAL
           
static org.joda.time.Partial EMPTY_ISO_WEEK_PARTIAL
           
static org.joda.time.DateTimeFieldType HalfYearOfYear
           
static org.joda.time.DurationFieldType HalfYears
           
static org.joda.time.Instant INSTANT_ZERO
           
static org.joda.time.Chronology isoUTCChronology
           
static org.joda.time.DateTimeFieldType MonthOfHalfYear
           
static org.joda.time.DateTimeFieldType MonthOfQuarter
           
static org.joda.time.DateTimeFieldType QuarterOfYear
           
static org.joda.time.DurationFieldType Quarters
           
static org.joda.time.DateTimeFieldType[] standardISODateFields
           
static org.joda.time.DateTimeFieldType[] standardISOFields
           
static org.joda.time.DateTimeFieldType[] standardISOTimeFields
           
static org.joda.time.DateTimeFieldType[] standardISOWeekFields
           
static org.joda.time.DateTimeFieldType WeekOfMonth
           
static org.joda.time.DateTimeFieldType YearOfDecade
           
 
Method Summary
static org.joda.time.Partial addForce(org.joda.time.Partial p, org.joda.time.Period d, int scalar)
           
static org.joda.time.Partial combine(org.joda.time.Partial p1, org.joda.time.Partial p2)
           
static org.joda.time.Partial combineMoreGeneralFields(org.joda.time.Partial p1, org.joda.time.Partial p2)
           
static org.joda.time.Partial combineMoreGeneralFields(org.joda.time.Partial p1, org.joda.time.Partial p2, org.joda.time.DateTimeFieldType mgf)
           
static org.joda.time.Partial discardMoreSpecificFields(org.joda.time.Partial p, org.joda.time.DateTimeFieldType d)
           
static org.joda.time.Partial discardMoreSpecificFields(org.joda.time.Partial p, org.joda.time.DurationFieldType dft)
           
static org.joda.time.Period discardMoreSpecificFields(org.joda.time.Period p, org.joda.time.DurationFieldType dft, org.joda.time.Chronology chronology)
           
static org.joda.time.Instant getInstant(org.joda.time.Partial p)
           
protected static org.joda.time.Period getJodaTimePeriod(org.joda.time.Partial p)
           
protected static org.joda.time.DateTimeFieldType getMostGeneral(org.joda.time.Partial p)
           
protected static org.joda.time.DurationFieldType getMostGeneral(org.joda.time.Period p)
           
protected static org.joda.time.DateTimeFieldType getMostSpecific(org.joda.time.Partial p)
           
protected static org.joda.time.DurationFieldType getMostSpecific(org.joda.time.Period p)
           
static org.joda.time.Partial getPartial(org.joda.time.Instant t, org.joda.time.Partial p)
           
static java.util.Set<org.joda.time.DurationFieldType> getSupportedDurationFields(org.joda.time.Partial p)
           
static org.joda.time.Period getUnsupportedDurationPeriod(org.joda.time.Partial p, org.joda.time.Period offset)
           
protected static boolean hasField(org.joda.time.ReadablePartial base, org.joda.time.DateTimeFieldType field)
           
protected static boolean hasField(org.joda.time.ReadablePeriod base, org.joda.time.DurationFieldType field)
           
static boolean isCompatible(org.joda.time.Partial p1, org.joda.time.Partial p2)
           
static boolean isMoreGeneral(org.joda.time.DateTimeFieldType df1, org.joda.time.DateTimeFieldType df2, org.joda.time.Chronology chronology)
           
static boolean isMoreSpecific(org.joda.time.DateTimeFieldType df1, org.joda.time.DateTimeFieldType df2, org.joda.time.Chronology chronology)
           
static int maximumValue(org.joda.time.DateTimeFieldType type, org.joda.time.ReadableDateTime reference)
          Return the maximum value of a field, closest to the reference time
static int minimumValue(org.joda.time.DateTimeFieldType type, org.joda.time.ReadableDateTime reference)
          Return the minimum value of a field, closest to the reference time
static org.joda.time.Partial padMoreSpecificFields(org.joda.time.Partial p, org.joda.time.Period granularity)
           
static org.joda.time.Partial resolveDowToDay(org.joda.time.Partial p)
           
static org.joda.time.Partial resolveDowToDay(org.joda.time.Partial p1, org.joda.time.Partial p2)
           
static org.joda.time.Partial resolveWeek(org.joda.time.Partial p1, org.joda.time.Partial p2)
           
protected static org.joda.time.Partial setField(org.joda.time.Partial base, org.joda.time.DateTimeFieldType field, int value)
           
static java.lang.String timexDateValue(org.joda.time.ReadableDateTime begin, org.joda.time.ReadableDateTime end)
           
static java.lang.String timexDateValue(org.joda.time.ReadableDateTime begin, org.joda.time.ReadableDateTime end, JodaTimeUtils.ConversionOptions opts)
          Return the TIMEX string for the range of dates given.
static java.lang.String timexDurationValue(org.joda.time.ReadableDateTime begin, org.joda.time.ReadableDateTime end)
          Return the TIMEX string for the difference between two dates TODO not really sure if this works...
static java.lang.String timexDurationValue(org.joda.time.ReadablePeriod duration)
           
static java.lang.String timexDurationValue(org.joda.time.ReadablePeriod duration, JodaTimeUtils.ConversionOptions opts)
          Return the TIMEX string for the duration represented by the given period; approximately if approximate is set to true.
static java.lang.String timexTimeValue(org.joda.time.ReadableDateTime time)
          Return the TIMEX string for the time given
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isoUTCChronology

public static final org.joda.time.Chronology isoUTCChronology

standardISOFields

public static final org.joda.time.DateTimeFieldType[] standardISOFields

standardISOWeekFields

public static final org.joda.time.DateTimeFieldType[] standardISOWeekFields

standardISODateFields

public static final org.joda.time.DateTimeFieldType[] standardISODateFields

standardISOTimeFields

public static final org.joda.time.DateTimeFieldType[] standardISOTimeFields

EMPTY_ISO_PARTIAL

public static final org.joda.time.Partial EMPTY_ISO_PARTIAL

EMPTY_ISO_WEEK_PARTIAL

public static final org.joda.time.Partial EMPTY_ISO_WEEK_PARTIAL

EMPTY_ISO_DATE_PARTIAL

public static final org.joda.time.Partial EMPTY_ISO_DATE_PARTIAL

EMPTY_ISO_TIME_PARTIAL

public static final org.joda.time.Partial EMPTY_ISO_TIME_PARTIAL

INSTANT_ZERO

public static final org.joda.time.Instant INSTANT_ZERO

Quarters

public static final org.joda.time.DurationFieldType Quarters

HalfYears

public static final org.joda.time.DurationFieldType HalfYears

Decades

public static final org.joda.time.DurationFieldType Decades

Centuries

public static final org.joda.time.DurationFieldType Centuries

QuarterOfYear

public static final org.joda.time.DateTimeFieldType QuarterOfYear

HalfYearOfYear

public static final org.joda.time.DateTimeFieldType HalfYearOfYear

MonthOfQuarter

public static final org.joda.time.DateTimeFieldType MonthOfQuarter

MonthOfHalfYear

public static final org.joda.time.DateTimeFieldType MonthOfHalfYear

WeekOfMonth

public static final org.joda.time.DateTimeFieldType WeekOfMonth

DecadeOfCentury

public static final org.joda.time.DateTimeFieldType DecadeOfCentury

YearOfDecade

public static final org.joda.time.DateTimeFieldType YearOfDecade
Method Detail

hasField

protected static boolean hasField(org.joda.time.ReadablePartial base,
                                  org.joda.time.DateTimeFieldType field)

hasField

protected static boolean hasField(org.joda.time.ReadablePeriod base,
                                  org.joda.time.DurationFieldType field)

setField

protected static org.joda.time.Partial setField(org.joda.time.Partial base,
                                                org.joda.time.DateTimeFieldType field,
                                                int value)

getSupportedDurationFields

public static java.util.Set<org.joda.time.DurationFieldType> getSupportedDurationFields(org.joda.time.Partial p)

getUnsupportedDurationPeriod

public static org.joda.time.Period getUnsupportedDurationPeriod(org.joda.time.Partial p,
                                                                org.joda.time.Period offset)

combine

public static org.joda.time.Partial combine(org.joda.time.Partial p1,
                                            org.joda.time.Partial p2)

getMostGeneral

protected static org.joda.time.DateTimeFieldType getMostGeneral(org.joda.time.Partial p)

getMostSpecific

protected static org.joda.time.DateTimeFieldType getMostSpecific(org.joda.time.Partial p)

getMostGeneral

protected static org.joda.time.DurationFieldType getMostGeneral(org.joda.time.Period p)

getMostSpecific

protected static org.joda.time.DurationFieldType getMostSpecific(org.joda.time.Period p)

getJodaTimePeriod

protected static org.joda.time.Period getJodaTimePeriod(org.joda.time.Partial p)

combineMoreGeneralFields

public static org.joda.time.Partial combineMoreGeneralFields(org.joda.time.Partial p1,
                                                             org.joda.time.Partial p2)

combineMoreGeneralFields

public static org.joda.time.Partial combineMoreGeneralFields(org.joda.time.Partial p1,
                                                             org.joda.time.Partial p2,
                                                             org.joda.time.DateTimeFieldType mgf)

discardMoreSpecificFields

public static org.joda.time.Partial discardMoreSpecificFields(org.joda.time.Partial p,
                                                              org.joda.time.DateTimeFieldType d)

discardMoreSpecificFields

public static org.joda.time.Partial discardMoreSpecificFields(org.joda.time.Partial p,
                                                              org.joda.time.DurationFieldType dft)

discardMoreSpecificFields

public static org.joda.time.Period discardMoreSpecificFields(org.joda.time.Period p,
                                                             org.joda.time.DurationFieldType dft,
                                                             org.joda.time.Chronology chronology)

padMoreSpecificFields

public static org.joda.time.Partial padMoreSpecificFields(org.joda.time.Partial p,
                                                          org.joda.time.Period granularity)

isCompatible

public static boolean isCompatible(org.joda.time.Partial p1,
                                   org.joda.time.Partial p2)

resolveDowToDay

public static org.joda.time.Partial resolveDowToDay(org.joda.time.Partial p1,
                                                    org.joda.time.Partial p2)

resolveDowToDay

public static org.joda.time.Partial resolveDowToDay(org.joda.time.Partial p)

resolveWeek

public static org.joda.time.Partial resolveWeek(org.joda.time.Partial p1,
                                                org.joda.time.Partial p2)

getInstant

public static org.joda.time.Instant getInstant(org.joda.time.Partial p)

getPartial

public static org.joda.time.Partial getPartial(org.joda.time.Instant t,
                                               org.joda.time.Partial p)

addForce

public static org.joda.time.Partial addForce(org.joda.time.Partial p,
                                             org.joda.time.Period d,
                                             int scalar)

isMoreGeneral

public static boolean isMoreGeneral(org.joda.time.DateTimeFieldType df1,
                                    org.joda.time.DateTimeFieldType df2,
                                    org.joda.time.Chronology chronology)

isMoreSpecific

public static boolean isMoreSpecific(org.joda.time.DateTimeFieldType df1,
                                     org.joda.time.DateTimeFieldType df2,
                                     org.joda.time.Chronology chronology)

minimumValue

public static int minimumValue(org.joda.time.DateTimeFieldType type,
                               org.joda.time.ReadableDateTime reference)
Return the minimum value of a field, closest to the reference time


maximumValue

public static int maximumValue(org.joda.time.DateTimeFieldType type,
                               org.joda.time.ReadableDateTime reference)
Return the maximum value of a field, closest to the reference time


timexTimeValue

public static java.lang.String timexTimeValue(org.joda.time.ReadableDateTime time)
Return the TIMEX string for the time given


timexDateValue

public static java.lang.String timexDateValue(org.joda.time.ReadableDateTime begin,
                                              org.joda.time.ReadableDateTime end)

timexDateValue

public static java.lang.String timexDateValue(org.joda.time.ReadableDateTime begin,
                                              org.joda.time.ReadableDateTime end,
                                              JodaTimeUtils.ConversionOptions opts)
Return the TIMEX string for the range of dates given. For example, (2011-12-3:00:00,000 to 2011-12-4:00:00.000) would give 2011-12-3.

Parameters:
begin - The begin time for the timex
end - The end time for the timex
opts - Tweaks in the heuristic conversion
Returns:
The string representation of a DATE type Timex3 expression

timexDurationValue

public static java.lang.String timexDurationValue(org.joda.time.ReadablePeriod duration,
                                                  JodaTimeUtils.ConversionOptions opts)
Return the TIMEX string for the duration represented by the given period; approximately if approximate is set to true.

Parameters:
duration - The JodaTime period representing this duration
opts - Options for the conversion (e.g., mark duration as approximates)
Returns:
The string representation of a DURATION type Timex3 expression

timexDurationValue

public static java.lang.String timexDurationValue(org.joda.time.ReadablePeriod duration)

timexDurationValue

public static java.lang.String timexDurationValue(org.joda.time.ReadableDateTime begin,
                                                  org.joda.time.ReadableDateTime end)
Return the TIMEX string for the difference between two dates TODO not really sure if this works...



Stanford NLP Group