• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 package org.apache.commons.math;
18 
19 import org.apache.commons.math.exception.util.DummyLocalizable;
20 import org.apache.commons.math.exception.util.Localizable;
21 import org.apache.commons.math.exception.util.LocalizedFormats;
22 
23 /**
24  * Error thrown when a numerical computation can not be performed because the
25  * numerical result failed to converge to a finite value.
26  *
27  * @version $Revision: 983921 $ $Date: 2010-08-10 12:46:06 +0200 (mar. 10 août 2010) $
28  */
29 public class ConvergenceException extends MathException {
30 
31     /** Serializable version identifier */
32     private static final long serialVersionUID = -1111352570797662604L;
33 
34     /**
35      * Default constructor.
36      */
ConvergenceException()37     public ConvergenceException() {
38         super(LocalizedFormats.CONVERGENCE_FAILED);
39     }
40 
41     /**
42      * Constructs an exception with specified formatted detail message.
43      * Message formatting is delegated to {@link java.text.MessageFormat}.
44      * @param pattern format specifier
45      * @param arguments format arguments
46      * @since 1.2
47      * @deprecated as of 2.2 replaced by {@link #ConvergenceException(Localizable, Object...)}
48      */
49     @Deprecated
ConvergenceException(String pattern, Object ... arguments)50     public ConvergenceException(String pattern, Object ... arguments) {
51         this(new DummyLocalizable(pattern), arguments);
52     }
53 
54     /**
55      * Constructs an exception with specified formatted detail message.
56      * Message formatting is delegated to {@link java.text.MessageFormat}.
57      * @param pattern format specifier
58      * @param arguments format arguments
59      * @since 2.2
60      */
ConvergenceException(Localizable pattern, Object ... arguments)61     public ConvergenceException(Localizable pattern, Object ... arguments) {
62         super(pattern, arguments);
63     }
64 
65     /**
66      * Create an exception with a given root cause.
67      * @param cause  the exception or error that caused this exception to be thrown
68      */
ConvergenceException(Throwable cause)69     public ConvergenceException(Throwable cause) {
70         super(cause);
71     }
72 
73     /**
74      * Constructs an exception with specified formatted detail message and root cause.
75      * Message formatting is delegated to {@link java.text.MessageFormat}.
76      * @param cause  the exception or error that caused this exception to be thrown
77      * @param pattern format specifier
78      * @param arguments format arguments
79      * @since 1.2
80      * @deprecated as of 2.2 replaced by {@link #ConvergenceException(Throwable, Localizable, Object...)}
81      */
82     @Deprecated
ConvergenceException(Throwable cause, String pattern, Object ... arguments)83     public ConvergenceException(Throwable cause, String pattern, Object ... arguments) {
84         this(cause, new DummyLocalizable(pattern), arguments);
85     }
86 
87     /**
88      * Constructs an exception with specified formatted detail message and root cause.
89      * Message formatting is delegated to {@link java.text.MessageFormat}.
90      * @param cause  the exception or error that caused this exception to be thrown
91      * @param pattern format specifier
92      * @param arguments format arguments
93      * @since 2.2
94      */
ConvergenceException(Throwable cause, Localizable pattern, Object ... arguments)95     public ConvergenceException(Throwable cause, Localizable pattern, Object ... arguments) {
96         super(cause, pattern, arguments);
97     }
98 
99 }
100