Class HebrewTime
- All Implemented Interfaces:
Serializable
,Comparable<HebrewTime>
,ChronoDisplay
,Temporal<HebrewTime>
Represents the 12-hour-time used in Jewish calendar starting in the evening at either sunset or simplified at 6 PM as zero point.
Introduction
The calendar day is divided into day and night, or more precisely into two periods from sunset to sunrise and then to next sunset. Each period is again divided into 12 timely hours which have no fixed length due to seasonal changes. And each such hour is divided into 1080 parts (halakim). See also: www.torahcalendar.com.
Following elements which are declared as constants are registered by this class:
Formatting example
A suitable formatter can be constructed by help of dynamic format patterns, but not by the standard format pattern CLDR:
HebrewTime htime = HebrewTime.ofNight(12, 540); ChronoFormatter<HebrewTime> f = ChronoFormatter.ofPattern("H'H' P'P'", PatternType.DYNAMIC, Locale.ROOT, HebrewTime.axis()); assertThat(f.format(htime), is("0H 540P"));
- Since:
- 3.37/4.32
- Author:
- Meno Hochschild
- See Also:
HebrewCalendar
,PatternType.DYNAMIC
, Serialized Form
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Defines the day-night-cycle associated with sunset and sunrise.static class
Defines the time units for the Hebrew time. -
Field Summary
Modifier and TypeFieldDescriptionstatic ChronoElement<HebrewTime.ClockCycle>
Marks the period between either sunset and sunrise (NIGHT) or sunrise and sunset (DAY).static StdCalendarElement<Integer,HebrewTime>
The Hebrew hour with the biblical value range 1-12 which is coupled to the sun cycle.static StdCalendarElement<Integer,HebrewTime>
The Hebrew hour with the digital value range 0-23 which is coupled to the sun cycle.static StdCalendarElement<Integer,HebrewTime>
Marks the part of hour (helek) with the value range 0-1079. -
Method Summary
Modifier and TypeMethodDescriptionstatic ChronoFunction<Moment,Optional<HebrewTime>>
Obtains the Hebrew time dependent on given moment and location related to solar time.static ChronoFunction<Moment,HebrewTime>
Obtains the simplified Hebrew time dependent on given moment and a 24-hour-fixed scale.static TimeAxis<HebrewTime.Unit,HebrewTime>
axis()
Provides a static access to the associated time axis respective chronology which contains the chronological rules.int
compareTo(HebrewTime other)
Compares two time points preferably by their temporal positions on the common time axis.boolean
Compares the whole state of this instance with given object.int
Yields the Hebrew hour in the biblical range 1-12.int
Yields the Hebrew hour in the digital value range 0-23.int
getPart()
Yields the part of hour (helek).int
hashCode()
Subclasses must redefine this method corresponding to the behaviour ofequals()
.boolean
isAfter(HebrewTime other)
Queries if this object is after given object on a timeline.boolean
isBefore(HebrewTime other)
Queries if this object is before given object on a timeline.boolean
isDay()
Is this time during day when the sun is above the horizon?boolean
isNight()
Is this time during night when the sun is below the horizon?boolean
isSimultaneous(HebrewTime other)
Queries if this object and given object have the same position on the time axis.static Optional<HebrewTime>
Obtains the current Hebrew time in system time and at given geographical position.static HebrewTime
Obtains the current simplified Hebrew time in system time on a fixed 24-hour-scale.static HebrewTime
ofDay(int hour12, int part)
Obtains an instance of Hebrew time between sunrise and sunset (day).static HebrewTime
ofDigital(int hour23, int part)
Obtains an instance of Hebrew time between two sunsets.static HebrewTime
ofNight(int hour12, int part)
Obtains an instance of Hebrew time between sunset and sunrise (night).on(HebrewCalendar date, SolarTime geoLocation)
Obtains the moment at this Hebrew time on given date at the given geographical position.on(HebrewCalendar date, Timezone tz)
Obtains the moment at this simplified Hebrew time on given date using a fixed 24-hour-scale.toString()
Provides a complete textual representation of the state of this time point.Methods inherited from class net.time4j.engine.TimePoint
max, min, minus, minus, plus, plus, until, until
Methods inherited from class net.time4j.engine.ChronoEntity
contains, get, get, getInt, getMaximum, getMinimum, getRegisteredElements, getTimezone, hasTimezone, isValid, isValid, isValid, matches, with, with, with, with
Methods inherited from interface net.time4j.engine.Temporal
isAfterAll, isAfterOrEqual, isBeforeAll, isBeforeOrEqual
-
Field Details
-
CLOCK_CYCLE
Marks the period between either sunset and sunrise (NIGHT) or sunrise and sunset (DAY). -
CLOCK_HOUR
@FormattableElement(format="h") public static final StdCalendarElement<Integer,HebrewTime> CLOCK_HOURThe Hebrew hour with the biblical value range 1-12 which is coupled to the sun cycle. -
DIGITAL_HOUR
@FormattableElement(format="H") public static final StdCalendarElement<Integer,HebrewTime> DIGITAL_HOURThe Hebrew hour with the digital value range 0-23 which is coupled to the sun cycle. -
PART_OF_HOUR
@FormattableElement(format="P", dynamic=true) public static final StdCalendarElement<Integer,HebrewTime> PART_OF_HOURMarks the part of hour (helek) with the value range 0-1079.Note: This element is not covered by ISO-8601 or CLDR standard but represents an enhancement.
-
-
Method Details
-
ofDigital
Obtains an instance of Hebrew time between two sunsets.
- Parameters:
hour23
- hebrew hour in the digital range 0-23part
- the part of hour (helek) in range 0-1079- Returns:
- Hebrew time
-
ofNight
Obtains an instance of Hebrew time between sunset and sunrise (night).
- Parameters:
hour12
- hebrew hour in the biblical range 1-12 during nightpart
- the part of hour (helek) in range 0-1079- Returns:
- Hebrew time
-
ofDay
Obtains an instance of Hebrew time between sunrise and sunset (day).
- Parameters:
hour12
- hebrew hour in the biblical range 1-12 during daypart
- the part of hour (helek) in range 0-1079- Returns:
- Hebrew time
-
now
Obtains the current Hebrew time in system time and at given geographical position.
- Parameters:
geoLocation
- the geographical position as basis of the solar time- Returns:
- current Hebrew time at given location (optional)
- See Also:
SystemClock.currentMoment()
,at(SolarTime)
-
nowInSystemTime
Obtains the current simplified Hebrew time in system time on a fixed 24-hour-scale.
Convenient short-cut for:
SystemClock.inLocalView().now(HebrewTime.axis())
.- Returns:
- current Hebrew time in system time zone using the system clock on a fixed 24-hour-scale
- See Also:
SystemClock.inLocalView()
,ZonalClock.now(Chronology)
,now(SolarTime)
,at(TZID)
,on(HebrewCalendar, Timezone)
-
at
Obtains the Hebrew time dependent on given moment and location related to solar time.
The length of hours varies with the geographical position and the seasonal drift of length of day. Furthermore, the Hebrew time cannot be determined in circumpolar regions when the sun never rises or sets.
- Parameters:
geoLocation
- the geographical position as basis of the solar time- Returns:
- function which maps a moment to hebrew time
- See Also:
now(SolarTime)
,on(HebrewCalendar, SolarTime)
-
at
Obtains the simplified Hebrew time dependent on given moment and a 24-hour-fixed scale.
The simplified Hebrew time always starts on 6 pm in the evening. A more exact conversion can be obtained by
at(SolarTime)
.- Parameters:
tzid
- timezone identifier- Returns:
- function which maps a moment to hebrew time
- See Also:
nowInSystemTime()
,on(HebrewCalendar, Timezone)
-
isNight
public boolean isNight()Is this time during night when the sun is below the horizon?
- Returns:
- boolean
-
isDay
public boolean isDay()Is this time during day when the sun is above the horizon?
- Returns:
- boolean
-
getClockHour
public int getClockHour()Yields the Hebrew hour in the biblical range 1-12.
-
getDigitalHour
public int getDigitalHour()Yields the Hebrew hour in the digital value range 0-23.
- Returns:
- hour in range 0-23
-
getPart
public int getPart()Yields the part of hour (helek).
- Returns:
- int in range 0-1079
-
isAfter
Description copied from interface:Temporal
Queries if this object is after given object on a timeline.
- Specified by:
isAfter
in interfaceTemporal<HebrewTime>
- Parameters:
other
- object this instance is compared to- Returns:
true
if this instance is temporally aftertemporal
elsefalse
-
isBefore
Description copied from interface:Temporal
Queries if this object is before given object on a timeline.
- Specified by:
isBefore
in interfaceTemporal<HebrewTime>
- Parameters:
other
- object this instance is compared to- Returns:
true
if this instance is temporally beforetemporal
elsefalse
-
isSimultaneous
Description copied from interface:Temporal
Queries if this object and given object have the same position on the time axis.
Is equivalent to
!isAfter(temporal) && !isBefore(temporal)
. This method differs from theObject
-methodequals()
such that first the comparison type must be a temporal one and second that only temporal-only state will be considered.- Specified by:
isSimultaneous
in interfaceTemporal<HebrewTime>
- Parameters:
other
- object this instance is compared to- Returns:
true
if this instance is temporally equal totemporal
elsefalse
-
compareTo
Description copied from class:TimePoint
Compares two time points preferably by their temporal positions on the common time axis.
Implementation note: In order to make the natural order consistent with
equals()
the whole state must be taken into account, with preference for those attributes which define the temporal position on the time axis.- Specified by:
compareTo
in interfaceComparable<HebrewTime>
- Specified by:
compareTo
in classTimePoint<HebrewTime.Unit,HebrewTime>
- See Also:
TimePoint.equals(Object)
-
equals
Description copied from class:TimePoint
Compares the whole state of this instance with given object.
Implementations will usually define their state only based on the temporal position on the time axis because this is the most intuitive approach. Exceptions from this rule should be explicitly documented and reasoned.
- Specified by:
equals
in classTimePoint<HebrewTime.Unit,HebrewTime>
- See Also:
TimePoint.compareTo(TimePoint)
-
hashCode
public int hashCode()Description copied from class:TimePoint
Subclasses must redefine this method corresponding to the behaviour of
equals()
.- Specified by:
hashCode
in classTimePoint<HebrewTime.Unit,HebrewTime>
-
toString
Description copied from class:TimePoint
Provides a complete textual representation of the state of this time point.
The textual description often follows the conventions of ISO-8601. Usually the description starts with the chronological informations which are coarse-grained and ends with those ones which are fine-grained (for example the ISO-notation YYYY-MM-DD).
- Specified by:
toString
in classTimePoint<HebrewTime.Unit,HebrewTime>
-
on
Obtains the moment at this Hebrew time on given date at the given geographical position.
Note: The practical precision of this method is constrained to minutes.
- Parameters:
date
- the Hebrew date to be combined with this timegeoLocation
- the geographical position as basis of the solar time- Returns:
- Moment (optional)
- See Also:
now(SolarTime)
,at(SolarTime)
-
on
Obtains the moment at this simplified Hebrew time on given date using a fixed 24-hour-scale.
The simplified Hebrew time always starts on 6 pm in the evening. A more exact conversion can be obtained by
on(HebrewCalendar, SolarTime)
. Attention: This method might have very small rounding errors in nanosecond range because halakim cannot always be converted to seconds in an exact way.- Parameters:
date
- the Hebrew date to be combined with this timetz
- timezone- Returns:
- Moment
- See Also:
nowInSystemTime()
,at(TZID)
-
axis
Provides a static access to the associated time axis respective chronology which contains the chronological rules.
- Returns:
- chronological system as time axis (never
null
)
-