Package ghidra.util.datastruct
Class RangeMap
- java.lang.Object
-
- ghidra.util.datastruct.RangeMap
-
- All Implemented Interfaces:
java.io.Serializable
public class RangeMap extends java.lang.Object implements java.io.Serializable
Stores ranges of int values throughout "long" space. Every "long" index has an associated int value (initially 0). Users can paint (set) ranges of indexes to a given integer value, overwriting any value that currently exists in that range. This class is implemented using an IntPropertyMap. The first index (0) will always contain a value. The value at any other given index will either be the value stored at that index, or if no value stored there, then the value stored at the nearest previous index that contains a value.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears all current values from the range map and resets the default value.LongIterator
getChangePointIterator(long start, long end)
Returns an iterator over all indexes where the value changes.IndexRangeIterator
getIndexRangeIterator(long index)
Returns an iterator over all occupied ranges in the map.int
getValue(long index)
Returns the int value associated with the given index.ValueRange
getValueRange(long index)
Returns the value range containing the given index.void
paintRange(long start, long end, int value)
Associates the given value with every index from start to end (inclusive) Any previous associates are overwritten.
-
-
-
Method Detail
-
clear
public void clear()
Clears all current values from the range map and resets the default value.
-
paintRange
public void paintRange(long start, long end, int value)
Associates the given value with every index from start to end (inclusive) Any previous associates are overwritten.- Parameters:
start
- the start index of the range to fill.end
- the end index of the range to fillvalue
- the value to put at every index in the range.
-
getValue
public int getValue(long index)
Returns the int value associated with the given index.- Parameters:
index
- the index at which to get the value.
-
getValueRange
public ValueRange getValueRange(long index)
Returns the value range containing the given index. The value range indicates the int value and the start and end index for the range.- Parameters:
index
- the index at which to get the associated value range- Returns:
- the value range
-
getIndexRangeIterator
public IndexRangeIterator getIndexRangeIterator(long index)
Returns an iterator over all occupied ranges in the map.- Parameters:
index
- the index to start the iterator- Returns:
- an iterator over all occupied ranges in the map.
-
getChangePointIterator
public LongIterator getChangePointIterator(long start, long end)
Returns an iterator over all indexes where the value changes.- Parameters:
start
- the starting index to search.end
- the ending index to search.- Returns:
- an iterator over all indexes where the value changes.
-
-