You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2019/10/28 01:46:00 UTC

[commons-math] 01/08: Remove redundant declarations/definitions.

This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git

commit 78e4c98096c94043ca01735200c2410b755e938a
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Sun Oct 27 13:58:47 2019 +0100

    Remove redundant declarations/definitions.
    
    Target for next release is Java 8+.
---
 .../commons/math4/linear/AbstractFieldMatrix.java  | 14 --------------
 .../commons/math4/linear/AbstractRealMatrix.java   | 22 ----------------------
 .../org/apache/commons/math4/linear/AnyMatrix.java | 20 +++++++++++---------
 3 files changed, 11 insertions(+), 45 deletions(-)

diff --git a/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java b/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java
index c2f3b18..55f264b 100644
--- a/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java
@@ -672,20 +672,6 @@ public abstract class AbstractFieldMatrix<T extends FieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    public boolean isSquare() {
-        return getColumnDimension() == getRowDimension();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public abstract int getRowDimension();
-
-    /** {@inheritDoc} */
-    @Override
-    public abstract int getColumnDimension();
-
-    /** {@inheritDoc} */
-    @Override
     public T getTrace() throws NonSquareMatrixException {
         final int nRows = getRowDimension();
         final int nCols = getColumnDimension();
diff --git a/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java b/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java
index 76ef1cb..f6539f0 100644
--- a/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java
@@ -660,28 +660,6 @@ public abstract class AbstractRealMatrix
 
     /** {@inheritDoc} */
     @Override
-    public boolean isSquare() {
-        return getColumnDimension() == getRowDimension();
-    }
-
-    /**
-     * Returns the number of rows of this matrix.
-     *
-     * @return the number of rows.
-     */
-    @Override
-    public abstract int getRowDimension();
-
-    /**
-     * Returns the number of columns of this matrix.
-     *
-     * @return the number of columns.
-     */
-    @Override
-    public abstract int getColumnDimension();
-
-    /** {@inheritDoc} */
-    @Override
     public double getTrace() throws NonSquareMatrixException {
         final int nRows = getRowDimension();
         final int nCols = getColumnDimension();
diff --git a/src/main/java/org/apache/commons/math4/linear/AnyMatrix.java b/src/main/java/org/apache/commons/math4/linear/AnyMatrix.java
index 85a5fe7..0e1bb56 100644
--- a/src/main/java/org/apache/commons/math4/linear/AnyMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/AnyMatrix.java
@@ -20,28 +20,30 @@ package org.apache.commons.math4.linear;
 
 /**
  * Interface defining very basic matrix operations.
+ *
  * @since 2.0
  */
 public interface AnyMatrix {
-
     /**
-     * Is this a square matrix?
-     * @return true if the matrix is square (rowDimension = columnDimension)
+     * Indicates whether this is a square matrix.
+     *
+     * @return {@code true} if the number of rows is the same as the number of columns.
      */
-    boolean isSquare();
+    default boolean isSquare() {
+        return getRowDimension() == getColumnDimension();
+    }
 
     /**
-     * Returns the number of rows in the matrix.
+     * Gets the number of rows.
      *
-     * @return rowDimension
+     * @return the number of rows.
      */
     int getRowDimension();
 
     /**
-     * Returns the number of columns in the matrix.
+     * Gets the number of columns.
      *
-     * @return columnDimension
+     * @return the number of columns.
      */
     int getColumnDimension();
-
 }