Package org.daiitech.naftah.builtin.time
Interface NaftahTemporalPoint
- All Superinterfaces:
NaftahTemporal
- All Known Implementing Classes:
NaftahDate,NaftahDateTime,NaftahTime
public sealed interface NaftahTemporalPoint
extends NaftahTemporal
permits NaftahTime, NaftahDate, NaftahDateTime
Marker interface representing a Naftah temporal point.
A temporal point represents a specific position on the time-line (such as a date, time, or date-time) with an Naftah textual representation.
This sealed interface provides a common abstraction for all Naftah-aware temporal
points and allows access to their underlying Temporal representation.
The following implementations are permitted:
NaftahTime– a time-only temporal pointNaftahDate– a date-only temporal pointNaftahDateTime– a combined date and time temporal point
- Author:
- Chakib Daii
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleangreaterThan(NaftahTemporalPoint otherNaftahTemporalPoint) Determines whether this temporal point occurs after the given temporal point.default booleangreaterThanEquals(NaftahTemporalPoint otherNaftahTemporalPoint) Determines whether this temporal point occurs after or at the same instant as the given temporal point.default booleanisEquals(NaftahTemporalPoint otherNaftahTemporalPoint) Determines whether this temporal point represents the same instant as the given temporal point.default booleanlessThan(NaftahTemporalPoint otherNaftahTemporalPoint) Determines whether this temporal point occurs before the given temporal point.default booleanlessThanEquals(NaftahTemporalPoint otherNaftahTemporalPoint) Determines whether this temporal point occurs before or at the same instant as the given temporal point.minus(NaftahTemporalAmount naftahTemporalAmount) Returns a temporal point obtained by subtracting the given Naftah temporal amount from this temporal point.default booleannotEquals(NaftahTemporalPoint otherNaftahTemporalPoint) Determines whether this temporal point does not represent the same instant as the given temporal point.plus(NaftahTemporalAmount naftahTemporalAmount) Returns a temporal point obtained by adding the given Naftah temporal amount to this temporal point.temporal()Returns the underlyingTemporalrepresentation of this temporal point.
-
Method Details
-
temporal
Temporal temporal()Returns the underlyingTemporalrepresentation of this temporal point.- Returns:
- the temporal representation
-
plus
Returns a temporal point obtained by adding the given Naftah temporal amount to this temporal point.- Parameters:
naftahTemporalAmount- the amount to add- Returns:
- a new
NaftahTemporalPointwith the amount added
-
minus
Returns a temporal point obtained by subtracting the given Naftah temporal amount from this temporal point.- Parameters:
naftahTemporalAmount- the amount to subtract- Returns:
- a new
NaftahTemporalPointwith the amount subtracted
-
isEquals
Determines whether this temporal point represents the same instant as the given temporal point.- Parameters:
otherNaftahTemporalPoint- the temporal point to compare with- Returns:
trueif both temporal points represent the same instant;falseotherwise
-
notEquals
Determines whether this temporal point does not represent the same instant as the given temporal point.- Parameters:
otherNaftahTemporalPoint- the temporal point to compare with- Returns:
trueif the temporal points are not equal;falseotherwise
-
greaterThan
Determines whether this temporal point occurs after the given temporal point.- Parameters:
otherNaftahTemporalPoint- the temporal point to compare with- Returns:
trueif this temporal point is after the given one;falseotherwise
-
greaterThanEquals
Determines whether this temporal point occurs after or at the same instant as the given temporal point.- Parameters:
otherNaftahTemporalPoint- the temporal point to compare with- Returns:
trueif this temporal point is after or equal to the given one;falseotherwise
-
lessThan
Determines whether this temporal point occurs before the given temporal point.- Parameters:
otherNaftahTemporalPoint- the temporal point to compare with- Returns:
trueif this temporal point is before the given one;falseotherwise
-
lessThanEquals
Determines whether this temporal point occurs before or at the same instant as the given temporal point.- Parameters:
otherNaftahTemporalPoint- the temporal point to compare with- Returns:
trueif this temporal point is before or equal to the given one;falseotherwise
-