Package ghidra.util.search.trie
Interface ByteTrieIfc<T>
-
- All Known Implementing Classes:
ByteTrie,CaseInsensitiveByteTrie
public interface ByteTrieIfc<T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanadd(byte[] value, T item)Adds a byte sequence to the trie, with corresponding user item.ByteTrieNodeIfc<T>find(byte[] value)Finds a byte sequence in the trie and returns a node interface object for it, or null if not present.voidinorder(TaskMonitor monitor, Op<T> op)Visits all the nodes in the trie such that the visitation order is properly byte value ordered.booleanisEmpty()Returns if the trie is empty.intnumberOfNodes()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.java.util.List<SearchResult<java.lang.Integer,T>>search(byte[] text, TaskMonitor monitor)Search an array of bytes using the Aho-Corasick multiple string trie search algorithm.java.util.List<SearchResult<Address,T>>search(Memory memory, AddressSetView view, TaskMonitor monitor)Search an array of bytes using the Aho-Corasick multiple string trie search algorithm.intsize()Returns the number of byte sequences in the trie.
-
-
-
Method Detail
-
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
boolean add(byte[] value, T item)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
ByteTrieNodeIfc<T> find(byte[] value)
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
void inorder(TaskMonitor monitor, Op<T> op) throws CancelledException
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
java.util.List<SearchResult<java.lang.Integer,T>> search(byte[] text, TaskMonitor monitor) throws CancelledException
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
-
search
java.util.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:
monitor-text- the bytes to search- Returns:
- a list of results (tuple of offset position, text found)
- Throws:
MemoryAccessExceptionCancelledException
-
-