Package com.mongodb.internal.connection
Class IndexMap
- java.lang.Object
-
- com.mongodb.internal.connection.IndexMap
-
public abstract class IndexMap extends java.lang.ObjectEfficiently maps each integer in a set to another integer in a set, useful for merging bulk write errors when a bulk write must be split into multiple batches. Has the ability to switch from a range-based to a hash-based map depending on the mappings that have been added.
This class should not be considered a part of the public API.
-
-
Constructor Summary
Constructors Constructor Description IndexMap()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract IndexMapadd(int index, int originalIndex)Add a new index to the mapstatic IndexMapcreate()Create an empty index map.static IndexMapcreate(int startIndex, int count)Create an index map that maps the integers 0..count to startIndex..startIndex + count.abstract intmap(int index)Return the index that the specified index is mapped to.
-
-
-
Method Detail
-
create
public static IndexMap create()
Create an empty index map.- Returns:
- a new index map
-
create
public static IndexMap create(int startIndex, int count)
Create an index map that maps the integers 0..count to startIndex..startIndex + count.- Parameters:
startIndex- the start indexcount- the count- Returns:
- an index map
-
add
public abstract IndexMap add(int index, int originalIndex)
Add a new index to the map- Parameters:
index- the indexoriginalIndex- the original index- Returns:
- an index map with this index added to it
-
map
public abstract int map(int index)
Return the index that the specified index is mapped to.- Parameters:
index- the index- Returns:
- the index it's mapped to
-
-