Interface Ranges<T>

All Superinterfaces:
Serializable
All Known Implementing Classes:
Range

public interface Ranges<T> extends Serializable
Interface for Ranges
  • Method Details

    • empty

      Ranges<T> empty()
      A range of size 0L starting at this instance start time
      Returns:
      empty range
    • plus

      Ranges<T> plus(Ranges<T> right)
      Add 2 ranges
      Parameters:
      right - right operand
      Returns:
      sum of ranges
    • intersect

      Ranges<T> intersect(Ranges<T> right)
      Get the common range between 2 ranges. No restrictions.
      Parameters:
      right - right operand
      Returns:
      the common range or the empty range if the ranges do not intersect.
    • size

      T size()
      Returns:
      range size
    • shift

      Ranges<T> shift(T offset)
      Parameters:
      offset - offset to shift
      Returns:
      shift start and end by the same positive or negative value
    • end

      T end()
      Returns:
      end
    • start

      T start()
      Returns:
      start
    • minus

      Ranges<T> minus(Ranges<T> right)
      filter range: exclude a range from current range Note: does not support excluding a range that would result in more than one range.
      Parameters:
      right - excluded range
      Returns:
      part of this range that does not include right
    • getRanges

      Collection<? extends Ranges<T>> getRanges()
      Returns:
      a collection of range objects [ only subclasses of Ranges ]
    • isEmpty

      boolean isEmpty()
      Returns:
      whether this object is an empty range
    • contains

      boolean contains(T value)
      Whether an instant is within the range boundaries (lower bound is inclusive, upper bound is exclusive)
      Parameters:
      value - instant
      Returns:
      true if instant time is within range, false otherwise
    • equals

      boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      int hashCode()
      Overrides:
      hashCode in class Object
    • toRangesString

      String toRangesString()
      Returns:
      string representation of the ranges