Skip to content

Commit 01589bf

Browse files
committed
[refactor] Address code-review from @reinhapa
1 parent ed3f378 commit 01589bf

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

exist-core/src/main/java/org/exist/xquery/CountClause.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ private boolean hasPreviousOrderByDescending() {
105105
FLWORClause prev = getPreviousClause();
106106
while (prev != null) {
107107
switch (prev.getType()) {
108-
case LET:
109-
case GROUPBY:
110-
case FOR:
108+
case LET, GROUPBY, FOR -> {
111109
return false;
112-
case ORDERBY:
113-
return isDescending(((OrderByClause) prev).getOrderSpecs());
110+
}
111+
case ORDERBY -> {
112+
return isDescending(((OrderByClause) prev).getOrderSpecs());
113+
}
114114
}
115115
prev = prev.getPreviousClause();
116116
}

exist-core/src/main/java/org/exist/xquery/value/DoubleValue.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,14 @@ public boolean isPositive() {
153153
comparison = () -> Constants.SUPERIOR;
154154
} else if (isInfinite() && other.isInfinite() && isPositive() == other.isPositive()) {
155155
comparison = () -> Constants.EQUAL;
156-
} else if (other instanceof IntegerValue) {
157-
comparison = () -> BigDecimal.valueOf(value).compareTo(new BigDecimal(((IntegerValue) other).value));
158-
} else if (other instanceof DecimalValue) {
159-
comparison = () -> BigDecimal.valueOf(value).compareTo(((DecimalValue) other).value);
160-
} else if (other instanceof DoubleValue) {
161-
comparison = () -> Double.compare(value, ((DoubleValue) other).value);
162-
} else if (other instanceof FloatValue) {
163-
comparison = () -> Double.compare(value, ((FloatValue) other).value);
156+
} else if (other instanceof IntegerValue iv) {
157+
comparison = () -> BigDecimal.valueOf(value).compareTo(new BigDecimal(iv.value));
158+
} else if (other instanceof DecimalValue dv) {
159+
comparison = () -> BigDecimal.valueOf(value).compareTo(dv.value);
160+
} else if (other instanceof DoubleValue dv) {
161+
comparison = () -> Double.compare(value, dv.value);
162+
} else if (other instanceof FloatValue fv) {
163+
comparison = () -> Double.compare(value, fv.value);
164164
} else {
165165
comparison = null;
166166
}

0 commit comments

Comments
 (0)