This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
The following commit(s) were added to refs/heads/geoapi-4.0 by this push: new ee59a3d Trivial renaming of a parameter for clarity. ee59a3d is described below commit ee59a3d85fd920683c87bc7d2ff65d054c68c0ef Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Sun Jan 2 00:00:15 2022 +0100 Trivial renaming of a parameter for clarity. --- .../java/org/apache/sis/filter/ArithmeticFunction.java | 8 ++++---- .../main/java/org/apache/sis/filter/ConvertFunction.java | 14 +++++++------- .../main/java/org/apache/sis/filter/LeafExpression.java | 14 +++++++------- .../org/apache/sis/internal/filter/GeometryConverter.java | 8 ++++---- .../apache/sis/internal/filter/sqlmm/SpatialFunction.java | 6 +++--- .../src/test/java/org/apache/sis/filter/PeriodLiteral.java | 2 +- .../org/apache/sis/internal/filter/FunctionNamesTest.java | 4 ++-- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/core/sis-feature/src/main/java/org/apache/sis/filter/ArithmeticFunction.java b/core/sis-feature/src/main/java/org/apache/sis/filter/ArithmeticFunction.java index 9f9f6dd..cc17b1d 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/filter/ArithmeticFunction.java +++ b/core/sis-feature/src/main/java/org/apache/sis/filter/ArithmeticFunction.java @@ -122,14 +122,14 @@ abstract class ArithmeticFunction<R> extends BinaryFunction<R,Number,Number> */ @Override @SuppressWarnings("unchecked") - public <N> Expression<R,N> toValueType(final Class<N> type) { - if (type.isAssignableFrom(Number.class)) { + public <N> Expression<R,N> toValueType(final Class<N> target) { + if (target.isAssignableFrom(Number.class)) { return (Expression<R,N>) this; } else try { - return new ConvertFunction<>(this, Number.class, type); + return new ConvertFunction<>(this, Number.class, target); } catch (UnconvertibleObjectException e) { throw (ClassCastException) new ClassCastException(Errors.format( - Errors.Keys.CanNotConvertValue_2, getFunctionName(), type)).initCause(e); + Errors.Keys.CanNotConvertValue_2, getFunctionName(), target)).initCause(e); } } diff --git a/core/sis-feature/src/main/java/org/apache/sis/filter/ConvertFunction.java b/core/sis-feature/src/main/java/org/apache/sis/filter/ConvertFunction.java index 50014b3..90adf3a 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/filter/ConvertFunction.java +++ b/core/sis-feature/src/main/java/org/apache/sis/filter/ConvertFunction.java @@ -177,25 +177,25 @@ final class ConvertFunction<R,S,V> extends UnaryFunction<R,S> * Returns an expression doing the same evaluation than this method, but returning results as values * of the specified type. The result may be {@code this}. * - * @param <N> compile-time value of {@code type}. - * @param type desired type of expression results. + * @param <N> compile-time value of {@code type}. + * @param target desired type of expression results. * @return expression doing the same operation this this expression but with results of the specified type. * @throws ClassCastException if the specified type is not a target type supported by implementation. */ @Override @SuppressWarnings("unchecked") - public <N> Expression<R,N> toValueType(final Class<N> type) { - if (type.isAssignableFrom(getValueClass())) { + public <N> Expression<R,N> toValueType(final Class<N> target) { + if (target.isAssignableFrom(getValueClass())) { return (Expression<R,N>) this; } final Class<? super S> source = converter.getSourceClass(); - if (type.isAssignableFrom(source)) { + if (target.isAssignableFrom(source)) { return (Expression<R,N>) expression; } else try { - return new ConvertFunction<>(expression, source, type); + return new ConvertFunction<>(expression, source, target); } catch (UnconvertibleObjectException e) { throw (ClassCastException) new ClassCastException(Errors.format( - Errors.Keys.CanNotConvertValue_2, expression.getFunctionName(), type)).initCause(e); + Errors.Keys.CanNotConvertValue_2, expression.getFunctionName(), target)).initCause(e); } } } diff --git a/core/sis-feature/src/main/java/org/apache/sis/filter/LeafExpression.java b/core/sis-feature/src/main/java/org/apache/sis/filter/LeafExpression.java index 0bd07b6..c561d1c 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/filter/LeafExpression.java +++ b/core/sis-feature/src/main/java/org/apache/sis/filter/LeafExpression.java @@ -117,13 +117,13 @@ abstract class LeafExpression<R,V> extends Node implements FeatureExpression<R,V */ @Override @SuppressWarnings("unchecked") - public <N> Expression<R,N> toValueType(final Class<N> type) { + public <N> Expression<R,N> toValueType(final Class<N> target) { try { - final N c = ObjectConverters.convert(value, type); + final N c = ObjectConverters.convert(value, target); return (c != value) ? new Literal<>(c) : (Literal<R,N>) this; } catch (UnconvertibleObjectException e) { throw (ClassCastException) new ClassCastException(Errors.format( - Errors.Keys.CanNotConvertValue_2, getFunctionName(), type)).initCause(e); + Errors.Keys.CanNotConvertValue_2, getFunctionName(), target)).initCause(e); } } @@ -200,17 +200,17 @@ abstract class LeafExpression<R,V> extends Node implements FeatureExpression<R,V */ @Override @SuppressWarnings("unchecked") - public <N> Expression<R,N> toValueType(final Class<N> type) { + public <N> Expression<R,N> toValueType(final Class<N> target) { // Same implementation than `super.toValueType(type)` except for exception handling. try { - final N c = ObjectConverters.convert(value, type); + final N c = ObjectConverters.convert(value, target); return (c != value) ? new Literal<>(c) : (Literal<R,N>) this; } catch (UnconvertibleObjectException e) { try { - return original.toValueType(type); + return original.toValueType(target); } catch (RuntimeException bis) { final ClassCastException c = new ClassCastException(Errors.format( - Errors.Keys.CanNotConvertValue_2, getFunctionName(), type)); + Errors.Keys.CanNotConvertValue_2, getFunctionName(), target)); c.initCause(e); c.addSuppressed(bis); throw c; diff --git a/core/sis-feature/src/main/java/org/apache/sis/internal/filter/GeometryConverter.java b/core/sis-feature/src/main/java/org/apache/sis/internal/filter/GeometryConverter.java index cb7da80..2d362d2 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/internal/filter/GeometryConverter.java +++ b/core/sis-feature/src/main/java/org/apache/sis/internal/filter/GeometryConverter.java @@ -164,13 +164,13 @@ final class GeometryConverter<R,G> extends Node implements Optimization.OnExpres */ @Override @SuppressWarnings("unchecked") - public <N> Expression<R,N> toValueType(final Class<N> type) { - if (type.isAssignableFrom(library.rootClass)) { + public <N> Expression<R,N> toValueType(final Class<N> target) { + if (target.isAssignableFrom(library.rootClass)) { return (Expression<R,N>) expression; - } else if (type.isAssignableFrom(GeometryWrapper.class)) { + } else if (target.isAssignableFrom(GeometryWrapper.class)) { return (Expression<R,N>) this; } else { - throw new ClassCastException(Errors.format(Errors.Keys.UnsupportedType_1, type)); + throw new ClassCastException(Errors.format(Errors.Keys.UnsupportedType_1, target)); } } } diff --git a/core/sis-feature/src/main/java/org/apache/sis/internal/filter/sqlmm/SpatialFunction.java b/core/sis-feature/src/main/java/org/apache/sis/internal/filter/sqlmm/SpatialFunction.java index 1615ed3..d250e5c 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/internal/filter/sqlmm/SpatialFunction.java +++ b/core/sis-feature/src/main/java/org/apache/sis/internal/filter/sqlmm/SpatialFunction.java @@ -180,11 +180,11 @@ abstract class SpatialFunction<R> extends Node implements FeatureExpression<R,Ob */ @Override @SuppressWarnings("unchecked") - public final <N> Expression<R,N> toValueType(final Class<N> type) { - if (type.isAssignableFrom(getValueClass())) { + public final <N> Expression<R,N> toValueType(final Class<N> target) { + if (target.isAssignableFrom(getValueClass())) { return (Expression<R,N>) this; } else { - throw new ClassCastException(Errors.format(Errors.Keys.CanNotConvertValue_2, getFunctionName(), type)); + throw new ClassCastException(Errors.format(Errors.Keys.CanNotConvertValue_2, getFunctionName(), target)); } } diff --git a/core/sis-feature/src/test/java/org/apache/sis/filter/PeriodLiteral.java b/core/sis-feature/src/test/java/org/apache/sis/filter/PeriodLiteral.java index 31cd4f6..cee59c2 100644 --- a/core/sis-feature/src/test/java/org/apache/sis/filter/PeriodLiteral.java +++ b/core/sis-feature/src/test/java/org/apache/sis/filter/PeriodLiteral.java @@ -78,7 +78,7 @@ final strictfp class PeriodLiteral implements Period, Literal<Feature,Period>, S @Override public RelativePosition relativePosition(TemporalPrimitive o) {throw new UnsupportedOperationException();} @Override public Duration distance(TemporalGeometricPrimitive o) {throw new UnsupportedOperationException();} @Override public Duration length() {throw new UnsupportedOperationException();} - @Override public <N> Expression<Feature,N> toValueType(Class<N> type) {throw new UnsupportedOperationException();} + @Override public <N> Expression<Feature,N> toValueType(Class<N> target) {throw new UnsupportedOperationException();} /** * Hash code value. Used by the tests for checking the results of deserialization. diff --git a/core/sis-feature/src/test/java/org/apache/sis/internal/filter/FunctionNamesTest.java b/core/sis-feature/src/test/java/org/apache/sis/internal/filter/FunctionNamesTest.java index f3f72b4..ab56a4d 100644 --- a/core/sis-feature/src/test/java/org/apache/sis/internal/filter/FunctionNamesTest.java +++ b/core/sis-feature/src/test/java/org/apache/sis/internal/filter/FunctionNamesTest.java @@ -108,7 +108,7 @@ public final strictfp class FunctionNamesTest extends TestCase { public void verifyLiteral() { final Literal<Object,Object> expression = new Literal<Object,Object>() { @Override public Object getValue() {return null;} - @Override public <N> Expression<Object, N> toValueType(Class<N> type) { + @Override public <N> Expression<Object, N> toValueType(Class<N> target) { throw new UnsupportedOperationException(); } }; @@ -124,7 +124,7 @@ public final strictfp class FunctionNamesTest extends TestCase { final ValueReference<Object,Object> expression = new ValueReference<Object,Object>() { @Override public String getXPath() {return null;} @Override public Object apply(Object o) {return null;} - @Override public <N> Expression<Object,N> toValueType(Class<N> type) { + @Override public <N> Expression<Object,N> toValueType(Class<N> target) { throw new UnsupportedOperationException(); } };