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 3e5c629
Show file tree
Hide file tree
Showing 23 changed files with 123 additions and 122 deletions.
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 Expand Up @@ -56,14 +57,15 @@ private static <T extends ICollectionValue> ISequence<IArrayItem<T>> execute(@No
IItem focus) {
IArrayItem<T> array = FunctionUtils.asType(ObjectUtils.requireNonNull(
arguments.get(0).getFirstItem(true)));
@SuppressWarnings("unchecked") T appendage = (T) arguments.get(1).toCollectionValue();
@SuppressWarnings("unchecked")
T appendage = (T) arguments.get(1).toCollectionValue();

return ISequence.of(append(array, appendage));
}

/**
* An implementation of XPath 3.1 <a href=
* "https://www.w3.org/TR/xpath-functions-31/#func-array-append">array:append</a>.
* An implementation of XPath 3.1
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-array-append">array:append</a>.
*
* @param <T>
* the type of items in the given Metapath array
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 Expand Up @@ -53,8 +54,8 @@ private static ISequence<?> execute(@NonNull IFunction function,
}

/**
* An implementation of XPath 3.1 <a href=
* "https://www.w3.org/TR/xpath-functions-31/#func-array-flatten">array:flatten</a>.
* An implementation of XPath 3.1
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-array-flatten">array:flatten</a>.
*
* @param items
* the items to flatten
Expand All @@ -68,8 +69,8 @@ public static Stream<IItem> flatten(@NonNull List<? extends IItem> items) {
}

/**
* An implementation of XPath 3.1 <a href=
* "https://www.w3.org/TR/xpath-functions-31/#func-array-flatten">array:flatten</a>.
* An implementation of XPath 3.1
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-array-flatten">array:flatten</a>.
*
* @param item
* the item to flatten
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 Expand Up @@ -62,8 +63,8 @@ private static ISequence<?> execute(@NonNull IFunction function,
}

/**
* An implementation of XPath 3.1 <a href=
* "https://www.w3.org/TR/xpath-functions-31/#func-array-get">array:get</a>.
* An implementation of XPath 3.1
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-array-get">array:get</a>.
*
* @param <T>
* the type of items in the given Metapath array
Expand All @@ -83,8 +84,8 @@ public static <T extends ICollectionValue> T get(
}

/**
* An implementation of XPath 3.1 <a href=
* "https://www.w3.org/TR/xpath-functions-31/#func-array-get">array:get</a>.
* An implementation of XPath 3.1
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-array-get">array:get</a>.
*
* @param <T>
* the type of items in the given Metapath array
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 Expand Up @@ -56,8 +57,8 @@ private static ISequence<?> execute(@NonNull IFunction function,
}

/**
* An implementation of XPath 3.1 <a href=
* "https://www.w3.org/TR/xpath-functions-31/#func-array-head">array:head</a>.
* An implementation of XPath 3.1
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-array-head">array:head</a>.
*
* @param <T>
* the type of items in the given Metapath array
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 Expand Up @@ -63,7 +64,8 @@ private static <T extends ICollectionValue> ISequence<IArrayItem<T>> execute(@No
IArrayItem<T> array = FunctionUtils.asType(ObjectUtils.requireNonNull(
arguments.get(0).getFirstItem(true)));
IIntegerItem position = FunctionUtils.asType(ObjectUtils.requireNonNull(arguments.get(1).getFirstItem(true)));
@SuppressWarnings("unchecked") T member = (T) ObjectUtils.requireNonNull(arguments.get(2)).toCollectionValue();
@SuppressWarnings("unchecked")
T member = (T) ObjectUtils.requireNonNull(arguments.get(2)).toCollectionValue();

return ISequence.of(insertBefore(array, position, member));
}
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 Expand Up @@ -56,8 +57,8 @@ private static <T extends ICollectionValue> ISequence<? extends IArrayItem<T>> e
}

/**
* An implementation of XPath 3.1 <a href=
* "https://www.w3.org/TR/xpath-functions-31/#func-array-join">array:join</a>.
* An implementation of XPath 3.1
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-array-join">array:join</a>.
*
* @param <T>
* the type of items in the given Metapath array
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 Expand Up @@ -64,14 +65,15 @@ private static <T extends ICollectionValue> ISequence<? extends IArrayItem<T>> e
IArrayItem<T> array = FunctionUtils.asType(ObjectUtils.requireNonNull(
arguments.get(0).getFirstItem(true)));
IIntegerItem position = FunctionUtils.asType(ObjectUtils.requireNonNull(arguments.get(1).getFirstItem(true)));
@SuppressWarnings("unchecked") T member = (T) arguments.get(2).toCollectionValue();
@SuppressWarnings("unchecked")
T member = (T) arguments.get(2).toCollectionValue();

return put(array, position, member).asSequence();
}

/**
* An implementation of XPath 3.1 <a href=
* "https://www.w3.org/TR/xpath-functions-31/#func-array-put">array:put</a>.
* An implementation of XPath 3.1
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-array-put">array:put</a>.
*
* @param <T>
* the type of items in the given Metapath array
Expand All @@ -94,8 +96,8 @@ public static <T extends ICollectionValue> IArrayItem<T> put(
}

/**
* An implementation of XPath 3.1 <a href=
* "https://www.w3.org/TR/xpath-functions-31/#func-array-put">array:put</a>.
* An implementation of XPath 3.1
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-array-put">array:put</a>.
*
* @param <T>
* the type of items in the given Metapath array
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 Expand Up @@ -67,8 +68,8 @@ private static <T extends IItem> ISequence<IArrayItem<T>> execute(@NonNull IFunc
}

/**
* An implementation of XPath 3.1 <a href=
* "https://www.w3.org/TR/xpath-functions-31/#func-array-remove">array:remove</a>.
* An implementation of XPath 3.1
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-array-remove">array:remove</a>.
*
* @param <T>
* the type of items in the given Metapath array
Expand All @@ -92,8 +93,8 @@ public static <T extends IItem> IArrayItem<T> removeItems(
}

/**
* An implementation of XPath 3.1 <a href=
* "https://www.w3.org/TR/xpath-functions-31/#func-array-remove">array:remove</a>.
* An implementation of XPath 3.1
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-array-remove">array:remove</a>.
*
* @param <T>
* the type of items in the given Metapath array
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 Expand Up @@ -57,8 +58,8 @@ private static <T extends ICollectionValue> ISequence<IArrayItem<T>> execute(@No
}

/**
* An implementation of XPath 3.1 <a href=
* "https://www.w3.org/TR/xpath-functions-31/#func-array-reverse">array:reverse</a>.
* An implementation of XPath 3.1
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-array-reverse">array:reverse</a>.
*
* @param <T>
* the type of items in the given Metapath array
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 All @@ -39,8 +40,8 @@ public final class ArraySize {
.build();

/**
* An implementation of XPath 3.1 <a href=
* "https://www.w3.org/TR/xpath-functions-31/#func-array-size">array:size</a>.
* An implementation of XPath 3.1
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-array-size">array:size</a>.
*
* @param array
* the arrays to join
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 Expand Up @@ -54,8 +55,8 @@ private static <T extends IItem> ISequence<IArrayItem<T>> execute(@NonNull IFunc
}

/**
* An implementation of XPath 3.1 <a href=
* "https://www.w3.org/TR/xpath-functions-31/#func-array-tail">array:tail</a>.
* An implementation of XPath 3.1
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-array-tail">array:tail</a>.
*
* @param <T>
* the type of items in the given Metapath array
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 Expand Up @@ -63,9 +64,8 @@ private static ISequence<IBooleanItem> execute(@NonNull IFunction function,
/**
* Get the effective boolean value of the provided sequence.
* <p>
* Based on the XPath 3.1 <a href=
* "https://www.w3.org/TR/xpath-functions-31/#func-boolean">fn:boolean</a>
* function.
* Based on the XPath 3.1
* <a href= "https://www.w3.org/TR/xpath-functions-31/#func-boolean">fn:boolean</a> function.
*
* @param sequence
* the sequence to evaluate
Expand All @@ -77,9 +77,8 @@ public static IBooleanItem fnBoolean(@NonNull ISequence<?> sequence) {
}

/**
* A helper method that gets the effective boolean value of the provided
* sequence based on <a href="https://www.w3.org/TR/xpath-31/#id-ebv">XPath
* 3.1</a>.
* A helper method that gets the effective boolean value of the provided sequence based on
* <a href="https://www.w3.org/TR/xpath-31/#id-ebv">XPath 3.1</a>.
*
* @param sequence
* the sequence to evaluate
Expand All @@ -99,8 +98,8 @@ public static boolean fnBooleanAsPrimitive(@NonNull ISequence<?> sequence) {
}

/**
* A helper method that gets the effective boolean value of the provided item
* based on <a href="https://www.w3.org/TR/xpath-31/#id-ebv">XPath 3.1</a>.
* A helper method that gets the effective boolean value of the provided item based on
* <a href="https://www.w3.org/TR/xpath-31/#id-ebv">XPath 3.1</a>.
*
* @param item
* the item to evaluate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
import edu.umd.cs.findbugs.annotations.NonNull;

/**
* Implements <a href=
* "https://www.w3.org/TR/xpath-functions-31/#func-compare">fn:compare</a>.
* Implements <a href= "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
Loading

0 comments on commit 3e5c629

Please sign in to comment.