Class ValueInterval<T,​I extends ChronoInterval<T>,​V>

java.lang.Object
net.time4j.range.ValueInterval<T,​I,​V>
Type Parameters:
T - temporal type of time points within a given interval
I - generic interval type
V - value type associated with a value interval
All Implemented Interfaces:
Serializable, ChronoInterval<T>

public class ValueInterval<T,​I extends ChronoInterval<T>,​V> extends Object implements ChronoInterval<T>, Serializable

Represents a temporal interval with an associated value.

Value intervals are either based on subclasses of IsoInterval or FixedCalendarInterval and can be created by the interval instance methods named withValue(V). The serializability is determined by the serializability of the value type.

Since:
3.31/4.26
Author:
Meno Hochschild
See Also:
IsoInterval.withValue(V), FixedCalendarInterval.withValue(V), Serialized Form
  • Method Details

    • getValue

      public V getValue()

      Obtains the associated value.

      Returns:
      value associated with this interval
    • withValue

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

      Assigns this value interval with given new value.

      Parameters:
      value - associated value, not null
      Returns:
      new value interval
    • getBoundaries

      public I getBoundaries()

      Obtains the interval delegate instance.

      Returns:
      wrapped interval delegate
    • getStart

      public Boundary<T> getStart()
      Description copied from interface: ChronoInterval

      Yields the lower bound of this interval.

      Specified by:
      getStart in interface ChronoInterval<T>
      Returns:
      start interval boundary
    • getEnd

      public Boundary<T> getEnd()
      Description copied from interface: ChronoInterval

      Yields the upper bound of this interval.

      Specified by:
      getEnd in interface ChronoInterval<T>
      Returns:
      end interval boundary
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: ChronoInterval

      Determines if this interval is empty.

      Specified by:
      isEmpty in interface ChronoInterval<T>
      Returns:
      true if this interval does not contain any time point else false
    • contains

      public boolean contains(T temporal)
      Description copied from interface: ChronoInterval

      Queries if given time point belongs to this interval.

      Specified by:
      contains in interface ChronoInterval<T>
      Parameters:
      temporal - time point to be queried
      Returns:
      true if given time point belongs to this interval else false
    • contains

      public boolean contains(ChronoInterval<T> 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>
      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)
    • isAfter

      public boolean isAfter(T temporal)
      Description copied from interface: ChronoInterval

      Is this interval after the given time point?

      Specified by:
      isAfter in interface ChronoInterval<T>
      Parameters:
      temporal - reference time point
      Returns:
      true if this interval is after given time point else false
    • isBefore

      public boolean isBefore(T temporal)
      Description copied from interface: ChronoInterval

      Is this interval before the given time point?

      Specified by:
      isBefore in interface ChronoInterval<T>
      Parameters:
      temporal - reference time point
      Returns:
      true if this interval is before given time point else false
    • isBefore

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

      Is this interval before the other one?

      Specified by:
      isBefore in interface ChronoInterval<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<T> 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>
      Parameters:
      other - another interval which might abut this interval
      Returns:
      true if there is no intersection and no gap between else false
    • equals

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

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

      public String toString()
      Overrides:
      toString in class Object