U - generic type of time unitT - generic type of time contextpublic static final class TimeAxis.Builder<U,T extends TimePoint<U,T>> extends Chronology.Builder<T>
Creates a builder for a new time axis respective chronology
and will only be used during loading a class of type
TimePoint (T) in a static initializer.
Instances of this class will be created by the static factory
methods setUp().
setUp(Class,Class,ChronoMerger,TimePoint,TimePoint),
setUp(Class,Class,ChronoMerger,CalendarSystem)| Modifier and Type | Method and Description |
|---|---|
<V> TimeAxis.Builder<U,T> |
appendElement(ChronoElement<V> element,
ElementRule<T,V> rule)
Registers a new element together with its associated
element rule.
|
<V> TimeAxis.Builder<U,T> |
appendElement(ChronoElement<V> element,
ElementRule<T,V> rule,
U baseUnit)
Registers a new element with associated rule and a base
unit.
|
TimeAxis.Builder<U,T> |
appendExtension(ChronoExtension extension)
Registers a state extension which can create models with their
own state separated from standard time value context.
|
TimeAxis.Builder<U,T> |
appendUnit(U unit,
UnitRule<T> rule,
double length)
Registers a non-convertible time unit with an associated
unit rule.
|
TimeAxis.Builder<U,T> |
appendUnit(U unit,
UnitRule<T> rule,
double length,
Set<? extends U> convertibleUnits)
Registers a new time unit with an associated unit rule.
|
TimeAxis<U,T> |
build()
Creates and registers a time axis.
|
static <U,D extends Calendrical<U,D>> |
setUp(Class<U> unitType,
Class<D> chronoType,
ChronoMerger<D> merger,
CalendarSystem<D> calendarSystem)
Creates a builder for building a time axis for
plain calendrical objects.
|
static <U,T extends TimePoint<U,T>> |
setUp(Class<U> unitType,
Class<T> chronoType,
ChronoMerger<T> merger,
T min,
T max)
Creates a builder for building a chronological but
non-calendrical system.
|
TimeAxis.Builder<U,T> |
withTimeLine(TimeLine<T> timeline)
Defines the argument as timeline to be used for stepping
forward or backwards.
|
setUppublic static <U,T extends TimePoint<U,T>> TimeAxis.Builder<U,T> setUp(Class<U> unitType, Class<T> chronoType, ChronoMerger<T> merger, T min, T max)
Creates a builder for building a chronological but non-calendrical system.
U - generic type of time unitT - generic type of time contextunitType - reified type of time unitschronoType - reified chronological typemerger - generic replacement for static
creation of time pointsmin - minimum value on time axismax - maximum value on time axisBuilder objectpublic static <U,D extends Calendrical<U,D>> TimeAxis.Builder<U,D> setUp(Class<U> unitType, Class<D> chronoType, ChronoMerger<D> merger, CalendarSystem<D> calendarSystem)
Creates a builder for building a time axis for plain calendrical objects.
U - generic type of time unitD - generic type of date contextunitType - reified type of time unitschronoType - reified chronological typemerger - generic replacement for static
creation of time pointscalendarSystem - calender systemBuilder objectpublic <V> TimeAxis.Builder<U,T> appendElement(ChronoElement<V> element, ElementRule<T,V> rule)
Chronology.BuilderRegisters a new element together with its associated element rule.
appendElement in class Chronology.Builder<T extends TimePoint<U,T>>V - generic type of element valueelement - chronological element to be registeredrule - rule associated with the elementpublic <V> TimeAxis.Builder<U,T> appendElement(ChronoElement<V> element, ElementRule<T,V> rule, U baseUnit)
Registers a new element with associated rule and a base unit.
V - generic type of element valueselement - chronological element to be registeredrule - associated element rulebaseUnit - base unit for rolling operationsIllegalArgumentException - if given element is already
registered (duplicate)public TimeAxis.Builder<U,T> appendUnit(U unit, UnitRule<T> rule, double length)
Registers a non-convertible time unit with an associated unit rule.
Is equivalent to appendUnit(U, rule, length, Collections.emptySet()).
unit - time unit to be registeredrule - associated unit rulelength - estimated standard length in secondsIllegalArgumentException - if given time unit is already
registered (duplicate) or if given length does not represent
any decimal numberpublic TimeAxis.Builder<U,T> appendUnit(U unit, UnitRule<T> rule, double length, Set<? extends U> convertibleUnits)
Registers a new time unit with an associated unit rule.
The unit rule defines the time arithmetic for addition and subtraction of given unit suitable for the time axis.
If the unit has a length of a whole day then the given length
must be equal to 86400.0. The time unit of a second has
always the length 1.0.
The default length of a time unit primarily serves for
conversion purposes. Rare anomalies like leap seconds or
timezone-induced jumps are not taken into account. Therefore
this estimated length is usually not equal to the real length
in a given time context. In case of non-convertible units the
estimated length has only informational meaning. Example: Months
have as length in ISO-systems the length of a gregorian year
in seconds divided by 12 while in coptic calendar the
divisor 13 is used. However, the definition of the length
of a month in days is not suitable because months and days are
not convertible.
Convertibility exists if a time unit con be converted to
another time unit using a fixed integer factor. If this is not
always the case then an empty Set is to be used. Example
minutes/seconds: Without an UTC-context (with possible leapseonds)
minutes are convertible to seconds using a constant factor of
60. In an UTC-context however, there is no convertibility
and hence the second will be missing in the argument.
convertibleUnits to minutes as unit to be registered
(and reverse, too)..
unit - time unit to be registeredrule - associated unit rulelength - estimated standard length in secondsconvertibleUnits - other time units which unit
can be converted toIllegalArgumentException - if given time unit is already
registered (duplicate) or if given length does not represent
any decimal numberpublic TimeAxis.Builder<U,T> appendExtension(ChronoExtension extension)
Chronology.BuilderRegisters a state extension which can create models with their own state separated from standard time value context.
appendExtension in class Chronology.Builder<T extends TimePoint<U,T>>extension - chronological extensionpublic TimeAxis.Builder<U,T> withTimeLine(TimeLine<T> timeline)
Defines the argument as timeline to be used for stepping forward or backwards.
timeline - time line to be usedpublic TimeAxis<U,T> build()
Creates and registers a time axis.
build in class Chronology.Builder<T extends TimePoint<U,T>>IllegalStateException - if already registered or in
case of inconsistenciesChronology.lookup(Class)Copyright © 2014–2015. All rights reserved.