Class HashSetCollectionExtractor
java.lang.Object
org.eclipse.mat.internal.collectionextract.HashSetCollectionExtractor
- All Implemented Interfaces:
ICollectionExtractor,IMapExtractor
- Direct Known Subclasses:
TreeSetCollectionExtractor
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.mat.inspections.collectionextract.IMapExtractor
IMapExtractor.EntryObject -
Constructor Summary
ConstructorsConstructorDescriptionHashSetCollectionExtractor(String array_attribute, String key_attribute) HashSetCollectionExtractor(String size_attribute, String array_attribute, String key_attribute, String value_attribute) -
Method Summary
Modifier and TypeMethodDescriptionextractEntries(IObject coll) Extracts the array containing the collection contentint[]extractEntryIds(IObject coll) Returns the object ids (int) for all objects which are contained in the collectionextractMapEntries(IObject coll) Extracts the contents of a map (i.e.getCapacity(IObject coll) Return the capacity of the collection, if applicablegetCollisionRatio(IObject coll) Calculates the collision ratio in the collection.getFillRatio(IObject coll) Calculate the fill ratio of a collectionReturns the number of non-null elements in the collection.Extract the size of the collection.booleanCheck if the collection has capacity, e.g.booleanCheck if the extractor can calculate collision ratiobooleanReturn true if the collection array based and the array can be extracted from the heap dumpbooleanCheck if the collection has extractable contentsbooleanCheck if fill ratio for the collection can be calculated, i.e.booleanhasSize()Check if the size of the collection can be extracted.
-
Constructor Details
-
HashSetCollectionExtractor
-
HashSetCollectionExtractor
-
-
Method Details
-
hasSize
public boolean hasSize()Description copied from interface:ICollectionExtractorCheck if the size of the collection can be extracted.- Specified by:
hasSizein interfaceICollectionExtractor- Returns:
- true if
ICollectionExtractor.getSize(IObject)could be called - See Also:
-
getSize
Description copied from interface:ICollectionExtractorExtract the size of the collection.- Specified by:
getSizein interfaceICollectionExtractor- Parameters:
coll- - the collection to find the size of- Returns:
- the size, or null if not available
- Throws:
SnapshotException- if there is a problem retrieving data from the snapshot- See Also:
-
hasCapacity
public boolean hasCapacity()Description copied from interface:ICollectionExtractorCheck if the collection has capacity, e.g. ArrayList- Specified by:
hasCapacityin interfaceICollectionExtractor- Returns:
- true if
ICollectionExtractor.getCapacity(IObject)could be called - See Also:
-
getCapacity
Description copied from interface:ICollectionExtractorReturn the capacity of the collection, if applicable- Specified by:
getCapacityin interfaceICollectionExtractor- Parameters:
coll- - the collection to find the capacity of- Returns:
- the capacity in bytes, or null if unavailable
- Throws:
SnapshotException- if there is a problem retrieving data from the snapshot- See Also:
-
hasFillRatio
public boolean hasFillRatio()Description copied from interface:ICollectionExtractorCheck if fill ratio for the collection can be calculated, i.e. if it has some predefined capacity and actual size.- Specified by:
hasFillRatioin interfaceICollectionExtractor- Returns:
- true if
ICollectionExtractor.getFillRatio(IObject)could be called - See Also:
-
getFillRatio
Description copied from interface:ICollectionExtractorCalculate the fill ratio of a collection- Specified by:
getFillRatioin interfaceICollectionExtractor- Parameters:
coll- - the collection to find the fill ratio of- Returns:
- the fill ratio, between 0.0 and 1.0, or null if unavailable
- Throws:
SnapshotException- if there is a problem retrieving data from the snapshot- See Also:
-
extractEntries
Description copied from interface:ICollectionExtractorExtracts the array containing the collection content- Specified by:
extractEntriesin interfaceICollectionExtractor- Parameters:
coll- - the collection to find the object array holding its contents- Returns:
- the backing array for the collection
- Throws:
SnapshotException- if there is a problem retrieving data from the snapshot- See Also:
-
hasExtractableArray
public boolean hasExtractableArray()Description copied from interface:ICollectionExtractorReturn true if the collection array based and the array can be extracted from the heap dump- Specified by:
hasExtractableArrayin interfaceICollectionExtractor- Returns:
- true if
ICollectionExtractor.extractEntries(IObject)could be called - See Also:
-
hasExtractableContents
public boolean hasExtractableContents()Description copied from interface:ICollectionExtractorCheck if the collection has extractable contents- Specified by:
hasExtractableContentsin interfaceICollectionExtractor- Returns:
- true if
ICollectionExtractor.extractEntryIds(IObject)could be called - See Also:
-
extractEntryIds
Description copied from interface:ICollectionExtractorReturns the object ids (int) for all objects which are contained in the collection- Specified by:
extractEntryIdsin interfaceICollectionExtractor- Parameters:
coll- - the collection to find the objects it holds- Returns:
- an array of ints which are the object ids.
- Throws:
SnapshotException- if there is a problem retrieving data from the snapshot- See Also:
-
getNumberOfNotNullElements
Description copied from interface:ICollectionExtractorReturns the number of non-null elements in the collection. Requires hasExtractableContents or hasExtractableArray- Specified by:
getNumberOfNotNullElementsin interfaceICollectionExtractor- Parameters:
coll- - the collection to find the number of non-null content objects- Returns:
- the number of non-null elements, or null if not available
- Throws:
SnapshotException- See Also:
-
hasCollisionRatio
public boolean hasCollisionRatio()Description copied from interface:IMapExtractorCheck if the extractor can calculate collision ratio- Specified by:
hasCollisionRatioin interfaceIMapExtractor- Returns:
- true if @
IMapExtractor.getCollisionRatio(IObject)could be called - See Also:
-
getCollisionRatio
Description copied from interface:IMapExtractorCalculates the collision ratio in the collection. Could be an estimate.- Specified by:
getCollisionRatioin interfaceIMapExtractor- Parameters:
coll- - the collection to calculate the collision ratio of- Returns:
- Double number of elements with colliding keys / size
- Throws:
SnapshotException- See Also:
-
extractMapEntries
public Iterator<Map.Entry<IObject,IObject>> extractMapEntries(IObject coll) throws SnapshotException Description copied from interface:IMapExtractorExtracts the contents of a map (i.e. an IObject representing a Map) and provides an Iterator over them- Specified by:
extractMapEntriesin interfaceIMapExtractor- Parameters:
coll- - the map to extract contents from- Returns:
- an Iterator over the entries. If the original Map had an Entry object, the content of the iterator would usually be EntryObject
- Throws:
SnapshotException
-