Class CalendarDate
java.lang.Object
org.ojalgo.type.CalendarDate
- All Implemented Interfaces:
Comparable<CalendarDate>, Temporal, TemporalAccessor
Originally, long before Java 8 and its new Date and Time API, this class was designed to provide an immutable complement to the existing Date and Calendar classes and to have easy/direct access to the underlying epoch millisecond value.
In terms of the newer API it most closely corresponds to an Instant, but does not have its nanosecond granularity. At one point the plan was to remove and replace this class with Instant, but working with a single long as an "instant" representation is very practical and efficient.
It has been retrofitted to implement the Temporal interface.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal longAn "instant" with ms precision.(package private) static final long(package private) static final int(package private) static final int(package private) static final long -
Constructor Summary
ConstructorsConstructorDescriptionCalendarDate(long timeInMillis) CalendarDate(String sqlString) CalendarDate(Calendar calendar) CalendarDate(Date date) -
Method Summary
Modifier and TypeMethodDescriptionadjustInto(Calendar temporal) adjustInto(Date temporal) <T extends Temporal>
TadjustInto(T temporal) intcompareTo(CalendarDate ref) booleanfilter(CalendarDateUnit resolution) static CalendarDatefrom(TemporalAccessor temporal) longgetLong(TemporalField field) inthashCode()booleanisSupported(TemporalField field) booleanisSupported(TemporalUnit unit) static CalendarDatemake(long timeInMIllis, CalendarDate.Resolution resolution) static CalendarDatemake(Calendar calendar, CalendarDate.Resolution resolution) static CalendarDatemake(Date date, CalendarDate.Resolution resolution) static CalendarDatemake(CalendarDate.Resolution resolution) (package private) static longmillis(TemporalAccessor temporal) static CalendarDatenow()plus(long amountToAdd, TemporalUnit unit) step(int aStepCount, CalendarDateUnit aStepUnit) step(CalendarDateDuration aStepDuration) Only steps with the int part of CalendarDateDuration.measure .step(CalendarDateUnit aStepUnit) static CalendartoCalendar(Instant instant) static CalendartoCalendar(Instant instant, Locale locale) static CalendartoCalendar(Instant instant, TimeZone zone) static CalendartoCalendar(Instant instant, TimeZone zone, Locale locale) toCalendar(Locale locale) toCalendar(TimeZone zone) toCalendar(TimeZone zone, Locale locale) toDate()static Datestatic LocalDatetoLocalDate(Instant instant, ZoneId zone) toLocalDate(ZoneOffset offset) static LocalDatetoLocalDate(Calendar calendar) static LocalDateTimetoLocalDateTime(Instant instant, ZoneId zone) toLocalDateTime(ZoneOffset offset) static LocalTimetoLocalTime(Instant instant, ZoneId zone) toLocalTime(ZoneOffset offset) static OffsetDateTimetoOffsetDateTime(Instant instant, ZoneId zone) static OffsetDateTimetoOffsetDateTime(Instant instant, ZoneId zone, Instant zoneToOffsetConversionInstant) static OffsetDateTimetoOffsetDateTime(Instant instant, ZoneOffset offset) toOffsetDateTime(ZoneOffset offset) toString()static ZonedDateTimetoZonedDateTime(Instant instant, ZoneId zone) toZonedDateTime(ZoneOffset offset) longuntil(Temporal endExclusive, TemporalUnit unit) static CalendarDatestatic CalendarDatevalueOf(OffsetDateTime offsetDateTime) static CalendarDatevalueOf(ZonedDateTime zonedDateTime) with(TemporalAdjuster adjuster) with(TemporalField field, long newValue) Methods inherited from interface TemporalAccessor
get, query, range
-
Field Details
-
MILLIS_PER_SECOND
static final long MILLIS_PER_SECOND- See Also:
-
NANOS_PER_MILLIS
static final int NANOS_PER_MILLIS- See Also:
-
NANOS_PER_SECOND
static final int NANOS_PER_SECOND- See Also:
-
SECONDS_PER_DAY
static final long SECONDS_PER_DAY- See Also:
-
millis
public final long millisAn "instant" with ms precision. Equivalent to what is returned byInstant.toEpochMilli()and/orSystem.currentTimeMillis().
-
-
Constructor Details
-
CalendarDate
public CalendarDate() -
CalendarDate
-
CalendarDate
-
CalendarDate
public CalendarDate(long timeInMillis) -
CalendarDate
- Parameters:
sqlString- The String to parse- Throws:
RecoverableCondition- When(if parsing the String fails
-
-
Method Details
-
from
-
make
-
make
-
make
-
make
-
now
-
toCalendar
-
toCalendar
-
toCalendar
-
toCalendar
-
toDate
-
toLocalDate
-
toLocalDate
-
toLocalDateTime
-
toLocalTime
-
toOffsetDateTime
-
toOffsetDateTime
public static OffsetDateTime toOffsetDateTime(Instant instant, ZoneId zone, Instant zoneToOffsetConversionInstant) -
toOffsetDateTime
-
toZonedDateTime
-
valueOf
-
valueOf
-
valueOf
-
millis
-
adjustInto
-
adjustInto
-
adjustInto
-
compareTo
- Specified by:
compareToin interfaceComparable<CalendarDate>
-
equals
-
filter
-
getLong
- Specified by:
getLongin interfaceTemporalAccessor
-
hashCode
-
isSupported
- Specified by:
isSupportedin interfaceTemporalAccessor
-
isSupported
- Specified by:
isSupportedin interfaceTemporal
-
plus
-
step
Only steps with the int part of CalendarDateDuration.measure . -
step
-
step
-
toCalendar
-
toCalendar
-
toCalendar
-
toCalendar
-
toDate
-
toInstant
-
toLocalDate
-
toLocalDateTime
-
toLocalTime
-
toOffsetDateTime
-
toString
-
toZonedDateTime
-
until
-
with
-
with
-