String qVal = tempString.split("\\s+")[valueIndex];
if (predicate.test(qVal)) {
linkedList.add(tempString);
} else {
if (linkedList.size() > continueMaxTimes * 100) {
createRecord(linkedList, exceptPoint, exceptLas);
}
linkedList.clear();
}
static Predicate<String> getPredicate(JsonNode thresholdValue, String thresholdType) {
Predicate<String> predicate = null;
if (thresholdValue.isInt()) {
if (">".equals(thresholdType)) {
predicate = x -> Integer.parseInt(x) > thresholdValue.intValue();
} else if ("<".equals(thresholdType)) {
predicate = x -> Integer.parseInt(x) < thresholdValue.intValue();
} else if (">=".equals(thresholdType)) {
predicate = x -> Integer.parseInt(x) >= thresholdValue.intValue();
} else if ("<=".equals(thresholdType)) {
predicate = x -> Integer.parseInt(x) <= thresholdValue.intValue();
}
} else if (thresholdValue.isDouble()) {
if (">".equals(thresholdType)) {
predicate = x -> Float.parseFloat(x) > thresholdValue.floatValue();
} else if ("<".equals(thresholdType)) {
predicate = x -> Float.parseFloat(x) < thresholdValue.floatValue();
} else if (">=".equals(thresholdType)) {
predicate = x -> Float.parseFloat(x) >= thresholdValue.floatValue();
} else if ("<=".equals(thresholdType)) {
predicate = x -> Float.parseFloat(x) <= thresholdValue.floatValue();
}
} else if (thresholdValue.isTextual()) {
predicate = x -> x.equals(thresholdValue.textValue());
}
return predicate;
}
网友评论