blob: ac257d1ed94dcfd60d53e71b97064a7855cfcc55 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package bjc.utils.parserutils.delims;
import java.util.function.BiPredicate;
/**
* A predicated closer for use with {@link RegexOpener}.
*
* @author bjculkin
*
*/
public class RegexCloser implements BiPredicate<String, String[]> {
private final String rep;
/**
* Create a new regex closer.
*
* @param closer
* The format string to use for closing.
*/
public RegexCloser(final String closer) {
rep = closer;
}
@Override
public boolean test(final String closer, final String[] params) {
/*
* Confirm passing an array instead of a single var-arg.
*/
final String work = String.format(rep, (Object[]) params);
return work.equals(closer);
}
}
|