forked from robert-bor/aho-corasick
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
180 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 6 additions & 20 deletions
26
src/main/java/org/ahocorasick/trie/handler/PayloadEmitDelegateHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,24 @@ | ||
package org.ahocorasick.trie.handler; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
import org.ahocorasick.trie.Emit; | ||
import org.ahocorasick.trie.PayloadEmit; | ||
|
||
public class PayloadEmitDelegateHandler implements StatefulPayloadEmitHandler<String> { | ||
/** | ||
* Convenience wrapper class that delegates every method to a EmitHandler. | ||
*/ | ||
public class PayloadEmitDelegateHandler implements PayloadEmitHandler<String> { | ||
|
||
private StatefulEmitHandler handler; | ||
private EmitHandler handler; | ||
|
||
public PayloadEmitDelegateHandler(StatefulEmitHandler handler) { | ||
public PayloadEmitDelegateHandler(EmitHandler handler) { | ||
this.handler = handler; | ||
|
||
} | ||
|
||
private static List<PayloadEmit<String>> asEmits(Collection<Emit> emits) { | ||
List<PayloadEmit<String>> result = new ArrayList<>(); | ||
for (Emit emit : emits) { | ||
result.add(new PayloadEmit<String>(emit.getStart(), emit.getEnd(), emit.getKeyword(), null)); | ||
} | ||
return result; | ||
} | ||
|
||
@Override | ||
public boolean emit(PayloadEmit<String> emit) { | ||
Emit newEmit = new Emit(emit.getStart(), emit.getEnd(), emit.getKeyword()); | ||
return handler.emit(newEmit); | ||
} | ||
|
||
@Override | ||
public List<PayloadEmit<String>> getEmits() { | ||
List<Emit> emits = this.handler.getEmits(); | ||
return asEmits(emits); | ||
} | ||
} |
21 changes: 0 additions & 21 deletions
21
src/main/java/org/ahocorasick/trie/handler/PayloadEmitDelegateHandlerStateless.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.