From 360215524124dc18abd7432e8273e7f5c430cfb2 Mon Sep 17 00:00:00 2001 From: Jochen Berger Date: Mon, 15 Sep 2014 14:31:55 +0200 Subject: [PATCH] remove unused variables, make some methods static --- .../java/com/jayway/jsonpath/internal/Parser.java | 4 ++-- .../com/jayway/jsonpath/internal/PathCompiler.java | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/Parser.java b/json-path/src/main/java/com/jayway/jsonpath/internal/Parser.java index 4a68a0ab..d2cf122e 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/Parser.java +++ b/json-path/src/main/java/com/jayway/jsonpath/internal/Parser.java @@ -93,7 +93,7 @@ public class Parser { return next(offset); } - public boolean isInts(String chars, boolean allowSequence){ + public static boolean isInts(String chars, boolean allowSequence){ for (int i = 0; i < chars.length(); i++){ char c = chars.charAt(i); @@ -108,7 +108,7 @@ public class Parser { } - private boolean contains(Token[] arr, char checkFor){ + private static boolean contains(Token[] arr, char checkFor){ for (int i = 0; i < arr.length; i++){ if(arr[i].c == checkFor){ return true; diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/PathCompiler.java b/json-path/src/main/java/com/jayway/jsonpath/internal/PathCompiler.java index 8423c2fc..8f35a65c 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/PathCompiler.java +++ b/json-path/src/main/java/com/jayway/jsonpath/internal/PathCompiler.java @@ -304,8 +304,7 @@ public class PathCompiler { } else if (bracketCount == 0 && isLogicOperatorChar(current)) { if (isLogicOperatorChar(chars[i + 1])) { - char op1 = current; - char op2 = chars[++i]; + ++i; } criteria.add(createCriteria(pathBuffer, operatorBuffer, valueBuffer)); @@ -335,26 +334,26 @@ public class PathCompiler { return new PredicatePathToken(filter2); } - private Criteria createCriteria(StringBuilder pathBuffer, StringBuilder operatorBuffer, StringBuilder valueBuffer) { + private static Criteria createCriteria(StringBuilder pathBuffer, StringBuilder operatorBuffer, StringBuilder valueBuffer) { return Criteria.create(pathBuffer.toString().trim(), operatorBuffer.toString().trim(), valueBuffer.toString().trim()); } - private boolean isAnd(char c) { + private static boolean isAnd(char c) { return c == '&'; } - private boolean isOr(char c) { + private static boolean isOr(char c) { if (c == '|') { throw new UnsupportedOperationException("OR operator is not supported."); } return false; } - private boolean isLogicOperatorChar(char c) { + private static boolean isLogicOperatorChar(char c) { return isAnd(c) || isOr(c); } - private boolean isOperatorChar(char c) { + private static boolean isOperatorChar(char c) { return c == '=' || c == '!' || c == '<' || c == '>'; }