Package org.eclipse.mat.parser.index
Class IndexWriter.Identifier
java.lang.Object
org.eclipse.mat.parser.index.IndexWriter.Identifier
- All Implemented Interfaces:
IIndexReader
,IIndexReader.IOne2LongIndex
- Enclosing class:
- IndexWriter
Used to collect the objects by address.
-
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(long id) Add an object.void
close()
Close the backing file.void
delete()
Delete the backing file.long
get
(int index) Look up a long from an int in the index.long[]
getNext
(int index, int length) Look up long from an range of int keys in the index.iterator()
Iterate through the object addresses.int
reverse
(long val) Find the int corresponding to the long in the index value.int
size()
Size of the indexvoid
sort()
Sort the addresses of the objects in order.void
unload()
Clear the caches.
-
Constructor Details
-
Identifier
public Identifier()
-
-
Method Details
-
add
public void add(long id) Add an object.- Parameters:
id
- the object address
-
sort
public void sort()Sort the addresses of the objects in order. Also puts all of the added addresses into an array. Makes a reverse lookup easier. -
size
public int size()Description copied from interface:IIndexReader
Size of the index- Specified by:
size
in interfaceIIndexReader
- Returns:
- number of entries
-
get
public long get(int index) Description copied from interface:IIndexReader.IOne2LongIndex
Look up a long from an int in the index.- Specified by:
get
in interfaceIIndexReader.IOne2LongIndex
- Parameters:
index
- the key- Returns:
- the long
-
reverse
public int reverse(long val) Description copied from interface:IIndexReader.IOne2LongIndex
Find the int corresponding to the long in the index value. The reverse ofIIndexReader.IOne2LongIndex.get(int)
- Specified by:
reverse
in interfaceIIndexReader.IOne2LongIndex
- Parameters:
val
- the value to look up- Returns:
- the correspond int key in the index
-
iterator
Iterate through the object addresses.- Returns:
- the iterator
-
getNext
public long[] getNext(int index, int length) Description copied from interface:IIndexReader.IOne2LongIndex
Look up long from an range of int keys in the index.- Specified by:
getNext
in interfaceIIndexReader.IOne2LongIndex
- Parameters:
index
- the starting pointlength
- the number of items to look up- Returns:
- an array of longs corresponding to the input
-
close
Description copied from interface:IIndexReader
Close the backing file.- Specified by:
close
in interfaceIIndexReader
- Throws:
IOException
-
delete
public void delete()Description copied from interface:IIndexReader
Delete the backing file.- Specified by:
delete
in interfaceIIndexReader
-
unload
Description copied from interface:IIndexReader
Clear 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:
unload
in interfaceIIndexReader
- Throws:
IOException
-