range-tree-map

A data structure mapping ranges to values based on a TreeMap

License

License

GroupId

GroupId

com.charlesahunt
ArtifactId

ArtifactId

range-tree-map_2.12
Last Version

Last Version

0.3.1
Release Date

Release Date

Type

Type

jar
Description

Description

range-tree-map
A data structure mapping ranges to values based on a TreeMap
Project URL

Project URL

https://github.com/CharlesAHunt/RangeTreeMap
Project Organization

Project Organization

com.charlesahunt
Source Code Management

Source Code Management

https://github.com/CharlesAHunt/TreeRangeMap

Download range-tree-map_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/com.charlesahunt/range-tree-map_2.12/ -->
<dependency>
    <groupId>com.charlesahunt</groupId>
    <artifactId>range-tree-map_2.12</artifactId>
    <version>0.3.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.charlesahunt/range-tree-map_2.12/
implementation 'com.charlesahunt:range-tree-map_2.12:0.3.1'
// https://jarcasting.com/artifacts/com.charlesahunt/range-tree-map_2.12/
implementation ("com.charlesahunt:range-tree-map_2.12:0.3.1")
'com.charlesahunt:range-tree-map_2.12:jar:0.3.1'
<dependency org="com.charlesahunt" name="range-tree-map_2.12" rev="0.3.1">
  <artifact name="range-tree-map_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.charlesahunt', module='range-tree-map_2.12', version='0.3.1')
)
libraryDependencies += "com.charlesahunt" % "range-tree-map_2.12" % "0.3.1"
[com.charlesahunt/range-tree-map_2.12 "0.3.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.6

test (1)

Group / Artifact Type Version
org.scalatest : scalatest_2.12 jar 3.0.5

Project Modules

There are no modules declared in this project.

RangeTreeMap

A generic map from ranges to values based on a TreeMap backed by Scala's red-black tree.

CircleCI Maven Central Waffle.io - Columns and their card count codecov.io

The underlying data structure is a TreeMap backed by a Red-black tree mapping from a lower bound of K to a RangeEntry[K, V], sorted by an implicit Ordering[K]. Overlapping ranges are allowed with put, non overlapping ranges are handled using putCoalesce.

Installation

sbt

"com.charlesahunt" %% "range-tree-map" % "0.3.1"

mill

ivy"com.charlesahunt::range-tree-map:0.3.1"

Usage example

    import scala.math.Ordering._

    val rangeMap = RangeTreeMap.apply[Int, String]

    val rangeKey = RangeKey[Int](lower = 5, upper = 10)
    
    rangeMap.put(rangeKey, "exampleValue")

For more examples and usage, please refer to the Wiki

Release History

  • 0.3.1
    • Fix bug in putCoalesce with intersections on different values
  • 0.3.0
    • Complete putCoalesce - First release with full functionality
  • 0.2.3
    • Fix put to create discreet ranges, refactor putCoalesce which still needs to be completed
  • 0.2.2
    • Fix bug with intersection which reverses the result lower and upper bound in the RangeKey
  • 0.2.1
    • Rough completion of putCoalescing along with intersection and disjoint
  • 0.1.5
    • Fix inclusive bugs in enclose and intersects functionality, add tests
  • 0.1.4
    • Initial design and structuring, some basic functionality

Meta

Charles Hunt – Website[email protected]

Distributed under the MIT license. See LICENSE for more information.

Contributing

  1. Fork it (https://github.com/charlesahunt/rangetreemap/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Versions

Version
0.3.1
0.3.0
0.2.3
0.2.2
0.2.1
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1