Optimize imports

Reformatted code (Java convention; tab is 4 spaces)
This commit is contained in:
robert-bor 2016-11-30 12:07:03 +01:00
parent 5edf6d8126
commit a45df04a26
6 changed files with 128 additions and 131 deletions

View File

@ -7,4 +7,5 @@ public interface Intervalable extends Comparable {
public int getEnd(); public int getEnd();
public int size(); public int size();
} }

View File

@ -74,11 +74,11 @@ public class State {
return nextState(character, false); return nextState(character, false);
} }
public State nextStateIgnoreRootState(final Character character) { public State nextStateIgnoreRootState(Character character) {
return nextState(character, true); return nextState(character, true);
} }
public State addState(final String keyword) { public State addState(String keyword) {
State state = this; State state = this;
for (final Character character : keyword.toCharArray()) { for (final Character character : keyword.toCharArray()) {
@ -88,7 +88,7 @@ public class State {
return state; return state;
} }
public State addState(final Character character) { public State addState(Character character) {
State nextState = nextStateIgnoreRootState(character); State nextState = nextStateIgnoreRootState(character);
if (nextState == null) { if (nextState == null) {
nextState = new State(this.depth + 1); nextState = new State(this.depth + 1);
@ -101,14 +101,14 @@ public class State {
return this.depth; return this.depth;
} }
public void addEmit(final String keyword) { public void addEmit(String keyword) {
if (this.emits == null) { if (this.emits == null) {
this.emits = new TreeSet<>(); this.emits = new TreeSet<>();
} }
this.emits.add(keyword); this.emits.add(keyword);
} }
public void addEmit(final Collection<String> emits) { public void addEmit(Collection<String> emits) {
for (String emit : emits) { for (String emit : emits) {
addEmit(emit); addEmit(emit);
} }

View File

@ -1,15 +1,17 @@
package org.ahocorasick.trie; package org.ahocorasick.trie;
import static java.lang.Character.isWhitespace; import org.ahocorasick.interval.IntervalTree;
import org.ahocorasick.interval.Intervalable;
import org.ahocorasick.trie.handler.DefaultEmitHandler;
import org.ahocorasick.trie.handler.EmitHandler;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Queue; import java.util.Queue;
import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.LinkedBlockingDeque;
import org.ahocorasick.interval.IntervalTree;
import org.ahocorasick.interval.Intervalable; import static java.lang.Character.isWhitespace;
import org.ahocorasick.trie.handler.DefaultEmitHandler;
import org.ahocorasick.trie.handler.EmitHandler;
/** /**
* Based on the Aho-Corasick white paper, Bell technologies: * Based on the Aho-Corasick white paper, Bell technologies:
@ -32,7 +34,6 @@ public class Trie {
* Used by the builder to add a text search keyword. * Used by the builder to add a text search keyword.
* *
* @param keyword The search term to add to the list of search terms. * @param keyword The search term to add to the list of search terms.
*
* @throws NullPointerException if the keyword is null. * @throws NullPointerException if the keyword is null.
*/ */
private void addKeyword(String keyword) { private void addKeyword(String keyword) {
@ -314,7 +315,8 @@ public class Trie {
/** /**
* Default (empty) constructor. * Default (empty) constructor.
*/ */
private TrieBuilder() {} private TrieBuilder() {
}
/** /**
* Configure the Trie to ignore case when searching for keywords in * Configure the Trie to ignore case when searching for keywords in
@ -343,7 +345,6 @@ public class Trie {
* Adds a keyword to the Trie's list of text search keywords. * Adds a keyword to the Trie's list of text search keywords.
* *
* @param keyword The keyword to add to the list. * @param keyword The keyword to add to the list.
*
* @return This builder. * @return This builder.
* @throws NullPointerException if the keyword is null. * @throws NullPointerException if the keyword is null.
*/ */
@ -356,7 +357,6 @@ public class Trie {
* Adds a list of keywords to the Trie's list of text search keywords. * Adds a list of keywords to the Trie's list of text search keywords.
* *
* @param keywords The keywords to add to the list. * @param keywords The keywords to add to the list.
*
* @return This builder. * @return This builder.
*/ */
public TrieBuilder addKeywords(final String... keywords) { public TrieBuilder addKeywords(final String... keywords) {
@ -368,7 +368,6 @@ public class Trie {
* Adds a list of keywords to the Trie's list of text search keywords. * Adds a list of keywords to the Trie's list of text search keywords.
* *
* @param keywords The keywords to add to the list. * @param keywords The keywords to add to the list.
*
* @return This builder. * @return This builder.
*/ */
public TrieBuilder addKeywords(final Collection<String> keywords) { public TrieBuilder addKeywords(final Collection<String> keywords) {
@ -420,18 +419,16 @@ public class Trie {
} }
/** /**
* @deprecated Use ignoreCase()
*
* @return This builder. * @return This builder.
* @deprecated Use ignoreCase()
*/ */
public TrieBuilder caseInsensitive() { public TrieBuilder caseInsensitive() {
return ignoreCase(); return ignoreCase();
} }
/** /**
* @deprecated Use ignoreOverlaps()
*
* @return This builder. * @return This builder.
* @deprecated Use ignoreOverlaps()
*/ */
public TrieBuilder removeOverlaps() { public TrieBuilder removeOverlaps() {
return ignoreOverlaps(); return ignoreOverlaps();

View File

@ -3,20 +3,20 @@ package org.ahocorasick.interval;
import org.junit.Test; import org.junit.Test;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import static java.util.Collections.sort;
import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertEquals;
public class IntervalableComparatorByPositionTest { public class IntervalableComparatorByPositionTest {
@Test @Test
public void sortOnPosition() { public void sortOnPosition() {
List<Intervalable> intervals = new ArrayList<>(); List<Intervalable> intervals = new ArrayList<Intervalable>();
intervals.add(new Interval(4, 5)); intervals.add(new Interval(4, 5));
intervals.add(new Interval(1, 4)); intervals.add(new Interval(1, 4));
intervals.add(new Interval(3, 8)); intervals.add(new Interval(3, 8));
sort(intervals, new IntervalableComparatorByPosition()); Collections.sort(intervals, new IntervalableComparatorByPosition());
assertEquals(4, intervals.get(0).size()); assertEquals(4, intervals.get(0).size());
assertEquals(6, intervals.get(1).size()); assertEquals(6, intervals.get(1).size());
assertEquals(2, intervals.get(2).size()); assertEquals(2, intervals.get(2).size());

View File

@ -3,20 +3,20 @@ package org.ahocorasick.interval;
import org.junit.Test; import org.junit.Test;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import static java.util.Collections.sort;
import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertEquals;
public class IntervalableComparatorBySizeTest { public class IntervalableComparatorBySizeTest {
@Test @Test
public void sortOnSize() { public void sortOnSize() {
List<Intervalable> intervals = new ArrayList<>(); List<Intervalable> intervals = new ArrayList<Intervalable>();
intervals.add(new Interval(4, 5)); intervals.add(new Interval(4, 5));
intervals.add(new Interval(1, 4)); intervals.add(new Interval(1, 4));
intervals.add(new Interval(3, 8)); intervals.add(new Interval(3, 8));
sort(intervals, new IntervalableComparatorBySize()); Collections.sort(intervals, new IntervalableComparatorBySize());
assertEquals(6, intervals.get(0).size()); assertEquals(6, intervals.get(0).size());
assertEquals(4, intervals.get(1).size()); assertEquals(4, intervals.get(1).size());
assertEquals(2, intervals.get(2).size()); assertEquals(2, intervals.get(2).size());
@ -24,10 +24,10 @@ public class IntervalableComparatorBySizeTest {
@Test @Test
public void sortOnSizeThenPosition() { public void sortOnSizeThenPosition() {
List<Intervalable> intervals = new ArrayList<>(); List<Intervalable> intervals = new ArrayList<Intervalable>();
intervals.add(new Interval(4, 7)); intervals.add(new Interval(4, 7));
intervals.add(new Interval(2, 5)); intervals.add(new Interval(2, 5));
sort(intervals, new IntervalableComparatorBySize()); Collections.sort(intervals, new IntervalableComparatorBySize());
assertEquals(2, intervals.get(0).getStart()); assertEquals(2, intervals.get(0).getStart());
assertEquals(4, intervals.get(1).getStart()); assertEquals(4, intervals.get(1).getStart());
} }

View File

@ -7,10 +7,9 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
import static java.util.concurrent.ThreadLocalRandom.current;
import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertEquals;
import static org.ahocorasick.trie.Trie.builder;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
public class TrieTest { public class TrieTest {
@ -36,7 +35,7 @@ public class TrieTest {
@Test @Test
public void keywordAndTextAreTheSame() { public void keywordAndTextAreTheSame() {
Trie trie = builder() Trie trie = Trie.builder()
.addKeyword(ALPHABET[0]) .addKeyword(ALPHABET[0])
.build(); .build();
Collection<Emit> emits = trie.parseText(ALPHABET[0]); Collection<Emit> emits = trie.parseText(ALPHABET[0]);
@ -46,7 +45,7 @@ public class TrieTest {
@Test @Test
public void keywordAndTextAreTheSameFirstMatch() { public void keywordAndTextAreTheSameFirstMatch() {
Trie trie = builder() Trie trie = Trie.builder()
.addKeyword(ALPHABET[0]) .addKeyword(ALPHABET[0])
.build(); .build();
Emit firstMatch = trie.firstMatch(ALPHABET[0]); Emit firstMatch = trie.firstMatch(ALPHABET[0]);
@ -55,7 +54,7 @@ public class TrieTest {
@Test @Test
public void textIsLongerThanKeyword() { public void textIsLongerThanKeyword() {
Trie trie = builder() Trie trie = Trie.builder()
.addKeyword(ALPHABET[0]) .addKeyword(ALPHABET[0])
.build(); .build();
Collection<Emit> emits = trie.parseText(" " + ALPHABET[0]); Collection<Emit> emits = trie.parseText(" " + ALPHABET[0]);
@ -65,7 +64,7 @@ public class TrieTest {
@Test @Test
public void textIsLongerThanKeywordFirstMatch() { public void textIsLongerThanKeywordFirstMatch() {
Trie trie = builder() Trie trie = Trie.builder()
.addKeyword(ALPHABET[0]) .addKeyword(ALPHABET[0])
.build(); .build();
Emit firstMatch = trie.firstMatch(" " + ALPHABET[0]); Emit firstMatch = trie.firstMatch(" " + ALPHABET[0]);
@ -74,7 +73,7 @@ public class TrieTest {
@Test @Test
public void variousKeywordsOneMatch() { public void variousKeywordsOneMatch() {
Trie trie = builder() Trie trie = Trie.builder()
.addKeywords(ALPHABET) .addKeywords(ALPHABET)
.build(); .build();
Collection<Emit> emits = trie.parseText("bcd"); Collection<Emit> emits = trie.parseText("bcd");
@ -84,7 +83,7 @@ public class TrieTest {
@Test @Test
public void variousKeywordsFirstMatch() { public void variousKeywordsFirstMatch() {
Trie trie = builder() Trie trie = Trie.builder()
.addKeywords(ALPHABET) .addKeywords(ALPHABET)
.build(); .build();
Emit firstMatch = trie.firstMatch("bcd"); Emit firstMatch = trie.firstMatch("bcd");
@ -93,7 +92,7 @@ public class TrieTest {
@Test @Test
public void ushersTestAndStopOnHit() { public void ushersTestAndStopOnHit() {
Trie trie = builder() Trie trie = Trie.builder()
.addKeywords(PRONOUNS) .addKeywords(PRONOUNS)
.stopOnHit() .stopOnHit()
.build(); .build();
@ -106,7 +105,7 @@ public class TrieTest {
@Test @Test
public void ushersTest() { public void ushersTest() {
Trie trie = builder() Trie trie = Trie.builder()
.addKeywords(PRONOUNS) .addKeywords(PRONOUNS)
.build(); .build();
Collection<Emit> emits = trie.parseText("ushers"); Collection<Emit> emits = trie.parseText("ushers");
@ -119,7 +118,7 @@ public class TrieTest {
@Test @Test
public void ushersTestWithCapitalKeywords() { public void ushersTestWithCapitalKeywords() {
Trie trie = builder() Trie trie = Trie.builder()
.ignoreCase() .ignoreCase()
.addKeyword("HERS") .addKeyword("HERS")
.addKeyword("HIS") .addKeyword("HIS")
@ -136,7 +135,7 @@ public class TrieTest {
@Test @Test
public void ushersTestFirstMatch() { public void ushersTestFirstMatch() {
Trie trie = builder() Trie trie = Trie.builder()
.addKeywords(PRONOUNS) .addKeywords(PRONOUNS)
.build(); .build();
Emit firstMatch = trie.firstMatch("ushers"); Emit firstMatch = trie.firstMatch("ushers");
@ -145,7 +144,7 @@ public class TrieTest {
@Test @Test
public void ushersTestByCallback() { public void ushersTestByCallback() {
Trie trie = builder() Trie trie = Trie.builder()
.addKeywords(PRONOUNS) .addKeywords(PRONOUNS)
.build(); .build();
@ -167,7 +166,7 @@ public class TrieTest {
@Test @Test
public void misleadingTest() { public void misleadingTest() {
Trie trie = builder() Trie trie = Trie.builder()
.addKeyword("hers") .addKeyword("hers")
.build(); .build();
Collection<Emit> emits = trie.parseText("h he her hers"); Collection<Emit> emits = trie.parseText("h he her hers");
@ -177,7 +176,7 @@ public class TrieTest {
@Test @Test
public void misleadingTestFirstMatch() { public void misleadingTestFirstMatch() {
Trie trie = builder() Trie trie = Trie.builder()
.addKeyword("hers") .addKeyword("hers")
.build(); .build();
Emit firstMatch = trie.firstMatch("h he her hers"); Emit firstMatch = trie.firstMatch("h he her hers");
@ -186,7 +185,7 @@ public class TrieTest {
@Test @Test
public void recipes() { public void recipes() {
Trie trie = builder() Trie trie = Trie.builder()
.addKeywords(FOOD) .addKeywords(FOOD)
.build(); .build();
Collection<Emit> emits = trie.parseText("2 cauliflowers, 3 tomatoes, 4 slices of veal, 100g broccoli"); Collection<Emit> emits = trie.parseText("2 cauliflowers, 3 tomatoes, 4 slices of veal, 100g broccoli");
@ -199,7 +198,7 @@ public class TrieTest {
@Test @Test
public void recipesFirstMatch() { public void recipesFirstMatch() {
Trie trie = builder() Trie trie = Trie.builder()
.addKeywords(FOOD) .addKeywords(FOOD)
.build(); .build();
Emit firstMatch = trie.firstMatch("2 cauliflowers, 3 tomatoes, 4 slices of veal, 100g broccoli"); Emit firstMatch = trie.firstMatch("2 cauliflowers, 3 tomatoes, 4 slices of veal, 100g broccoli");
@ -209,7 +208,7 @@ public class TrieTest {
@Test @Test
public void longAndShortOverlappingMatch() { public void longAndShortOverlappingMatch() {
Trie trie = builder() Trie trie = Trie.builder()
.addKeyword("he") .addKeyword("he")
.addKeyword("hehehehe") .addKeyword("hehehehe")
.build(); .build();
@ -226,7 +225,7 @@ public class TrieTest {
@Test @Test
public void nonOverlapping() { public void nonOverlapping() {
Trie trie = builder().removeOverlaps() Trie trie = Trie.builder().removeOverlaps()
.addKeyword("ab") .addKeyword("ab")
.addKeyword("cba") .addKeyword("cba")
.addKeyword("ababc") .addKeyword("ababc")
@ -241,7 +240,7 @@ public class TrieTest {
@Test @Test
public void nonOverlappingFirstMatch() { public void nonOverlappingFirstMatch() {
Trie trie = builder().removeOverlaps() Trie trie = Trie.builder().removeOverlaps()
.addKeyword("ab") .addKeyword("ab")
.addKeyword("cba") .addKeyword("cba")
.addKeyword("ababc") .addKeyword("ababc")
@ -253,7 +252,7 @@ public class TrieTest {
@Test @Test
public void containsMatch() { public void containsMatch() {
Trie trie = builder().removeOverlaps() Trie trie = Trie.builder().removeOverlaps()
.addKeyword("ab") .addKeyword("ab")
.addKeyword("cba") .addKeyword("cba")
.addKeyword("ababc") .addKeyword("ababc")
@ -263,7 +262,7 @@ public class TrieTest {
@Test @Test
public void startOfChurchillSpeech() { public void startOfChurchillSpeech() {
Trie trie = builder().removeOverlaps() Trie trie = Trie.builder().removeOverlaps()
.addKeyword("T") .addKeyword("T")
.addKeyword("u") .addKeyword("u")
.addKeyword("ur") .addKeyword("ur")
@ -281,7 +280,7 @@ public class TrieTest {
@Test @Test
public void partialMatch() { public void partialMatch() {
Trie trie = builder() Trie trie = Trie.builder()
.onlyWholeWords() .onlyWholeWords()
.addKeyword("sugar") .addKeyword("sugar")
.build(); .build();
@ -292,7 +291,7 @@ public class TrieTest {
@Test @Test
public void partialMatchFirstMatch() { public void partialMatchFirstMatch() {
Trie trie = builder() Trie trie = Trie.builder()
.onlyWholeWords() .onlyWholeWords()
.addKeyword("sugar") .addKeyword("sugar")
.build(); .build();
@ -303,7 +302,7 @@ public class TrieTest {
@Test @Test
public void tokenizeFullSentence() { public void tokenizeFullSentence() {
Trie trie = builder() Trie trie = Trie.builder()
.addKeywords(GREEK_LETTERS) .addKeywords(GREEK_LETTERS)
.build(); .build();
Collection<Token> tokens = trie.tokenize("Hear: Alpha team first, Beta from the rear, Gamma in reserve"); Collection<Token> tokens = trie.tokenize("Hear: Alpha team first, Beta from the rear, Gamma in reserve");
@ -321,7 +320,7 @@ public class TrieTest {
// @see https://github.com/robert-bor/aho-corasick/issues/5 // @see https://github.com/robert-bor/aho-corasick/issues/5
@Test @Test
public void testStringIndexOutOfBoundsException() { public void testStringIndexOutOfBoundsException() {
Trie trie = builder().ignoreCase().onlyWholeWords() Trie trie = Trie.builder().ignoreCase().onlyWholeWords()
.addKeywords(UNICODE) .addKeywords(UNICODE)
.build(); .build();
Collection<Emit> emits = trie.parseText("TurninG OnCe AgAiN BÖRKÜ"); Collection<Emit> emits = trie.parseText("TurninG OnCe AgAiN BÖRKÜ");
@ -335,7 +334,7 @@ public class TrieTest {
@Test @Test
public void testIgnoreCase() { public void testIgnoreCase() {
Trie trie = builder().ignoreCase() Trie trie = Trie.builder().ignoreCase()
.addKeywords(UNICODE) .addKeywords(UNICODE)
.build(); .build();
Collection<Emit> emits = trie.parseText("TurninG OnCe AgAiN BÖRKÜ"); Collection<Emit> emits = trie.parseText("TurninG OnCe AgAiN BÖRKÜ");
@ -349,7 +348,7 @@ public class TrieTest {
@Test @Test
public void testIgnoreCaseFirstMatch() { public void testIgnoreCaseFirstMatch() {
Trie trie = builder().ignoreCase() Trie trie = Trie.builder().ignoreCase()
.addKeywords(UNICODE) .addKeywords(UNICODE)
.build(); .build();
Emit firstMatch = trie.firstMatch("TurninG OnCe AgAiN BÖRKÜ"); Emit firstMatch = trie.firstMatch("TurninG OnCe AgAiN BÖRKÜ");
@ -359,7 +358,7 @@ public class TrieTest {
@Test @Test
public void tokenizeTokensInSequence() { public void tokenizeTokensInSequence() {
Trie trie = builder() Trie trie = Trie.builder()
.addKeywords(GREEK_LETTERS) .addKeywords(GREEK_LETTERS)
.build(); .build();
Collection<Token> tokens = trie.tokenize("Alpha Beta Gamma"); Collection<Token> tokens = trie.tokenize("Alpha Beta Gamma");
@ -369,7 +368,7 @@ public class TrieTest {
// @see https://github.com/robert-bor/aho-corasick/issues/7 // @see https://github.com/robert-bor/aho-corasick/issues/7
@Test @Test
public void testZeroLength() { public void testZeroLength() {
Trie trie = builder().ignoreOverlaps().onlyWholeWords().ignoreCase() Trie trie = Trie.builder().ignoreOverlaps().onlyWholeWords().ignoreCase()
.addKeyword("") .addKeyword("")
.build(); .build();
trie.tokenize("Try a natural lip and subtle bronzer to keep all the focus on those big bright eyes with NARS Eyeshadow Duo in Rated R And the winner is... Boots No7 Advanced Renewal Anti-ageing Glycolic Peel Kit ($25 amazon.com) won most-appealing peel."); trie.tokenize("Try a natural lip and subtle bronzer to keep all the focus on those big bright eyes with NARS Eyeshadow Duo in Rated R And the winner is... Boots No7 Advanced Renewal Anti-ageing Glycolic Peel Kit ($25 amazon.com) won most-appealing peel.");
@ -380,7 +379,7 @@ public class TrieTest {
public void testUnicode1() { public void testUnicode1() {
String target = "LİKE THIS"; // The second character ('İ') is Unicode, which was read by AC as a 2-byte char String target = "LİKE THIS"; // The second character ('İ') is Unicode, which was read by AC as a 2-byte char
assertEquals("THIS", target.substring(5, 9)); // Java does it the right way assertEquals("THIS", target.substring(5, 9)); // Java does it the right way
Trie trie = builder().ignoreCase().onlyWholeWords() Trie trie = Trie.builder().ignoreCase().onlyWholeWords()
.addKeyword("this") .addKeyword("this")
.build(); .build();
Collection<Emit> emits = trie.parseText(target); Collection<Emit> emits = trie.parseText(target);
@ -393,7 +392,7 @@ public class TrieTest {
@Test @Test
public void testUnicode2() { public void testUnicode2() {
String target = "LİKE THIS"; // The second character ('İ') is Unicode, which was read by AC as a 2-byte char String target = "LİKE THIS"; // The second character ('İ') is Unicode, which was read by AC as a 2-byte char
Trie trie = builder() Trie trie = Trie.builder()
.ignoreCase() .ignoreCase()
.onlyWholeWords() .onlyWholeWords()
.addKeyword("this") .addKeyword("this")
@ -405,7 +404,7 @@ public class TrieTest {
@Test @Test
public void testPartialMatchWhiteSpaces() { public void testPartialMatchWhiteSpaces() {
Trie trie = builder() Trie trie = Trie.builder()
.onlyWholeWordsWhiteSpaceSeparated() .onlyWholeWordsWhiteSpaceSeparated()
.addKeyword("#sugar-123") .addKeyword("#sugar-123")
.build(); .build();
@ -423,7 +422,7 @@ public class TrieTest {
injectKeyword(text, keyword, interval); injectKeyword(text, keyword, interval);
Trie trie = builder() Trie trie = Trie.builder()
.onlyWholeWords() .onlyWholeWords()
.addKeyword(keyword) .addKeyword(keyword)
.build(); .build();
@ -439,10 +438,10 @@ public class TrieTest {
* @param count The number of numbers to generate. * @param count The number of numbers to generate.
* @return A character sequence filled with random digits. * @return A character sequence filled with random digits.
*/ */
private StringBuilder randomNumbers(final int count) { private StringBuilder randomNumbers(int count) {
final StringBuilder sb = new StringBuilder(count); final StringBuilder sb = new StringBuilder(count);
for (int i = count - 1; i >= 0; i--) { while (--count > 0) {
sb.append(randomInt(0, 10)); sb.append(randomInt(0, 10));
} }
@ -468,7 +467,7 @@ public class TrieTest {
} }
private int randomInt(final int min, final int max) { private int randomInt(final int min, final int max) {
return current().nextInt(min, max); return ThreadLocalRandom.current().nextInt(min, max);
} }
private void checkEmit(Emit next, int expectedStart, int expectedEnd, String expectedKeyword) { private void checkEmit(Emit next, int expectedStart, int expectedEnd, String expectedKeyword) {