Record Class NaftahDuration.DurationDefinition

java.lang.Object
java.lang.Record
org.daiitech.naftah.builtin.time.NaftahDuration.DurationDefinition
Record Components:
hours - the number of hours
hourText - the Arabic word for hours (default is * Constants.HOUR)
minutes - the number of minutes
minuteText - the Arabic word for minutes (default is * Constants.MINUTE)
seconds - the number of seconds
millis - the number of milliseconds (used as decimal part for seconds)
secondText - the Arabic word for seconds (default is * Constants.SECOND)
nanos - the number of nanoseconds
nanoText - 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 Details

    • hours

      private final int hours
      The field for the hours record component.
    • hourText

      private final String hourText
      The field for the hourText record component.
    • minutes

      private final int minutes
      The field for the minutes record component.
    • minuteText

      private final String minuteText
      The field for the minuteText record component.
    • seconds

      private final int seconds
      The field for the seconds record component.
    • millis

      private final int millis
      The field for the millis record component.
    • secondText

      private final String secondText
      The field for the secondText record component.
    • nanos

      private final int nanos
      The field for the nanos record component.
    • nanoText

      private final String nanoText
      The field for the nanoText record 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 a DurationDefinition record class.
      Parameters:
      hours - the value for the hours record component
      hourText - the value for the hourText record component
      minutes - the value for the minutes record component
      minuteText - the value for the minuteText record component
      seconds - the value for the seconds record component
      millis - the value for the millis record component
      secondText - the value for the secondText record component
      nanos - the value for the nanos record component
      nanoText - the value for the nanoText record 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 new NaftahDuration.DurationDefinition instance.

      Any missing Arabic text labels are automatically filled using the default Arabic time unit terms defined in Constants.

      Parameters:
      hours - the number of hours
      hourText - the Arabic text used for the hour unit; if null, Constants.HOUR is used
      minutes - the number of minutes
      minuteText - the Arabic text used for the minute unit; if null, Constants.MINUTE is used
      seconds - the number of seconds
      millis - the number of milliseconds (used as the decimal fraction of seconds)
      secondText - the Arabic text used for the second unit; if null, Constants.SECOND is used
      nanos - the number of nanoseconds
      nanoText - the Arabic text used for the nanosecond unit; if null, Constants.NANOSECOND is used
      Returns:
      a new NaftahDuration.DurationDefinition instance
    • of

      public static NaftahDuration.DurationDefinition of(int hours, int minutes, int seconds, int millis, int nanos)
      Creates a new NaftahDuration.DurationDefinition instance using the default Arabic time unit labels.
      Parameters:
      hours - the number of hours
      minutes - the number of minutes
      seconds - the number of seconds
      millis - the number of milliseconds (used as the decimal fraction of seconds)
      nanos - the number of nanoseconds
      Returns:
      a new NaftahDuration.DurationDefinition instance
    • toString

      public String 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 ثانية".

      Specified by:
      toString in class Record
      Returns:
      a string describing the duration in Arabic
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • hours

      public int hours()
      Returns the value of the hours record component.
      Returns:
      the value of the hours record component
    • hourText

      public String hourText()
      Returns the value of the hourText record component.
      Returns:
      the value of the hourText record component
    • minutes

      public int minutes()
      Returns the value of the minutes record component.
      Returns:
      the value of the minutes record component
    • minuteText

      public String minuteText()
      Returns the value of the minuteText record component.
      Returns:
      the value of the minuteText record component
    • seconds

      public int seconds()
      Returns the value of the seconds record component.
      Returns:
      the value of the seconds record component
    • millis

      public int millis()
      Returns the value of the millis record component.
      Returns:
      the value of the millis record component
    • secondText

      public String secondText()
      Returns the value of the secondText record component.
      Returns:
      the value of the secondText record component
    • nanos

      public int nanos()
      Returns the value of the nanos record component.
      Returns:
      the value of the nanos record component
    • nanoText

      public String nanoText()
      Returns the value of the nanoText record component.
      Returns:
      the value of the nanoText record component