Method Calendar.TimeRanges.TimeRange()->`-()


Method `+
Method `-

TimeRange res = Calendar.TimeRanges.TimeRange() + n
TimeRange res = Calendar.TimeRanges.TimeRange() + offset
TimeRange res = Calendar.TimeRanges.TimeRange() - m
TimeRange res = Calendar.TimeRanges.TimeRange() - x

Description

This calculates the (promoted) time period either n step away or with a given offset. These functions does use add to really do the job:

t+n         t->add(n)             t is a time period
t-n         t->add(-n)            offset is a time period
t+offset    t->add(1,offset)      n is an integer
t-offset    t->add(-1,offset)
n+t         t->add(n)
n-t         illegal
offset+t    offset->add(1,t)      | note this!
offset-t    offset->add(-1,t)     |

Mathematic rules:

x+(t-x) == t    x is an integer or a time period
(x+t)-x == t    t is a time period
(t+x)-x == t
o-(o-t) == t    o is a time period
t++ == t+1
t-- == t-1

Note

a-b does not give the distance between the start of a and b. Use the distance() function to calculate that.

The integer used to `+, `- and add are the number of steps the motion will be. It does never represent any fixed amount of time, like seconds or days.