Package org.daiitech.naftah.builtin.time
Record Class NaftahDuration.DurationDefinition
java.lang.Object
java.lang.Record
org.daiitech.naftah.builtin.time.NaftahDuration.DurationDefinition
- Record Components:
hours- the number of hourshourText- the Arabic word for hours (default is *Constants.HOUR)minutes- the number of minutesminuteText- the Arabic word for minutes (default is *Constants.MINUTE)seconds- the number of secondsmillis- the number of milliseconds (used as decimal part for seconds)secondText- the Arabic word for seconds (default is *Constants.SECOND)nanos- the number of nanosecondsnanoText- the Arabic word for nanoseconds (default is *Constants.NANOSECOND)
- Enclosing class:
- NaftahDuration
public static record NaftahDuration.DurationDefinition(int hours, String hourText, int minutes, String minuteText, int seconds, int millis, String secondText, int nanos, String nanoText)
extends Record
Definition of a duration in Arabic text, including hours, minutes, seconds, milliseconds, and nanoseconds.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intThe field for thehoursrecord component.private final StringThe field for thehourTextrecord component.private final intThe field for themillisrecord component.private final intThe field for theminutesrecord component.private final StringThe field for theminuteTextrecord component.private final intThe field for thenanosrecord component.private final StringThe field for thenanoTextrecord component.private final intThe field for thesecondsrecord component.private final StringThe field for thesecondTextrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionDurationDefinition(int hours, String hourText, int minutes, String minuteText, int seconds, int millis, String secondText, int nanos, String nanoText) Creates an instance of aDurationDefinitionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.inthours()Returns the value of thehoursrecord component.hourText()Returns the value of thehourTextrecord component.intmillis()Returns the value of themillisrecord component.intminutes()Returns the value of theminutesrecord component.Returns the value of theminuteTextrecord component.intnanos()Returns the value of thenanosrecord component.nanoText()Returns the value of thenanoTextrecord component.of(int hours, int minutes, int seconds, int millis, int nanos) Creates a newNaftahDuration.DurationDefinitioninstance using the default Arabic time unit labels.of(int hours, String hourText, int minutes, String minuteText, int seconds, int millis, String secondText, int nanos, String nanoText) Creates a newNaftahDuration.DurationDefinitioninstance.intseconds()Returns the value of thesecondsrecord component.Returns the value of thesecondTextrecord component.toString()Returns a formatted Arabic string representing the duration.
-
Field Details
-
hours
private final int hoursThe field for thehoursrecord component. -
hourText
The field for thehourTextrecord component. -
minutes
private final int minutesThe field for theminutesrecord component. -
minuteText
The field for theminuteTextrecord component. -
seconds
private final int secondsThe field for thesecondsrecord component. -
millis
private final int millisThe field for themillisrecord component. -
secondText
The field for thesecondTextrecord component. -
nanos
private final int nanosThe field for thenanosrecord component. -
nanoText
The field for thenanoTextrecord component.
-
-
Constructor Details
-
DurationDefinition
public DurationDefinition(int hours, String hourText, int minutes, String minuteText, int seconds, int millis, String secondText, int nanos, String nanoText) Creates an instance of aDurationDefinitionrecord class.- Parameters:
hours- the value for thehoursrecord componenthourText- the value for thehourTextrecord componentminutes- the value for theminutesrecord componentminuteText- the value for theminuteTextrecord componentseconds- the value for thesecondsrecord componentmillis- the value for themillisrecord componentsecondText- the value for thesecondTextrecord componentnanos- the value for thenanosrecord componentnanoText- the value for thenanoTextrecord component
-
-
Method Details
-
of
public static NaftahDuration.DurationDefinition of(int hours, String hourText, int minutes, String minuteText, int seconds, int millis, String secondText, int nanos, String nanoText) Creates a newNaftahDuration.DurationDefinitioninstance.Any missing Arabic text labels are automatically filled using the default Arabic time unit terms defined in
Constants.- Parameters:
hours- the number of hourshourText- the Arabic text used for the hour unit; ifnull,Constants.HOURis usedminutes- the number of minutesminuteText- the Arabic text used for the minute unit; ifnull,Constants.MINUTEis usedseconds- the number of secondsmillis- the number of milliseconds (used as the decimal fraction of seconds)secondText- the Arabic text used for the second unit; ifnull,Constants.SECONDis usednanos- the number of nanosecondsnanoText- the Arabic text used for the nanosecond unit; ifnull,Constants.NANOSECONDis used- Returns:
- a new
NaftahDuration.DurationDefinitioninstance
-
of
public static NaftahDuration.DurationDefinition of(int hours, int minutes, int seconds, int millis, int nanos) Creates a newNaftahDuration.DurationDefinitioninstance using the default Arabic time unit labels.- Parameters:
hours- the number of hoursminutes- the number of minutesseconds- the number of secondsmillis- the number of milliseconds (used as the decimal fraction of seconds)nanos- the number of nanoseconds- Returns:
- a new
NaftahDuration.DurationDefinitioninstance
-
toString
Returns a formatted Arabic string representing the duration.Non-zero units are printed with the Arabic conjunction " و " between them. Milliseconds are displayed as a decimal fraction of seconds if present. If all units are zero, it defaults to "0 ثانية".
-
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
hours
public int hours()Returns the value of thehoursrecord component.- Returns:
- the value of the
hoursrecord component
-
hourText
Returns the value of thehourTextrecord component.- Returns:
- the value of the
hourTextrecord component
-
minutes
public int minutes()Returns the value of theminutesrecord component.- Returns:
- the value of the
minutesrecord component
-
minuteText
Returns the value of theminuteTextrecord component.- Returns:
- the value of the
minuteTextrecord component
-
seconds
public int seconds()Returns the value of thesecondsrecord component.- Returns:
- the value of the
secondsrecord component
-
millis
public int millis()Returns the value of themillisrecord component.- Returns:
- the value of the
millisrecord component
-
secondText
Returns the value of thesecondTextrecord component.- Returns:
- the value of the
secondTextrecord component
-
nanos
public int nanos()Returns the value of thenanosrecord component.- Returns:
- the value of the
nanosrecord component
-
nanoText
Returns the value of thenanoTextrecord component.- Returns:
- the value of the
nanoTextrecord component
-