By: Diego Coronel, Roland Tepp
Subpackages
ceylon.time.internal.math
Functions
gapSource Codeshared [Value, Value]|[] gap<Value>([Value, Value] first, [Value, Value] second)
given Value satisfies Comparable<Value> & Enumerable<Value>

Returns a tuple representing an exclusive gap between two disjoint ranges of ordinal values.

Values in the tuple are returned always in their natural order regardless of their original ordering in the input tuples. If input ranges are overlapping, this function will return an empty value.

Examples:

assert(gap([1, 2], [5, 6]) == [3, 4]);
assert(gap([6, 5], [1, 2]) == [3, 4]);
assert(is Empty g = gap([1, 3], [2, 4]));
gregorianDateSource Codeshared Date gregorianDate(Integer year, Integer|Month month, Integer day)

Returns a gregorian calendar date according to the specified year, month and date values.

Parameters:
  • year

    Year number of the date

  • month

    Month of the year

  • day

    Day of month

intersectSource Codeshared Boolean intersect<Value>(Value start, Value end, Value otherStart, Value otherEnd)
given Value satisfies Comparable<Value>

Returns if two ranges has intersection.

overlapSource Codeshared [Value, Value]|[] overlap<Value>([Value, Value] first, [Value, Value] second)
given Value satisfies Enumerable<Value> & Comparable<Value>

Returns the inclusive overlap between two ordinal ranges.

The range of the overlap will be returned in the natural order of the values regardless of their original order in input tuples.

Examples:

assert(overlap([1, 3], [2, 4]) == [2, 3]);
assert(overlap([4, 2], [1, 3]) == [2, 3]);
assert(is Empty o = overlap([1, 2], [3, 4]));
Classes
AbstractDateSource Codeshared abstract AbstractDate

Common behaviors for Date types.

GregorianDateSource Codeshared GregorianDate

Default implementation of a gregorian calendar

GregorianDateTimeSource Codeshared GregorianDateTime

Default implementation of a gregorian calendar

GregorianZonedDateTimeSource Codeshared GregorianZonedDateTime

Default implementation of gregorian calendar thats makes use of a TimeZone for it´s operations.

This means that making some operations like plusDays takes into account the result Instant generated to reapply all the rules of the current TimeZone.

TimeOfDaySource Codeshared TimeOfDay

Basic implementation of Time interface, representing an abstract time of day such as 10am or 3.20pm with a precision of milliseconds.