Class Boundary<T>

java.lang.Object
net.time4j.range.Boundary<T>
Type Parameters:
T - generic temporal type
All Implemented Interfaces:
Serializable

public final class Boundary<T> extends Object implements Serializable

Represents an interval boundary, either the lower one or the upper one.

Since:
2.0
Author:
Meno Hochschild
See Also:
Serialized Form
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals​(Object obj)
     
    Yields the time point of this interval boundary.
    int
     
    static <T> Boundary<T>
    Defines a symbolic open boundary for the infinite future.
    static <T> Boundary<T>
    Defines a symbolic open boundary for the infinite past.
    boolean
    Determines if this boundary is closed.
    boolean
    Determines if this boundary is infinite.
    boolean
    Determines if this boundary is open.
    static <T> Boundary<T>
    ofClosed​(T temporal)
    Defines a finite closed boundary for the specified time point.
    static <T> Boundary<T>
    ofOpen​(T temporal)
    Defines a finite open boundary for the specified time point.
    Yields a descriptive string.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • infinitePast

      public static <T> Boundary<T> infinitePast()

      Defines a symbolic open boundary for the infinite past.

      Type Parameters:
      T - generic temporal type
      Returns:
      open boundary in infinite past without defined time
      Since:
      2.0
    • infiniteFuture

      public static <T> Boundary<T> infiniteFuture()

      Defines a symbolic open boundary for the infinite future.

      Type Parameters:
      T - generic temporal type
      Returns:
      open boundary in infinite future without defined time
      Since:
      2.0
    • ofOpen

      public static <T> Boundary<T> ofOpen(T temporal)

      Defines a finite open boundary for the specified time point.

      Type Parameters:
      T - generic temporal type
      Parameters:
      temporal - time of the boundary
      Returns:
      finite open boundary
      Since:
      2.0
      See Also:
      infinitePast(), infiniteFuture(), isOpen()
    • ofClosed

      public static <T> Boundary<T> ofClosed(T temporal)

      Defines a finite closed boundary for the specified time point.

      Type Parameters:
      T - generic temporal type
      Parameters:
      temporal - time of the boundary
      Returns:
      finite closed boundary
      Since:
      2.0
      See Also:
      infinitePast(), infiniteFuture(), isClosed()
    • getTemporal

      public T getTemporal()

      Yields the time point of this interval boundary.

      Returns:
      time point or null if infinite
      Since:
      2.0
      See Also:
      isInfinite()
    • isOpen

      public boolean isOpen()

      Determines if this boundary is open.

      If open then the associated time point does not belong to a given interval with this boundary.

      Returns:
      true if open else false
      Since:
      2.0
      See Also:
      ofOpen(T)
    • isClosed

      public boolean isClosed()

      Determines if this boundary is closed.

      If closed then the associated time point belongs to a given interval with this boundary.

      Returns:
      true if closed else false
      Since:
      2.0
      See Also:
      ofClosed(T)
    • isInfinite

      public boolean isInfinite()

      Determines if this boundary is infinite.

      If infinite then the associated time point is not defined.

      Returns:
      true if infinite else false
      Since:
      2.0
      See Also:
      getTemporal()
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()

      Yields a descriptive string.

      Overrides:
      toString in class Object
      Returns:
      String (either "(-∞)", "(+∞)" or "(temporal)" for finite open boundary or "[temporal]" for finite closed boundary)