调用Math函数库进行计算

Signed-off-by: hecy7 <hecy7@asiainfo.com>
pull/2764/head
hecy7 1 year ago
parent 6a3bc66569
commit 6d2692b6d6

@ -85,9 +85,9 @@ public class GrepHandler extends StdoutHandler {
this.invertMatch = invertMatch; this.invertMatch = invertMatch;
this.showLineNumber = showLineNumber; this.showLineNumber = showLineNumber;
this.trimEnd = trimEnd; this.trimEnd = trimEnd;
this.beforeLines = beforeLines > 0 ? beforeLines : 0; this.beforeLines = Math.max(beforeLines, 0);
this.afterLines = afterLines > 0 ? afterLines : 0; this.afterLines = Math.max(afterLines, 0);
this.maxCount = maxCount > 0 ? maxCount : 0; this.maxCount = Math.max(maxCount, 0);
if (regexpMode) { if (regexpMode) {
final int flags = ignoreCase ? Pattern.CASE_INSENSITIVE : 0; final int flags = ignoreCase ? Pattern.CASE_INSENSITIVE : 0;
this.pattern = Pattern.compile(keyword, flags); this.pattern = Pattern.compile(keyword, flags);

Loading…
Cancel
Save