Skip to content

Commit

Permalink
Adjust function names to use a static name value.
Browse files Browse the repository at this point in the history
  • Loading branch information
david-waltermire committed Oct 7, 2024
1 parent 0e117da commit 9722f9b
Show file tree
Hide file tree
Showing 38 changed files with 77 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ public ISequenceType getResult() {
public static List<ISequence<?>> convertArguments(
@NonNull IFunction function,
@NonNull List<? extends ISequence<?>> parameters) {
@NonNull
List<ISequence<?>> retval = new ArrayList<>(parameters.size());
@NonNull List<ISequence<?>> retval = new ArrayList<>(parameters.size());

Iterator<IArgument> argumentIterator = function.getArguments().iterator();
IArgument argument = null;
Expand Down Expand Up @@ -208,7 +207,8 @@ private static ISequence<?> convertArgument(
}

/**
* Based on XPath 3.1 <a href="https://www.w3.org/TR/xpath-31/#dt-function-conversion">function
* Based on XPath 3.1
* <a href="https://www.w3.org/TR/xpath-31/#dt-function-conversion">function
* conversion</a> rules.
*
* @param argument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
import edu.umd.cs.findbugs.annotations.NonNull;

public final class ArrayAppend {
private static final String NAME = "append";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("append")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS_ARRAY)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
import edu.umd.cs.findbugs.annotations.NonNull;

public final class ArrayFlatten {
private static final String NAME = "flatten";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("flatten")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS_ARRAY)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
import edu.umd.cs.findbugs.annotations.NonNull;

public final class ArrayGet {
private static final String NAME = "get";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("get")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS_ARRAY)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
import edu.umd.cs.findbugs.annotations.Nullable;

public final class ArrayHead {
private static final String NAME = "head";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("head")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS_ARRAY)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
import edu.umd.cs.findbugs.annotations.NonNull;

public final class ArrayInsertBefore {
private static final String NAME = "insert-before";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("insert-before")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS_ARRAY)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
import edu.umd.cs.findbugs.annotations.NonNull;

public final class ArrayJoin {
private static final String NAME = "join";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("join")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS_ARRAY)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
import edu.umd.cs.findbugs.annotations.NonNull;

public final class ArrayPut {
private static final String NAME = "put";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("put")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS_ARRAY)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
import edu.umd.cs.findbugs.annotations.NonNull;

public final class ArrayRemove {
private static final String NAME = "remove";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("remove")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS_ARRAY)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
import edu.umd.cs.findbugs.annotations.NonNull;

public final class ArrayReverse {
private static final String NAME = "reverse";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("reverse")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS_ARRAY)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
import edu.umd.cs.findbugs.annotations.NonNull;

public final class ArraySize {
private static final String NAME = "size";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("size")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS_ARRAY)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
import edu.umd.cs.findbugs.annotations.Nullable;

public final class ArrayTail {
private static final String NAME = "tail";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("tail")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS_ARRAY)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
import edu.umd.cs.findbugs.annotations.NonNull;

public final class FnBoolean {
private static final String NAME = "boolean";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("boolean")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
* "https://www.w3.org/TR/xpath-functions-31/#func-compare">fn:compare</a>.
*/
public final class FnCompare {

private static final String NAME = "compare";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("compare")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS)
.deterministic()
.contextDependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
* "https://www.w3.org/TR/xpath-functions-31/#func-concat">fn:concat</a>.
*/
public final class FnConcat {
private static final String NAME = "concat";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("concat")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS)
.deterministic()
.contextIndependent()
Expand Down Expand Up @@ -106,9 +107,7 @@ public static IStringItem concat(@NonNull List<? extends IAnyAtomicItem> items)
@NonNull
public static IStringItem concat(@NonNull Stream<? extends IAnyAtomicItem> items) {
return IStringItem.valueOf(ObjectUtils.notNull(items
.map(item -> {
return item == null ? "" : IStringItem.cast(item).asString();
})
.map(item -> (item == null ? "" : IStringItem.cast(item).asString()))
.collect(Collectors.joining())));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
import edu.umd.cs.findbugs.annotations.NonNull;

public final class FnDoc {
private static final String NAME = "doc";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("doc")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS)
.deterministic()
.contextDependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
import edu.umd.cs.findbugs.annotations.NonNull;

public final class FnDocumentAvailable {

private static final String NAME = "doc-available";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("doc-available")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS)
.deterministic()
.contextDependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import edu.umd.cs.findbugs.annotations.NonNull;

public final class FnEndsWith {

private static final String NAME = "ends-with";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("ends-with")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS)
.deterministic()
.contextDependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
* "https://www.w3.org/TR/xpath-functions-31/#func-exists">fn:exists</a>.
*/
public final class FnExists {
private static final String NAME = "exists";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("exists")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-false">fn:false</a>.
*/
public final class FnFalse {
private static final String NAME = "false";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("false")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-head">fn:head</a>.
*/
public final class FnHead {
private static final String NAME = "head";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("head")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
* "https://www.w3.org/TR/xpath-functions-31/#func-insert-before">fn:insert-before</a>.
*/
public final class FnInsertBefore {
private static final String NAME = "insert-before";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("insert-before")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
import edu.umd.cs.findbugs.annotations.NonNull;

public final class FnNot {
private static final String NAME = "not";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("not")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
* "https://www.w3.org/TR/xpath-functions-31/#func-remove">fn:remove</a>.
*/
public final class FnRemove {
private static final String NAME = "remove";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("remove")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS)
.deterministic()
.contextIndependent()
Expand Down Expand Up @@ -80,11 +81,7 @@ public static <T extends IItem> List<T> fnRemove(
@NonNull IIntegerItem positionItem) {
int position = positionItem.asInteger().intValue();

if (position == 0) {
return target;
}

if (position > target.size()) {
if ((position == 0) || (position > target.size())) {
return target;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
* "https://www.w3.org/TR/xpath-functions-31/#func-reverse">fn:reverse</a>.
*/
public final class FnReverse {
private static final String NAME = "reverse";
@NonNull
static final IFunction SIGNATURE_ONE_ARG = IFunction.builder()
.name("reverse")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
*/
public final class FnRound {
private static final String NAME = "round";

@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name(NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import edu.umd.cs.findbugs.annotations.NonNull;

public final class FnStartsWith {

private static final String NAME = "starts-with";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("starts-with")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS)
.deterministic()
.contextDependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
import edu.umd.cs.findbugs.annotations.Nullable;

public final class FnStaticBaseUri {
private static final String NAME = "static-base-uri";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("static-base-uri")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS)
.deterministic()
.contextDependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-tail">fn:tail</a>.
*/
public final class FnTail {
private static final String NAME = "tail";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("tail")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS)
.deterministic()
.contextIndependent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-true">fn:true</a>.
*/
public final class FnTrue {
private static final String NAME = "true";
@NonNull
static final IFunction SIGNATURE = IFunction.builder()
.name("true")
.name(NAME)
.namespace(MetapathConstants.NS_METAPATH_FUNCTIONS)
.deterministic()
.contextIndependent()
Expand Down
Loading

0 comments on commit 9722f9b

Please sign in to comment.