Skip to content

Commit 5a4b767

Browse files
committed
refactoring
1 parent 0e9cb26 commit 5a4b767

File tree

4 files changed

+11
-24
lines changed

4 files changed

+11
-24
lines changed

src/main/java/com/igormaznitsa/jcp/expression/ValueType.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ public boolean isCompatible(@Nonnull final ValueType type) {
5252
return true;
5353
}
5454

55-
if (this == UNKNOWN || type == UNKNOWN) {
56-
return false;
57-
}
55+
return this != UNKNOWN && type != UNKNOWN && (this == ANY || type == ANY);
5856

59-
return this == ANY || type == ANY;
6057
}
6158
}

src/main/java/com/igormaznitsa/jcp/expression/functions/AbstractFunction.java

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,19 @@
1515
*/
1616
package com.igormaznitsa.jcp.expression.functions;
1717

18-
import java.util.Collections;
19-
import java.util.HashMap;
20-
import java.util.Map;
21-
import com.igormaznitsa.jcp.expression.functions.xml.FunctionXML_TEXT;
22-
import com.igormaznitsa.jcp.expression.functions.xml.FunctionXML_ATTR;
23-
import com.igormaznitsa.jcp.expression.functions.xml.FunctionXML_LIST;
24-
import com.igormaznitsa.jcp.expression.functions.xml.FunctionXML_GET;
25-
import com.igormaznitsa.jcp.expression.functions.xml.FunctionXML_SIZE;
26-
import com.igormaznitsa.jcp.expression.functions.xml.FunctionXML_OPEN;
27-
import com.igormaznitsa.jcp.expression.functions.xml.FunctionXML_ROOT;
28-
import com.igormaznitsa.jcp.expression.functions.xml.FunctionXML_NAME;
2918
import com.igormaznitsa.jcp.expression.ExpressionItem;
3019
import com.igormaznitsa.jcp.expression.ExpressionItemPriority;
3120
import com.igormaznitsa.jcp.expression.ExpressionItemType;
3221
import com.igormaznitsa.jcp.expression.ValueType;
3322
import com.igormaznitsa.jcp.expression.functions.xml.*;
34-
35-
import java.util.concurrent.atomic.AtomicLong;
23+
import com.igormaznitsa.meta.annotation.MustNotContainNull;
3624

3725
import javax.annotation.Nonnull;
3826
import javax.annotation.Nullable;
39-
40-
import com.igormaznitsa.meta.annotation.MustNotContainNull;
27+
import java.util.Collections;
28+
import java.util.HashMap;
29+
import java.util.Map;
30+
import java.util.concurrent.atomic.AtomicLong;
4131

4232
/**
4333
* The abstract class is the base for each function handler in the preprocessor

src/main/java/com/igormaznitsa/jcp/expression/operators/OperatorNOT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public String getKeyword() {
4646

4747
@Nonnull
4848
public Value executeInt(@Nonnull final Value arg1) {
49-
return Value.valueOf(0xFFFFFFFFFFFFFFFFL ^ arg1.asLong());
49+
return Value.valueOf(~arg1.asLong());
5050
}
5151

5252
@Nonnull

src/main/java/com/igormaznitsa/jcp/utils/antpathmatcher/AntPathMatcher.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ private boolean isWildcardChar(char c) {
390390
protected String[] tokenizePattern(String pattern) {
391391
String[] tokenized = null;
392392
Boolean cachePatterns = this.cachePatterns;
393-
if (cachePatterns == null || cachePatterns.booleanValue()) {
393+
if (cachePatterns == null || cachePatterns) {
394394
tokenized = this.tokenizedPatternCache.get(pattern);
395395
}
396396
if (tokenized == null) {
@@ -402,7 +402,7 @@ protected String[] tokenizePattern(String pattern) {
402402
deactivatePatternCache();
403403
return tokenized;
404404
}
405-
if (cachePatterns == null || cachePatterns.booleanValue()) {
405+
if (cachePatterns == null || cachePatterns) {
406406
this.tokenizedPatternCache.put(pattern, tokenized);
407407
}
408408
}
@@ -454,7 +454,7 @@ private boolean matchStrings(String pattern, String str, Map<String, String> uri
454454
protected AntPathStringMatcher getStringMatcher(String pattern) {
455455
AntPathStringMatcher matcher = null;
456456
Boolean cachePatterns = this.cachePatterns;
457-
if (cachePatterns == null || cachePatterns.booleanValue()) {
457+
if (cachePatterns == null || cachePatterns) {
458458
matcher = this.stringMatcherCache.get(pattern);
459459
}
460460
if (matcher == null) {
@@ -466,7 +466,7 @@ protected AntPathStringMatcher getStringMatcher(String pattern) {
466466
deactivatePatternCache();
467467
return matcher;
468468
}
469-
if (cachePatterns == null || cachePatterns.booleanValue()) {
469+
if (cachePatterns == null || cachePatterns) {
470470
this.stringMatcherCache.put(pattern, matcher);
471471
}
472472
}

0 commit comments

Comments
 (0)