You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,7 @@ The scratch space, and by extension the scanner object, are modified during the
70
70
A scanner's scan() method requires two arguments.
71
71
1. First, an object holding the payload for what you want to scan over.
72
72
The wrapper supports Strings, byte arrays, ByteBuffers (both on-heap and direct), and MemorySegments (both heap and native).
73
-
2. Second, an [OnMatchEventHandler](src/main/java/com/dynatrace/vectorscan4j/OnMatchEventHandler.java), which is a user-provided callback that gets executed on every match.
73
+
2. Second, a [MatchHandler](src/main/java/com/dynatrace/vectorscan4j/MatchHandler.java), which is a user-provided callback that gets executed on every match.
74
74
Through that callback, the user can pass arbitrary logic to be executed on every match.
75
75
76
76
## Code example
@@ -92,7 +92,7 @@ we want to count how often each pattern exists inside the input:
OnMatchEventHandler countMatches = (id, from, to, flags) -> {
95
+
MatchHandler countMatches = (id, from, to, flags) -> {
96
96
countsById[id]++;
97
97
returntrue;
98
98
};
@@ -110,7 +110,7 @@ The list of Expression objects specify the set of patterns we want to match. Eve
110
110
starting from 0, in the order in which they are added to the List. A Database object gets instantiated by passing it
111
111
the list of expressions, and specifying an execution mode. A Scanner object then references the Database
112
112
(BlockScanner objects for Databases with Block execution mode, and StreamScanner objects for Databases with Stream execution mode)
113
-
For the scan method, you pass it an input, and an OnMatchEventHandler, which is a functional interface that will get executed on every match. It receives 4 arguments:
113
+
For the scan method, you pass it an input, and a MatchHandler, which is a functional interface that will get executed on every match. It receives 4 arguments:
114
114
115
115
1. The id of the expression that matched.
116
116
2. The byte position of where the match started. Note that by default, vectorscan does not keep track of this value, unless the pattern flag SOM_LEFTMOST is enabled.
@@ -119,7 +119,7 @@ For the scan method, you pass it an input, and an OnMatchEventHandler, which is
119
119
The return value of the callback specifies whether you want the scanning to continue.
120
120
Returning true will continue the scan, while returning false will stop the scanning early.
121
121
122
-
In this example, the provided OnMatchEventHandler increments the value inside an integer array, and then lets the scan continue.
122
+
In this example, the provided MatchHandler increments the value inside an integer array, and then lets the scan continue.
123
123
124
124
### Database Serialization/Deserialization
125
125
@@ -185,7 +185,7 @@ passing it a MemorySegment that points to a non-allocated region of memory might
185
185
try (Database db =newDatabase(List.of(newExpression("p1")), BLOCK_MODE);
0 commit comments