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.math;
018
019 import org.apache.commons.math.exception.util.DummyLocalizable;
020 import org.apache.commons.math.exception.util.Localizable;
021 import org.apache.commons.math.exception.util.LocalizedFormats;
022
023 /**
024 * Error thrown when a numerical computation can not be performed because the
025 * numerical result failed to converge to a finite value.
026 *
027 * @version $Revision: 983921 $ $Date: 2010-08-10 12:46:06 +0200 (mar. 10 ao??t 2010) $
028 */
029 public class ConvergenceException extends MathException {
030
031 /** Serializable version identifier */
032 private static final long serialVersionUID = -1111352570797662604L;
033
034 /**
035 * Default constructor.
036 */
037 public ConvergenceException() {
038 super(LocalizedFormats.CONVERGENCE_FAILED);
039 }
040
041 /**
042 * Constructs an exception with specified formatted detail message.
043 * Message formatting is delegated to {@link java.text.MessageFormat}.
044 * @param pattern format specifier
045 * @param arguments format arguments
046 * @since 1.2
047 * @deprecated as of 2.2 replaced by {@link #ConvergenceException(Localizable, Object...)}
048 */
049 @Deprecated
050 public ConvergenceException(String pattern, Object ... arguments) {
051 this(new DummyLocalizable(pattern), arguments);
052 }
053
054 /**
055 * Constructs an exception with specified formatted detail message.
056 * Message formatting is delegated to {@link java.text.MessageFormat}.
057 * @param pattern format specifier
058 * @param arguments format arguments
059 * @since 2.2
060 */
061 public ConvergenceException(Localizable pattern, Object ... arguments) {
062 super(pattern, arguments);
063 }
064
065 /**
066 * Create an exception with a given root cause.
067 * @param cause the exception or error that caused this exception to be thrown
068 */
069 public ConvergenceException(Throwable cause) {
070 super(cause);
071 }
072
073 /**
074 * Constructs an exception with specified formatted detail message and root cause.
075 * Message formatting is delegated to {@link java.text.MessageFormat}.
076 * @param cause the exception or error that caused this exception to be thrown
077 * @param pattern format specifier
078 * @param arguments format arguments
079 * @since 1.2
080 * @deprecated as of 2.2 replaced by {@link #ConvergenceException(Throwable, Localizable, Object...)}
081 */
082 @Deprecated
083 public ConvergenceException(Throwable cause, String pattern, Object ... arguments) {
084 this(cause, new DummyLocalizable(pattern), arguments);
085 }
086
087 /**
088 * Constructs an exception with specified formatted detail message and root cause.
089 * Message formatting is delegated to {@link java.text.MessageFormat}.
090 * @param cause the exception or error that caused this exception to be thrown
091 * @param pattern format specifier
092 * @param arguments format arguments
093 * @since 2.2
094 */
095 public ConvergenceException(Throwable cause, Localizable pattern, Object ... arguments) {
096 super(cause, pattern, arguments);
097 }
098
099 }