Package com.qfs.util

Class IRangeUnion.Range

java.lang.Object
com.qfs.util.IRangeUnion.Range
Direct Known Subclasses:
MultiVersionDistributedAxisMember.DistributedRange
Enclosing interface:
IRangeUnion

public static class IRangeUnion.Range extends Object
Definition of a range [a, b], with both ends a and b included in the range.
  • Field Details

    • from

      public final long from
      Beginning of the range (inclusive).
    • to

      public final long to
      End of the range (inclusive).
  • Constructor Details

    • Range

      public Range(long from, long to)
      Constructor.
      Parameters:
      from - beginning of the range (inclusive)
      to - end of the range (inclusive)
  • Method Details

    • from

      public long from()
      Gets the defined "from" bound (inclusive).
      Returns:
      the lower bound
    • to

      public long to()
      Gets the defined "to" bound (inclusive).
      Returns:
      the upper bound
    • reverse

      public IRangeUnion.Range reverse()
      Create a new IRangeUnion.Range which from value is equal to this.to and to value is equal to this.from.
      Returns:
      the new reversed IRangeUnion.Range
    • translate

      public IRangeUnion.Range translate(int dv)
      Create a new IRangeUnion.Range which from value is equal to this.from + dv and to value is equal to this.to + dv.
      Parameters:
      dv - the translation amount
      Returns:
      the new translated IRangeUnion.Range
    • isIncludedIn

      public boolean isIncludedIn(IRangeUnion.Range other)
      Test if this range is included into another range. Expects from to be lower than to on this range and the other range.
      Parameters:
      other - the other range that might include this range.
      Returns:
      true if this range is included in the other range.
    • isDisjoint

      public boolean isDisjoint(IRangeUnion.Range other)
      Test if this range is of intersection null with another range.
      Parameters:
      other - other range to compare to this
      Returns:
      true if the range are disjoint, false otherwise
    • toString

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

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

      public boolean contain(long x)
    • equals

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