Class FixedCalendarInterval<T extends FixedCalendarInterval<T>>

java.lang.Object
net.time4j.engine.ChronoEntity<T>
net.time4j.range.FixedCalendarInterval<T>
All Implemented Interfaces:
Serializable, Comparable<T>, Iterable<PlainDate>, ChronoDisplay, ChronoInterval<PlainDate>
Direct Known Subclasses:
CalendarMonth, CalendarQuarter, CalendarWeek, CalendarYear

public abstract class FixedCalendarInterval<T extends FixedCalendarInterval<T>> extends ChronoEntity<T> implements Comparable<T>, ChronoInterval<PlainDate>, Iterable<PlainDate>, Serializable

Represents a fixed calendar interval.

Since:
3.21/4.17
Author:
Meno Hochschild
See Also:
Serialized Form
  • Method Details

    • isFinite

      public final boolean isFinite()

      A calendar interval is always finite.

      Specified by:
      isFinite in interface ChronoInterval<T extends FixedCalendarInterval<T>>
      Returns:
      true
    • isEmpty

      public final boolean isEmpty()

      A calendar interval is never empty.

      Specified by:
      isEmpty in interface ChronoInterval<T extends FixedCalendarInterval<T>>
      Returns:
      false
    • contains

      public boolean contains(ChronoInterval<PlainDate> other)
      Description copied from interface: ChronoInterval

      Does this interval contain the other one?

      An interval cannot contain infinite intervals but can contain an empty interval if it contains the start anchor of the empty interval.

      Specified by:
      contains in interface ChronoInterval<T extends FixedCalendarInterval<T>>
      Parameters:
      other - another interval whose relation to this interval is to be investigated
      Returns:
      true if this interval contains the other one else false
      See Also:
      ChronoInterval.intersects(ChronoInterval)
    • isBefore

      public boolean isBefore(ChronoInterval<PlainDate> other)
      Description copied from interface: ChronoInterval

      Is this interval before the other one?

      Specified by:
      isBefore in interface ChronoInterval<T extends FixedCalendarInterval<T>>
      Parameters:
      other - another interval whose relation to this interval is to be investigated
      Returns:
      true if this interval is before the other one else false
    • abuts

      public boolean abuts(ChronoInterval<PlainDate> other)
      Description copied from interface: ChronoInterval

      Queries if this interval abuts the other one such that there is neither any overlap nor any gap between.

      Note: Empty intervals never abut.

      Specified by:
      abuts in interface ChronoInterval<T extends FixedCalendarInterval<T>>
      Parameters:
      other - another interval which might abut this interval
      Returns:
      true if there is no intersection and no gap between else false
    • isSimultaneous

      public boolean isSimultaneous(T other)

      Queries if this object and given object have the same position on the time axis.

      Parameters:
      other - object this instance is compared to
      Returns:
      true if this instance is temporally equal to other else false
    • toFlexInterval

      public DateInterval toFlexInterval()

      Converts this fixed interval to a date interval with flexible boundaries which can participate in any kind of interval boundary manipulations.

      Returns:
      DateInterval
    • streamDaily

      public Stream<PlainDate> streamDaily()

      Obtains a stream iterating over every calendar date of this interval.

      Returns:
      daily stream
      Since:
      4.24
    • withValue

      public <V> ValueInterval<PlainDate,​T,​V> withValue(V value)

      Creates a combination of this interval with an associated value.

      Type Parameters:
      V - generic value type
      Parameters:
      value - associated value, not null
      Returns:
      new value interval
      Since:
      3.31/4.26