sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1651156 - in /sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform: ExponentialTransform1D.java LogarithmicTransform1D.java TransferFunction.java
Date Mon, 12 Jan 2015 18:12:19 GMT
Author: desruisseaux
Date: Mon Jan 12 18:12:19 2015
New Revision: 1651156

URL: http://svn.apache.org/r1651156
Log:
Make LogarithmicTransform1D method names consistent with ExponentialTransform1D field names.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1D.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1D.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransferFunction.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1D.java?rev=1651156&r1=1651155&r2=1651156&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1D.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1D.java
[UTF-8] Mon Jan 12 18:12:19 2015
@@ -89,9 +89,9 @@ final class ExponentialTransform1D exten
      * Constructs a new exponential transform which is the inverse of the supplied logarithmic
transform.
      */
     ExponentialTransform1D(final LogarithmicTransform1D inverse) {
-        this.base    = inverse.getBase();
-        this.lnBase  = inverse.getLogBase();
-        this.scale   = inverse.pow(-inverse.getOffset());
+        this.base    = inverse.base();
+        this.lnBase  = inverse.lnBase();
+        this.scale   = inverse.pow(-inverse.offset());
         this.inverse = inverse;
     }
 
@@ -248,26 +248,23 @@ final class ExponentialTransform1D exten
      * to this {@code ExponentialTransform1D}.
      *
      * @param  other The math transform to apply.
-     * @param  applyOtherFirst {@code true} if the transformation order is {@code other}
-     *         followed by {@code this}, or {@code false} if the transformation order is
-     *         {@code this} followed by {@code other}.
-     * @return The combined math transform, or {@code null} if no optimized combined
-     *         transform is available.
+     * @param  applyOtherFirst {@code true} if the transformation order is {@code other}
followed by {@code this},
+     *         or {@code false} if the transformation order is {@code this} followed by {@code
other}.
+     * @return The combined math transform, or {@code null} if no optimized combined transform
is available.
      */
     final MathTransform concatenateLog(final LogarithmicTransform1D other, final boolean
applyOtherFirst) {
+        final double newScale = lnBase / other.lnBase();
         if (applyOtherFirst) {
-            return MathTransforms.concatenate(
-                    PowerTransform1D.create(lnBase / other.getLogBase()),
-                    LinearTransform1D.create(scale * Math.pow(base, other.getOffset()), 0));
+            return MathTransforms.concatenate(PowerTransform1D.create(newScale),
+                    LinearTransform1D.create(scale * Math.pow(base, other.offset()), 0));
         } else {
-            final double newScale = lnBase / other.getLogBase();
             final double newOffset;
             if (scale > 0) {
-                newOffset = other.log(scale) + other.getOffset();
+                newOffset = other.log(scale) + other.offset();
             } else {
                 // Maybe the Math.log(...) argument will become
                 // positive if we rewrite the equation that way...
-                newOffset = other.log(scale * other.getOffset() * other.getLogBase());
+                newOffset = other.log(scale * other.offset() * other.lnBase());
             }
             if (!Double.isNaN(newOffset)) {
                 return LinearTransform1D.create(newScale, newOffset);
@@ -281,8 +278,8 @@ final class ExponentialTransform1D exten
      */
     @Override
     protected int computeHashCode() {
-        return Numerics.hashCode(Double.doubleToLongBits(base) +
-                            31 * Double.doubleToLongBits(scale)) ^ super.computeHashCode();
+        return Numerics.hashCode(Double.doubleToLongBits(base)
+                + 31 * Double.doubleToLongBits(scale)) ^ super.computeHashCode();
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1D.java?rev=1651156&r1=1651155&r2=1651156&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1D.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1D.java
[UTF-8] Mon Jan 12 18:12:19 2015
@@ -33,7 +33,7 @@ import org.apache.sis.util.ComparisonMod
  * <p>Logarithms in bases other than <var>e</var> or 10 are computed by
concatenating a linear transform,
  * using the following mathematical identity:</p>
  *
- * <blockquote>    log<sub>base</sub>(<var>x</var>) = ln(<var>x</var>)
/ ln(base)    </blockquote>
+ * <blockquote>log<sub>base</sub>(<var>x</var>) = ln(<var>x</var>)
/ ln(base)</blockquote>
  *
  * {@section Serialization}
  * Serialized instances of this class are not guaranteed to be compatible with future SIS
versions.
@@ -112,11 +112,9 @@ class LogarithmicTransform1D extends Abs
      * {@link LinearTransform1D} and {@link ExponentialTransform1D}.
      *
      * @param  other The math transform to apply.
-     * @param  applyOtherFirst {@code true} if the transformation order is {@code other}
-     *         followed by {@code this}, or {@code false} if the transformation order is
-     *         {@code this} followed by {@code other}.
-     * @return The combined math transform, or {@code null} if no optimized combined
-     *         transform is available.
+     * @param  applyOtherFirst {@code true} if the transformation order is {@code other}
followed by {@code this},
+     *         or {@code false} if the transformation order is {@code this} followed by {@code
other}.
+     * @return The combined math transform, or {@code null} if no optimized combined transform
is available.
      */
     @Override
     final MathTransform concatenate(final MathTransform other, final boolean applyOtherFirst)
{
@@ -124,12 +122,12 @@ class LogarithmicTransform1D extends Abs
             final LinearTransform1D linear = (LinearTransform1D) other;
             if (applyOtherFirst) {
                 if (linear.offset == 0 && linear.scale > 0) {
-                    return create(getBase(), transform(linear.scale));
+                    return create(base(), transform(linear.scale));
                 }
             } else {
                 final double newBase = pow(1 / linear.scale);
                 if (!Double.isNaN(newBase)) {
-                    return create(newBase, linear.transform(getOffset()));
+                    return create(newBase, linear.transform(offset()));
                 }
             }
         } else if (other instanceof ExponentialTransform1D) {
@@ -153,22 +151,22 @@ class LogarithmicTransform1D extends Abs
     /**
      * Returns the base of this logarithmic function.
      */
-    double getBase() {
+    double base() {
         return Math.E;
     }
 
     /**
      * Returns the natural logarithm of the base of this logarithmic function.
-     * More specifically, returns <code>{@linkplain Math#log(double) Math.log}({@linkplain
#getBase()})</code>.
+     * More specifically, returns <code>{@linkplain Math#log(double) Math.log}({@link
#base()})</code>.
      */
-    double getLogBase() {
+    double lnBase() {
         return 1;
     }
 
     /**
      * Returns the offset applied after this logarithmic function.
      */
-    double getOffset() {
+    double offset() {
         return 0;
     }
 
@@ -312,19 +310,19 @@ class LogarithmicTransform1D extends Abs
 
         /** {@inheritDoc} */
         @Override
-        double getBase() {
+        double base() {
             return 10;
         }
 
         /** {@inheritDoc} */
         @Override
-        double getLogBase() {
+        double lnBase() {
             return LOG_10;
         }
 
         /** {@inheritDoc} */
         @Override
-        double getOffset() {
+        double offset() {
             return offset;
         }
 

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransferFunction.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransferFunction.java?rev=1651156&r1=1651155&r2=1651156&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransferFunction.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransferFunction.java
[UTF-8] Mon Jan 12 18:12:19 2015
@@ -246,8 +246,8 @@ public class TransferFunction implements
         } else if (function instanceof LogarithmicTransform1D) {
             final LogarithmicTransform1D f = (LogarithmicTransform1D) function;
             type   = TransferFunctionType.LOGARITHMIC;
-            base   = f.getBase();
-            offset = f.getOffset();
+            base   = f.base();
+            offset = f.offset();
             scale  = 1;
         } else {
             /*



Mime
View raw message