    001    /*
    002     * Licensed to the Apache Software Foundation (ASF) under one or more
    003     * contributor license agreements.  See the NOTICE file distributed with
    004     * this work for additional information regarding copyright ownership.
    005     * The ASF licenses this file to You under the Apache License, Version 2.0
    006     * (the "License"); you may not use this file except in compliance with
    007     * the License.  You may obtain a copy of the License at
    008     *
    009     *      http://www.apache.org/licenses/LICENSE-2.0
    010     *
    011     * Unless required by applicable law or agreed to in writing, software
    012     * distributed under the License is distributed on an "AS IS" BASIS,
    013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014     * See the License for the specific language governing permissions and
    015     * limitations under the License.
    016     */
    017    package org.apache.commons.math3.linear;
    018
    019    import org.apache.commons.math3.exception.MathIllegalArgumentException;
    020    import org.apache.commons.math3.exception.util.LocalizedFormats;
    021
    022    /**
    023     * Exception to be thrown when a symmetric matrix is expected.
    024     *
    025     * @since 3.0
    026     * @version $Id: NonSymmetricMatrixException.java 1416643 2012-12-03 19:37:14Z tn $
    027     */
    028    public class NonSymmetricMatrixException extends MathIllegalArgumentException {
    029        /** Serializable version Id. */
    030        private static final long serialVersionUID = -7518495577824189882L;
    031        /** Row. */
    032        private final int row;
    033        /** Column. */
    034        private final int column;
    035        /** Threshold. */
    036        private final double threshold;
    037
    038        /**
    039         * Construct an exception.
    040         *
    041         * @param row Row index.
    042         * @param column Column index.
    043         * @param threshold Relative symmetry threshold.
    044         */
    045        public NonSymmetricMatrixException(int row,
    046                                           int column,
    047                                           double threshold) {
    048            super(LocalizedFormats.NON_SYMMETRIC_MATRIX, row, column, threshold);
    049            this.row = row;
    050            this.column = column;
    051            this.threshold = threshold;
    052        }
    053
    054        /**
    055         * @return the row index of the entry.
    056         */
    057        public int getRow() {
    058            return row;
    059        }
    060        /**
    061         * @return the column index of the entry.
    062         */
    063        public int getColumn() {
    064            return column;
    065        }
    066        /**
    067         * @return the relative symmetry threshold.
    068         */
    069        public double getThreshold() {
    070            return threshold;
    071        }
    072    }