Package ghidra.util.search.trie
Interface ByteTrieIfc<T>
- All Known Implementing Classes:
ByteTrie
,CaseInsensitiveByteTrie
public interface ByteTrieIfc<T>
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a byte sequence to the trie, with corresponding user item.find
(byte[] value) Finds a byte sequence in the trie and returns a node interface object for it, or null if not present.void
inorder
(TaskMonitor monitor, Op<T> op) Visits all the nodes in the trie such that the visitation order is properly byte value ordered.boolean
isEmpty()
Returns if the trie is empty.int
Returns the number of nodes in the trie; this is essentially equal to the sum of the number of characters in all byte sequences present in the trie, minus their shared prefixes.search
(byte[] text, TaskMonitor monitor) Search an array of bytes using the Aho-Corasick multiple string trie search algorithm.search
(Memory memory, AddressSetView view, TaskMonitor monitor) Search an array of bytes using the Aho-Corasick multiple string trie search algorithm.int
size()
Returns the number of byte sequences in the trie.
-
Method Details
-
isEmpty
boolean isEmpty()Returns if the trie is empty.- Returns:
- if the trie is empty
-
size
int size()Returns the number of byte sequences in the trie.- Returns:
- the number of byte sequences in the trie
-
numberOfNodes
int numberOfNodes()Returns the number of nodes in the trie; this is essentially equal to the sum of the number of characters in all byte sequences present in the trie, minus their shared prefixes.- Returns:
- the number of nodes in the trie
-
add
Adds a byte sequence to the trie, with corresponding user item. Returns if the add took place, or if this add was essentially a replacement of a previously present value (previous user item is lost forever).- Parameters:
value
- the byte sequence to insert into the trieitem
- a user item to store in that location- Returns:
- whether the add took place
-
find
Finds a byte sequence in the trie and returns a node interface object for it, or null if not present.- Parameters:
value
- the byte sequence sought- Returns:
- the node interface if present, or null
-
inorder
Visits all the nodes in the trie such that the visitation order is properly byte value ordered. The client is responsible for not performing actions on non-terminal nodes as necessary.- Parameters:
monitor
- a task monitorop
- the operation to perform- Throws:
CancelledException
- if the user cancels
-
search
Search an array of bytes using the Aho-Corasick multiple string trie search algorithm.- Parameters:
text
- the bytes to search- Returns:
- a list of results (tuple of offset position, text found)
- Throws:
CancelledException
- if the search is cancelled
-
search
List<SearchResult<Address,T>> search(Memory memory, AddressSetView view, TaskMonitor monitor) throws MemoryAccessException, CancelledException Search an array of bytes using the Aho-Corasick multiple string trie search algorithm.- Parameters:
memory
- the memory to search inview
- the AddressSetView to restrict the memory search to.monitor
- the task monitor- Returns:
- a list of results (tuple of offset position, text found)
- Throws:
MemoryAccessException
- if an error occurs reading the memoryCancelledException
- if the search is cancelled
-