Interface TimeSupport

All Known Implementing Classes:
NaftahDateTime, NaftahTime

public interface TimeSupport
Provides arithmetic operations for NaftahTemporalPoint instances, including addition and subtraction of hours, minutes, seconds, and nanoseconds.

This interface can be implemented by NaftahTime or used by NaftahDateTime to delegate time arithmetic.

Author:
Chakib Daii
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Gets the hour-of-day field.
    default int
    Gets the millisecond-of-second from the time part of this temporal.
    int
    Gets the minute-of-hour field.
    int
    Gets the nano-of-second field.
    int
    Gets the second-of-minute field.
    minusHours(long hoursToSubtract)
    Returns a new time instance with the specified number of hours subtracted.
    minusMinutes(long minutesToSubtract)
    Returns a new time instance with the specified number of minutes subtracted.
    minusNanos(long nanosToSubtract)
    Returns a new time instance with the specified number of nanoseconds subtracted.
    minusSeconds(long secondsToSubtract)
    Returns a new time instance with the specified number of seconds subtracted.
    plusHours(long hoursToAdd)
    Returns a new time instance with the specified number of hours added.
    plusMinutes(long minutesToAdd)
    Returns a new time instance with the specified number of minutes added.
    plusNanos(long nanosToAdd)
    Returns a new time instance with the specified number of nanoseconds added.
    plusSeconds(long secondsToAdd)
    Returns a new time instance with the specified number of seconds added.
  • Method Details

    • getHour

      int getHour()
      Gets the hour-of-day field.
      Returns:
      the hour-of-day, from 0 to 23
    • getMinute

      int getMinute()
      Gets the minute-of-hour field.
      Returns:
      the minute-of-hour, from 0 to 59
    • getSecond

      int getSecond()
      Gets the second-of-minute field.
      Returns:
      the second-of-minute, from 0 to 59
    • getMilli

      default int getMilli()
      Gets the millisecond-of-second from the time part of this temporal.

      This value is derived from the nano-of-second field by dividing by 1_000_000.

      Returns:
      the millisecond-of-second, from 0 to 999
    • getNano

      int getNano()
      Gets the nano-of-second field.
      Returns:
      the nano-of-second, from 0 to 999,999,999
    • plusHours

      NaftahTemporalPoint plusHours(long hoursToAdd)
      Returns a new time instance with the specified number of hours added.
      Parameters:
      hoursToAdd - the number of hours to add, may be negative
      Returns:
      a new NaftahTemporalPoint instance with hours added
    • plusMinutes

      NaftahTemporalPoint plusMinutes(long minutesToAdd)
      Returns a new time instance with the specified number of minutes added.
      Parameters:
      minutesToAdd - the number of minutes to add, may be negative
      Returns:
      a new NaftahTemporalPoint instance with minutes added
    • plusSeconds

      NaftahTemporalPoint plusSeconds(long secondsToAdd)
      Returns a new time instance with the specified number of seconds added.
      Parameters:
      secondsToAdd - the number of seconds to add, may be negative
      Returns:
      a new NaftahTemporalPoint instance with seconds added
    • plusNanos

      NaftahTemporalPoint plusNanos(long nanosToAdd)
      Returns a new time instance with the specified number of nanoseconds added.
      Parameters:
      nanosToAdd - the number of nanoseconds to add, may be negative
      Returns:
      a new NaftahTemporalPoint instance with nanoseconds added
    • minusHours

      NaftahTemporalPoint minusHours(long hoursToSubtract)
      Returns a new time instance with the specified number of hours subtracted.
      Parameters:
      hoursToSubtract - the number of hours to subtract, may be negative
      Returns:
      a new NaftahTemporalPoint instance with hours subtracted
    • minusMinutes

      NaftahTemporalPoint minusMinutes(long minutesToSubtract)
      Returns a new time instance with the specified number of minutes subtracted.
      Parameters:
      minutesToSubtract - the number of minutes to subtract, may be negative
      Returns:
      a new NaftahTemporalPoint instance with minutes subtracted
    • minusSeconds

      NaftahTemporalPoint minusSeconds(long secondsToSubtract)
      Returns a new time instance with the specified number of seconds subtracted.
      Parameters:
      secondsToSubtract - the number of seconds to subtract, may be negative
      Returns:
      a new NaftahTemporalPoint instance with seconds subtracted
    • minusNanos

      NaftahTemporalPoint minusNanos(long nanosToSubtract)
      Returns a new time instance with the specified number of nanoseconds subtracted.
      Parameters:
      nanosToSubtract - the number of nanoseconds to subtract, may be negative
      Returns:
      a new NaftahTemporalPoint instance with nanoseconds subtracted