Package org.eclipse.mat.parser.index
Class IndexWriter.IntIndexCollector
java.lang.Object
org.eclipse.mat.parser.index.IndexWriter.IntIndexCollector
- All Implemented Interfaces:
IIndexReader,IIndexReader.IOne2OneIndex
- Enclosing class:
- IndexWriter
public static class IndexWriter.IntIndexCollector
extends Object
implements IIndexReader.IOne2OneIndex
A collector of ArrayIntCompressed.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.mat.parser.index.IIndexReader
IIndexReader.IOne2LongIndex, IIndexReader.IOne2ManyIndex, IIndexReader.IOne2ManyObjectsIndex, IIndexReader.IOne2OneIndex, IIndexReader.IOne2SizeIndex -
Constructor Summary
ConstructorsConstructorDescriptionIntIndexCollector(int size, int mostSignificantBit) Construct a collector of the required size, holding int values up to the specified size. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the backing file.voiddelete()Delete the backing file.intget(int index) Gets from the collected index.int[]getAll(int[] index) Look up all the items from the index array and return the version in the indexint[]getNext(int index, int length) Look up all the items from the index from index to index + length - 1 and return the result in the index for each oniterator()voidset(int index, int value) Sets a value in the collector.intsize()Size of the indexvoidunload()Clear the caches.writeTo(DataOutputStream out, long position) Write the collector to a file.
-
Constructor Details
-
IntIndexCollector
public IntIndexCollector(int size, int mostSignificantBit) Construct a collector of the required size, holding int values up to the specified size.- Parameters:
size- the number of entriesmostSignificantBit- the most significant bit set of any entry
-
-
Method Details
-
writeTo
Write the collector to a file.- Parameters:
indexFile- the file- Returns:
- an index which holds the same values as the collector
- Throws:
IOException- if a problem occurred with the write
-
writeTo
- Throws:
IOException
-
set
public void set(int index, int value) Sets a value in the collector. Safe to be called concurrently from multiple threads. Not safe to mix concurrent get and set calls. -
get
public int get(int index) Gets from the collected index. Safe to be called concurrently from multiple threads. Not safe to mix concurrent get and set calls.- Specified by:
getin interfaceIIndexReader.IOne2OneIndex- Parameters:
index- the int key- Returns:
- the int value
-
close
Description copied from interface:IIndexReaderClose the backing file.- Specified by:
closein interfaceIIndexReader- Throws:
IOException
-
delete
public void delete()Description copied from interface:IIndexReaderDelete the backing file.- Specified by:
deletein interfaceIIndexReader
-
size
public int size()Description copied from interface:IIndexReaderSize of the index- Specified by:
sizein interfaceIIndexReader- Returns:
- number of entries
-
unload
public void unload()Description copied from interface:IIndexReaderClear the caches. Used when the indexes are not current in use and the memory needs to be reclaimed such as when building the dominator tree.- Specified by:
unloadin interfaceIIndexReader
-
getAll
public int[] getAll(int[] index) Description copied from interface:IIndexReader.IOne2OneIndexLook up all the items from the index array and return the version in the index- Specified by:
getAllin interfaceIIndexReader.IOne2OneIndex- Parameters:
index- an array of items to look up- Returns:
- an array of the result items
-
getNext
public int[] getNext(int index, int length) Description copied from interface:IIndexReader.IOne2OneIndexLook up all the items from the index from index to index + length - 1 and return the result in the index for each on- Specified by:
getNextin interfaceIIndexReader.IOne2OneIndex- Parameters:
index- the start indexlength- the number of consecutive items to look up- Returns:
- an array of the result items
-
iterator
-