Package org.ojalgo.type
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 long
An "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) int
compareTo
(CalendarDate ref) boolean
filter
(CalendarDateUnit resolution) static CalendarDate
from
(TemporalAccessor temporal) long
getLong
(TemporalField field) int
hashCode()
boolean
isSupported
(TemporalField field) boolean
isSupported
(TemporalUnit unit) static CalendarDate
make
(long timeInMIllis, CalendarDate.Resolution resolution) static CalendarDate
make
(Calendar calendar, CalendarDate.Resolution resolution) static CalendarDate
make
(Date date, CalendarDate.Resolution resolution) static CalendarDate
make
(CalendarDate.Resolution resolution) (package private) static long
millis
(TemporalAccessor temporal) static CalendarDate
now()
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 Calendar
toCalendar
(Instant instant) static Calendar
toCalendar
(Instant instant, Locale locale) static Calendar
toCalendar
(Instant instant, TimeZone zone) static Calendar
toCalendar
(Instant instant, TimeZone zone, Locale locale) toCalendar
(Locale locale) toCalendar
(TimeZone zone) toCalendar
(TimeZone zone, Locale locale) toDate()
static Date
static LocalDate
toLocalDate
(Instant instant, ZoneId zone) toLocalDate
(ZoneOffset offset) static LocalDate
toLocalDate
(Calendar calendar) static LocalDateTime
toLocalDateTime
(Instant instant, ZoneId zone) toLocalDateTime
(ZoneOffset offset) static LocalTime
toLocalTime
(Instant instant, ZoneId zone) toLocalTime
(ZoneOffset offset) static OffsetDateTime
toOffsetDateTime
(Instant instant, ZoneId zone) static OffsetDateTime
toOffsetDateTime
(Instant instant, ZoneId zone, Instant zoneToOffsetConversionInstant) static OffsetDateTime
toOffsetDateTime
(Instant instant, ZoneOffset offset) toOffsetDateTime
(ZoneOffset offset) toString()
static ZonedDateTime
toZonedDateTime
(Instant instant, ZoneId zone) toZonedDateTime
(ZoneOffset offset) long
until
(Temporal endExclusive, TemporalUnit unit) static CalendarDate
static CalendarDate
valueOf
(OffsetDateTime offsetDateTime) static CalendarDate
valueOf
(ZonedDateTime zonedDateTime) with
(TemporalAdjuster adjuster) with
(TemporalField field, long newValue) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.time.temporal.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:
compareTo
in interfaceComparable<CalendarDate>
-
equals
-
filter
-
getLong
- Specified by:
getLong
in interfaceTemporalAccessor
-
hashCode
public int hashCode() -
isSupported
- Specified by:
isSupported
in interfaceTemporalAccessor
-
isSupported
- Specified by:
isSupported
in 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
-