public class IntRangeToIntMap extends java.lang.Object implements IntToIntMap
| Constructor and Description |
|---|
IntRangeToIntMap(int capacity)
Create an empty map, with given initial capacity
|
IntRangeToIntMap(int[] startPoints,
int[] endPoints)
Create an IntRangeSet given the start points and end points of the integer ranges.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEntry(int start,
int end,
int value)
Add an entry to the map.
|
void |
clear()
Clear the map.
|
boolean |
contains(int value)
Finds whether a key is present in the map.
|
int |
get(int value)
Gets the value for this key.
|
int |
getDefaultValue()
Get the default value used to indicate an unused entry
|
int[] |
getEndPoints()
Get the end points of the ranges
|
int |
getNumberOfRanges()
Get the number of ranges actually in use
|
int[] |
getStartPoints()
Get the start points of the ranges
|
boolean |
isEmpty() |
IntIterator |
keyIterator()
Get an iterator over the integer key values held in the hash map
|
void |
put(int key,
int value)
Adds a key-value pair to the map.
|
boolean |
remove(int value)
Removes a key from the map.
|
void |
setDefaultValue(int defaultValue)
Set the value to be returned to indicate an unused entry
|
int |
size()
Gets the size of the map.
|
java.lang.String |
toString() |
public IntRangeToIntMap(int capacity)
capacity - the initial capacitypublic IntRangeToIntMap(int[] startPoints,
int[] endPoints)
startPoints - the start points of the integer rangesendPoints - the end points of the integer rangesjava.lang.IllegalArgumentException - if the two arrays are different lengths. Other error conditions
in the input are not currently detected.public void setDefaultValue(int defaultValue)
setDefaultValue in interface IntToIntMapdefaultValue - the value to be returned by get(int) if no entry
exists for the supplied keypublic int getDefaultValue()
getDefaultValue in interface IntToIntMapget(int) if no entry
exists for the supplied keypublic void clear()
IntToIntMapclear in interface IntToIntMappublic int size()
IntToIntMapsize in interface IntToIntMappublic boolean isEmpty()
public boolean contains(int value)
IntToIntMapcontains in interface IntToIntMapvalue - Keypublic int get(int value)
IntToIntMapget in interface IntToIntMapvalue - Keypublic boolean remove(int value)
IntToIntMapremove in interface IntToIntMapvalue - Key to removepublic void addEntry(int start,
int end,
int value)
start - the start of the range to be addedend - the end of the range to be addedvalue - the value corresponding to this range of integer keyspublic java.lang.String toString()
toString in class java.lang.Objectpublic int[] getStartPoints()
public int[] getEndPoints()
public int getNumberOfRanges()
public void put(int key,
int value)
put in interface IntToIntMapkey - Keyvalue - Valuepublic IntIterator keyIterator()
keyIterator in interface IntToIntMapCopyright (c) 2004-2022 Saxonica Limited. All rights reserved.