Uploaded image for project: 'Apache Cassandra'
  1. Apache Cassandra
  2. CASSANDRA-3146

Minor changes to IntervalTree

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 1.0.0
    • None
    • None

    Description

      I have a few minor changes to IntervalTree that I feel improve its performance and readability. None of this should have an effect on correctness.

      Details:

      • rename IntervalNode members v_left/v_right to intersects_left/intersects_right, to avoid confusion with the members similarly named "left" and "right"
      • remove the unused IntervalNode.interval member
      • don't calculate the list of intersecting intervals twice in IntervalNode constructor
      • fix comment in IntervalNode constructor: s/i.min/i.max/
      • remove unused java.util.Collections import from IntervalTree.java
      • remove unused code path (checking twice for null == node) in IntervalTree.searchInternal()
      • genericize Interval parameter type to IntervalTree.search()

      There are still a lot of unchecked operations around the Interval generic stuff, and the OCD guy inside me wants it to be competely type-safe, but in real life this ought to be fine like it is. Plus the static Orderings in Interval.java would need to be made instance variables and that would just be annoying.

      Ok, so, go ahead and ignore any of this if appropriate. It just helped me feel better with the code.

      Attachments

        1. 3146.patch.txt
          4 kB
          paul cannon

        Activity

          People

            thepaul paul cannon
            thepaul paul cannon
            paul cannon
            Benjamin Coverston
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: