Skip to content

Commit 703e3b5

Browse files
committed
Code review changes to map:find implementation
Qualifier order conventions Use best FunctionDSL methods
1 parent 65c4696 commit 703e3b5

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

exist-core/src/main/java/org/exist/xquery/functions/map/MapFunction.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public class MapFunction extends BasicFunction {
7373
"Searches the supplied input sequence and any contained maps and arrays for a map entry with the supplied key, " +
7474
"and returns the corresponding values.",
7575
returns(Type.ARRAY, "An array containing the found values with the input key"),
76-
new FunctionParameterSequenceType("input", Type.ITEM, Cardinality.ZERO_OR_MORE, "The sequence of maps to search"),
77-
new FunctionParameterSequenceType("key", Type.ATOMIC, Cardinality.EXACTLY_ONE, "The key to match")
76+
optManyParam("input", Type.ITEM, "The sequence of maps to search"),
77+
param("key", Type.ATOMIC, "The key to match")
7878
);
7979

8080
public final static FunctionSignature FNS_SIZE = new FunctionSignature(
@@ -319,9 +319,9 @@ private Sequence forEach(final Sequence[] args) throws XPathException {
319319
* @param key the key to match
320320
* @param sequence the sequence to search within
321321
*/
322-
static private void findRec(final ArrayType result, final AtomicValue key, final Sequence sequence) {
322+
private static void findRec(final ArrayType result, final AtomicValue key, final Sequence sequence) {
323323
for (int i = 0; i < sequence.getItemCount(); i++) {
324-
MapFunction.findRec(result, key, sequence.itemAt(i));
324+
findRec(result, key, sequence.itemAt(i));
325325
}
326326
}
327327

@@ -335,11 +335,11 @@ static private void findRec(final ArrayType result, final AtomicValue key, final
335335
* @param key the key to match
336336
* @param item the item to search within
337337
*/
338-
static private void findRec(final ArrayType result, final AtomicValue key, final Item item) {
338+
private static void findRec(final ArrayType result, final AtomicValue key, final Item item) {
339339
if (Type.subTypeOf(item.getType(), Type.ARRAY)) {
340340
final ArrayType array = (ArrayType) item;
341341
for (final Sequence sequence : array.toArray()) {
342-
MapFunction.findRec(result, key, sequence);
342+
findRec(result, key, sequence);
343343
}
344344
} else if (Type.subTypeOf(item.getType(), Type.MAP)) {
345345
final AbstractMapType map = (AbstractMapType) item;

exist-core/src/test/java/xquery/maps/MapTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
@RunWith(XSuite.class)
2828
@XSuite.XSuiteFiles({
29-
"src/test/xquery/maps"
29+
"src/test/xquery/maps"
3030
})
3131
public class MapTests {
3232
}
File renamed without changes.

0 commit comments

Comments
 (0)