Package ghidra.program.model.util
Class DefaultPropertyMap<T>
java.lang.Object
ghidra.program.model.util.DefaultPropertyMap<T>
- Type Parameters:
T
- property value type
- All Implemented Interfaces:
PropertyMap<T>
- Direct Known Subclasses:
DefaultIntPropertyMap
PropertyMap is used to store values for a fixed property at
address locations given as longs. The values for the property
must be homogeneous, i.e. all have the same type, and are
determined by which subclass of PropertyMap is instantiated.
For any long the property
manager can be used to tell if the property exists there and
what its value is. It also maintains information that allows it
to efficiently search for the next and previous occurrence of the
property relative to a given address.
The subclass provides the createPage() method that dictates
the type of PropertyPage that will be managed.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn the property description.Get the first Address where a property value exists.Get the last Address where a property value exists.getName()
Get the name for this property map.Get the next address where the property value exists.Get the previous Address where a property value exists.Returns an iterator over the addresses that a property value.getPropertyIterator
(Address start, boolean forward) Returns an iterator over the address having a property value.getPropertyIterator
(Address start, Address end) Returns an iterator over the indices having a property value.getPropertyIterator
(Address start, Address end, boolean forward) Returns an iterator over addresses that have a property value.Returns an iterator over the addresses that have a property value and are in the given address set.getPropertyIterator
(AddressSetView asv, boolean forward) Returns an iterator over the addresses that have a property value and are in the given address set.int
getSize()
Get the number of properties in the map.boolean
hasProperty
(Address addr) returns whether there is a property value at addr.boolean
intersects
(Address start, Address end) Given two addresses, indicate whether there is an address in that range (inclusive) having the property.boolean
intersects
(AddressSetView set) Indicate whether there is an address within the set which exists within this map.void
Moves the properties defined in the range from the start address thru the end address to now be located beginning at the newStart address.boolean
Remove the property value at the given address.boolean
removeRange
(Address start, Address end) Removes all property values within a given range.void
Restore properties from the given input stream.void
saveProperties
(ObjectOutputStream oos, Address start, Address end) Save the properties in the given range to output stream.void
setDescription
(String description) Set the description for this property.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ghidra.program.model.util.PropertyMap
add, get, getValueClass
-
Field Details
-
propertyMgr
-
addrMap
-
description
-
-
Constructor Details
-
DefaultPropertyMap
Construct a PropertyMap- Parameters:
propertyMgr
- property manager that manages storage of properties
-
-
Method Details
-
getName
Description copied from interface:PropertyMap
Get the name for this property map.- Specified by:
getName
in interfacePropertyMap<T>
- Returns:
- map name
-
setDescription
Set the description for this property.- Parameters:
description
- property description
-
getDescription
Return the property description.- Returns:
- the property description
-
intersects
Description copied from interface:PropertyMap
Given two addresses, indicate whether there is an address in that range (inclusive) having the property.- Specified by:
intersects
in interfacePropertyMap<T>
- Parameters:
start
- the start of the range.end
- the end of the range.- Returns:
- boolean true if at least one address in the range has the property, false otherwise.
-
intersects
Description copied from interface:PropertyMap
Indicate whether there is an address within the set which exists within this map.- Specified by:
intersects
in interfacePropertyMap<T>
- Parameters:
set
- set of addresses- Returns:
- boolean true if at least one address in the set has the property, false otherwise.
-
removeRange
Description copied from interface:PropertyMap
Removes all property values within a given range.- Specified by:
removeRange
in interfacePropertyMap<T>
- Parameters:
start
- begin rangeend
- end range, inclusive- Returns:
- true if any property value was removed; return false otherwise.
-
remove
Description copied from interface:PropertyMap
Remove the property value at the given address.- Specified by:
remove
in interfacePropertyMap<T>
- Parameters:
addr
- the address where the property should be removed- Returns:
- true if the property value was removed, false otherwise.
-
hasProperty
Description copied from interface:PropertyMap
returns whether there is a property value at addr.- Specified by:
hasProperty
in interfacePropertyMap<T>
- Parameters:
addr
- the address in question- Returns:
- true if map has value at specified address
-
getNextPropertyAddress
Description copied from interface:PropertyMap
Get the next address where the property value exists.- Specified by:
getNextPropertyAddress
in interfacePropertyMap<T>
- Parameters:
addr
- the address from which to begin the search (exclusive).- Returns:
- property value location after specified
addr
or null if none found
-
getPreviousPropertyAddress
Description copied from interface:PropertyMap
Get the previous Address where a property value exists.- Specified by:
getPreviousPropertyAddress
in interfacePropertyMap<T>
- Parameters:
addr
- the address from which to begin the search (exclusive).- Returns:
- property value location after specified
addr
or null if none found
-
getFirstPropertyAddress
Description copied from interface:PropertyMap
Get the first Address where a property value exists.- Specified by:
getFirstPropertyAddress
in interfacePropertyMap<T>
- Returns:
- first property value location or null if none found
-
getLastPropertyAddress
Description copied from interface:PropertyMap
Get the last Address where a property value exists.- Specified by:
getLastPropertyAddress
in interfacePropertyMap<T>
- Returns:
- last property value location or null if none found
-
getSize
public int getSize()Description copied from interface:PropertyMap
Get the number of properties in the map.- Specified by:
getSize
in interfacePropertyMap<T>
- Returns:
- number of stored property values
-
getPropertyIterator
Description copied from interface:PropertyMap
Returns an iterator over the indices having a property value.- Specified by:
getPropertyIterator
in interfacePropertyMap<T>
- Parameters:
start
- minimum addressend
- maximum address- Returns:
- forward property address iterator
-
getPropertyIterator
Description copied from interface:PropertyMap
Returns an iterator over addresses that have a property value.- Specified by:
getPropertyIterator
in interfacePropertyMap<T>
- Parameters:
start
- minimum addressend
- maximum addressforward
- if true will iterate in increasing address order, otherwise it will start at the end and iterate in decreasing address order- Returns:
- property address iterator
-
getPropertyIterator
Description copied from interface:PropertyMap
Returns an iterator over the addresses that a property value.- Specified by:
getPropertyIterator
in interfacePropertyMap<T>
- Returns:
- forward property address iterator
-
getPropertyIterator
Description copied from interface:PropertyMap
Returns an iterator over the addresses that have a property value and are in the given address set.- Specified by:
getPropertyIterator
in interfacePropertyMap<T>
- Parameters:
asv
- the set of addresses to iterate over.- Returns:
- forward property address iterator
-
getPropertyIterator
Description copied from interface:PropertyMap
Returns an iterator over the addresses that have a property value and are in the given address set.- Specified by:
getPropertyIterator
in interfacePropertyMap<T>
- Parameters:
asv
- the set of addresses to iterate over.forward
- if true will iterate in increasing address order, otherwise it will start at the end and iterate in decreasing address order- Returns:
- property address iterator
-
getPropertyIterator
Description copied from interface:PropertyMap
Returns an iterator over the address having a property value.- Specified by:
getPropertyIterator
in interfacePropertyMap<T>
- Parameters:
start
- the starting addressforward
- if true will iterate in increasing address order, otherwise it will start at the end and iterate in decreasing address order- Returns:
- property address iterator
-
moveRange
Description copied from interface:PropertyMap
Moves the properties defined in the range from the start address thru the end address to now be located beginning at the newStart address. The moved properties will be located at the same relative location to the newStart address as they were previously to the start address.- Specified by:
moveRange
in interfacePropertyMap<T>
- Parameters:
start
- the start of the range to move.end
- the end of the range to move.newStart
- the new start location of the range of properties after the move.
-
saveProperties
Save the properties in the given range to output stream.- Parameters:
oos
- output stream to write tostart
- start address in the rangeend
- end address in the range- Throws:
IOException
- if there a problem doing the write
-
restoreProperties
Restore properties from the given input stream.- Parameters:
ois
- input stream- Throws:
IOException
- if there is a problem reading from the streamClassNotFoundException
- if the class for the object being read is not in the class path
-