test_class.file: src/server/src/test/java/io/cassandrareaper/service/RingRangeTest.java
test_class.identifier: RingRangeTest
test_case.body: @Test
    public void mergeTest() {
      List<RingRange> ranges = Lists.newArrayList();
      ranges.add(new RingRange(BigInteger.valueOf(30L), BigInteger.valueOf(50L)));
      ranges.add(new RingRange(BigInteger.valueOf(10L), BigInteger.valueOf(30L)));
      ranges.add(new RingRange(BigInteger.valueOf(80L), BigInteger.valueOf(10L)));
      RingRange merged = RingRange.merge(ranges);
      assertEquals("80", merged.getStart().toString());
      assertEquals("50", merged.getEnd().toString());
    }
test_case.class_method_signature: RingRangeTest.mergeTest()
test_case.full_signature: @Test public void mergeTest()
test_case.identifier: mergeTest
test_case.invocations: newArrayList add valueOf valueOf add valueOf valueOf add valueOf valueOf merge assertEquals toString getStart assertEquals toString getEnd
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void mergeTest()
focal_class.declarator: START_COMPARATOR
        = (RingRange o1, RingRange o2) -> o1.start.compareTo(o2.start)
focal_class.modifier: public static final
focal_class.original_string: public static final Comparator<RingRange> START_COMPARATOR
        = (RingRange o1, RingRange o2) -> o1.start.compareTo(o2.start);
focal_class.type: Comparator<RingRange>
focal_class.var_name: START_COMPARATOR
focal_class.declarator: start
focal_class.modifier: private final
focal_class.original_string: private final BigInteger start;
focal_class.type: BigInteger
focal_class.var_name: start
focal_class.declarator: end
focal_class.modifier: private final
focal_class.original_string: private final BigInteger end;
focal_class.type: BigInteger
focal_class.var_name: end
focal_class.file: src/server/src/main/java/io/cassandrareaper/service/RingRange.java
focal_class.identifier: RingRange
focal_class.class_method_signature: RingRange.RingRange(BigInteger start, BigInteger end)
focal_class.full_signature: public  RingRange(BigInteger start, BigInteger end)
focal_class.identifier: RingRange
focal_class.modifiers: public
focal_class.parameters: (BigInteger start, BigInteger end)
focal_class.signature:  RingRange(BigInteger start, BigInteger end)
focal_class.class_method_signature: RingRange.RingRange(String... range)
focal_class.full_signature: public  RingRange(String... range)
focal_class.identifier: RingRange
focal_class.modifiers: public
focal_class.parameters: (String... range)
focal_class.signature:  RingRange(String... range)
focal_class.class_method_signature: RingRange.getStart()
focal_class.full_signature: public BigInteger getStart()
focal_class.identifier: getStart
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: BigInteger
focal_class.signature: BigInteger getStart()
focal_class.class_method_signature: RingRange.getEnd()
focal_class.full_signature: public BigInteger getEnd()
focal_class.identifier: getEnd
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: BigInteger
focal_class.signature: BigInteger getEnd()
focal_class.class_method_signature: RingRange.span(BigInteger ringSize)
focal_class.full_signature: public BigInteger span(BigInteger ringSize)
focal_class.identifier: span
focal_class.modifiers: public
focal_class.parameters: (BigInteger ringSize)
focal_class.return: BigInteger
focal_class.signature: BigInteger span(BigInteger ringSize)
focal_class.class_method_signature: RingRange.encloses(RingRange other)
focal_class.full_signature: public boolean encloses(RingRange other)
focal_class.identifier: encloses
focal_class.modifiers: public
focal_class.parameters: (RingRange other)
focal_class.return: boolean
focal_class.signature: boolean encloses(RingRange other)
focal_class.class_method_signature: RingRange.isWrapping()
focal_class.full_signature: @JsonIgnore public boolean isWrapping()
focal_class.identifier: isWrapping
focal_class.modifiers: @JsonIgnore public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isWrapping()
focal_class.class_method_signature: RingRange.toString()
focal_class.full_signature: @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_class.class_method_signature: RingRange.merge(List<RingRange> ranges)
focal_class.full_signature: public static RingRange merge(List<RingRange> ranges)
focal_class.identifier: merge
focal_class.modifiers: public static
focal_class.parameters: (List<RingRange> ranges)
focal_class.return: RingRange
focal_class.signature: RingRange merge(List<RingRange> ranges)
focal_method.body: public static RingRange merge(List<RingRange> ranges) {
      // sor
      Collections.sort(ranges, START_COMPARATOR);
  
      // find gap
      int gap = 0;
      for (; gap < ranges.size() - 1; gap++) {
        RingRange left = ranges.get(gap);
        RingRange right = ranges.get(gap + 1);
        if (!left.end.equals(right.start)) {
          break;
        }
      }
  
      // return merged
      if (gap == ranges.size() - 1) {
        return new RingRange(ranges.get(0).start, ranges.get(gap).end);
      } else {
        return new RingRange(ranges.get(gap + 1).start, ranges.get(gap).end);
      }
    }
focal_method.class_method_signature: RingRange.merge(List<RingRange> ranges)
focal_method.full_signature: public static RingRange merge(List<RingRange> ranges)
focal_method.identifier: merge
focal_method.invocations: sort size get get equals size get get get get
focal_method.modifiers: public static
focal_method.parameters: (List<RingRange> ranges)
focal_method.return: RingRange
focal_method.signature: RingRange merge(List<RingRange> ranges)