Package generic

# Class RangeMapSetter<E,D,R,V>

java.lang.Object
generic.RangeMapSetter<E,D,R,V>

Type Parameters:
  `E` - the type of entries
  `D` - the type of range bounds
  `R` - the type of ranges
  `V` - the type of values

Direct Known Subclasses:
  `Span.SpanMapSetter`

public abstract class RangeMapSetter<E,D,R,V> extends Object
A method outline for setting an entry in a range map where coalescing is desired

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RangeMapSetter()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected abstract int`
  `compare(D d1, D d2)`
  Compare two values as in `Comparator.compare(Object, Object)`
  `protected boolean`
  `connects(R r1, R r2)`
  Check if the two ranges are connected
  `protected abstract Iterable<E>`
  `getIntersecting(D lower, D upper)`
  Get all entries intersecting the closed range formed by the given bounds
  `protected abstract D`
  `getLower(R range)`
  Get the lower bound of the range
  `protected abstract D`
  `getNext(D d)`
  Get the number immediately following the given bound
  `protected D`
  `getNextOrSame(D d)`
  Get the next bound or this same bound, if the next doesn't exist
  `protected abstract D`
  `getPrevious(D d)`
  Get the number immediately preceding the given bound
  `protected D`
  `getPreviousOrSame(D d)`
  Get the previous bound or this same bound, if the previous doesn't exist
  `protected abstract R`
  `getRange(E entry)`
  Get the range of the given entry
  `protected abstract D`
  `getUpper(R range)`
  Get the upper bound of the range
  `protected abstract V`
  `getValue(E entry)`
  Get the value of the given entry
  `protected abstract E`
  `put(R range, V value)`
  Place an entry into the map
  `protected abstract void`
  `remove(E entry)`
  Remove an entry from the map
  `E`
  `set(D lower, D upper, V value)`
  Entry point: Set the given range to the given value, coalescing where possible
  `E`
  `set(R range, V value)`
  Entry point: Set the given range to the given value, coalescing where possible
  `protected abstract R`
  `toSpan(D lower, D upper)`
  Create a closed range with the given bounds

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### RangeMapSetter

    public RangeMapSetter()

- ## Method Details

  - ### compare

    protected abstract int compare(D d1, D d2)
    Compare two values as in `Comparator.compare(Object, Object)`
    Parameters:
      `d1` - the first value
      `d2` - the second value
    Returns:
      the result

  - ### getRange

    protected abstract R getRange(E entry)
    Get the range of the given entry
    Parameters:
      `entry` - the entry
    Returns:
      the range

  - ### getValue

    protected abstract V getValue(E entry)
    Get the value of the given entry
    Parameters:
      `entry` - the entry
    Returns:
      the value

  - ### remove

    protected abstract void remove(E entry)
    Remove an entry from the map
    Parameters:
      `entry` - the entry

  - ### getLower

    protected abstract D getLower(R range)
    Get the lower bound of the range
    Parameters:
      `range` - the range
    Returns:
      the lower bound

  - ### getUpper

    protected abstract D getUpper(R range)
    Get the upper bound of the range
    Parameters:
      `range` - the range
    Returns:
      the upper bound

  - ### toSpan

    protected abstract R toSpan(D lower, D upper)
    Create a closed range with the given bounds
    Parameters:
      `lower` - the lower bound
      `upper` - the upper bound
    Returns:
      the range

  - ### getPrevious

    protected abstract D getPrevious(D d)
    Get the number immediately preceding the given bound
    Parameters:
      `d` - the bound
    Returns:
      the previous bound, or null if it doesn't exist

  - ### getNext

    protected abstract D getNext(D d)
    Get the number immediately following the given bound
    Parameters:
      `d` - the bound
    Returns:
      the next bound, or null if it doesn't exist

  - ### getIntersecting

    protected abstract Iterable<E> getIntersecting(D lower, D upper)
    Get all entries intersecting the closed range formed by the given bounds
    Parameters:
      `lower` - the lower bound
      `upper` - the upper bound
    Returns:
      the intersecting entries

  - ### put

    protected abstract E put(R range, V value)
    Place an entry into the map
    Parameters:
      `range` - the range of the entry
      `value` - the value of the entry
    Returns:
      the new entry (or an existing entry)

  - ### getPreviousOrSame

    protected D getPreviousOrSame(D d)
    Get the previous bound or this same bound, if the previous doesn't exist
    Parameters:
      `d` - the bound
    Returns:
      the previous or same bound

  - ### getNextOrSame

    protected D getNextOrSame(D d)
    Get the next bound or this same bound, if the next doesn't exist
    Parameters:
      `d` - the bound
    Returns:
      the next or same bound

  - ### connects

    protected boolean connects(R r1, R r2)
    Check if the two ranges are connected

    The ranges are connected if they intersect, or if their bounds abut.

    Parameters:
      `r1` - the first range
      `r2` - the second range
    Returns:
      true if connected

  - ### set

    public E set(R range, V value)
    Entry point: Set the given range to the given value, coalescing where possible
    Parameters:
      `range` - the range
      `value` - the value
    Returns:
      the entry containing the value

  - ### set

    public E set(D lower, D upper, V value)
    Entry point: Set the given range to the given value, coalescing where possible
    Parameters:
      `lower` - the lower bound
      `upper` - the upper bound
      `value` - the value
    Returns:
      the entry containing the value