C - Type of the range's end points.public final class RangeCounter<C extends Comparable> extends Object
| Constructor and Description |
|---|
RangeCounter()
Creates a new range map for ranges of the given type.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(com.google.common.collect.Range<C> range)
Adds a range to this map and counts it.
|
static <C extends Comparable> |
create() |
int |
getMaxCount(com.google.common.collect.Range<C> range)
// Given these ranges:
[----------]
[---------]
[--------]
(-)
11111122223212111111111
// Then the above is the max count at each point
|
Stream<Map.Entry<com.google.common.collect.Range<C>,Integer>> |
stream() |
public RangeCounter()
public void add(com.google.common.collect.Range<C> range)
range - A range to add and count.public int getMaxCount(com.google.common.collect.Range<C> range)
// Given these ranges:
[----------]
[---------]
[--------]
(-)
11111122223212111111111
// Then the above is the max count at each point
range - A range to check.add(Range) that include
that point; and returns the maximum count. Ranges that partially overlap the given interval are included in the
returned count.public Stream<Map.Entry<com.google.common.collect.Range<C>,Integer>> stream()
public static <C extends Comparable> RangeCounter<C> create()
C - Type of the range's end points.Copyright © 2020 XIMA MEDIA GmbH. All rights reserved.