T- generic type of time context compatible to
public interface UnitRule<T>
Represents a rule for the addition or subtraction associated with a time unit.
A unit rule will usually be registered together with an unit for a
TimeAxis, during loading of the concrete
For every time axis and every time unit there is exactly one rule
instance. Implementations must be always immutable.
Adds given amount to a time point in the context of an associated time unit.
This method is called by the
minus()-methods in the class
TimePoint. If not
specified otherwise then a possible range overflow will be
resolved such that the last valid time point is choosen. For
example the addition of one month to date of 31th of may will
yield June, 30th.
timepoint- time point
amount- count of units to be added to
IllegalArgumentException- if boundary constraints are violated
ArithmeticException- in case of numerical overflow
Queries how many units are between given time points.
This method is called by
TimePoint.until(T, U). The
start.until(end, unit) corresponds to
ruleForUnit.between(start, end). Only full units will
be counted. A possible remainder of subtraction will always
Copyright © 2014–2018. All rights reserved.