View Javadoc
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    *      https://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  
18  /*
19   * This is not the original file distributed by the Apache Software Foundation
20   * It has been modified by the Hipparchus project
21   */
22  package org.hipparchus.migration.exception;
23  
24  import org.hipparchus.exception.Localizable;
25  import org.hipparchus.exception.MathIllegalArgumentException;
26  import org.hipparchus.migration.exception.util.LocalizedFormats;
27  
28  /**
29   * Exception to be thrown when function values have the same sign at both
30   * ends of an interval.
31   *
32   * @deprecated as of 1.0, this exception is replaced by {@link MathIllegalArgumentException}
33   */
34  @Deprecated
35  public class NoBracketingException extends MathIllegalArgumentException {
36      /** Serializable version Id. */
37      private static final long serialVersionUID = -3629324471511904459L;
38      /** Lower end of the interval. */
39      private final double lo;
40      /** Higher end of the interval. */
41      private final double hi;
42      /** Value at lower end of the interval. */
43      private final double fLo;
44      /** Value at higher end of the interval. */
45      private final double fHi;
46  
47      /**
48       * Construct the exception.
49       *
50       * @param lo Lower end of the interval.
51       * @param hi Higher end of the interval.
52       * @param fLo Value at lower end of the interval.
53       * @param fHi Value at higher end of the interval.
54       */
55      public NoBracketingException(double lo, double hi,
56                                   double fLo, double fHi) {
57          this(LocalizedFormats.SAME_SIGN_AT_ENDPOINTS, lo, hi, fLo, fHi);
58      }
59  
60      /**
61       * Construct the exception with a specific context.
62       *
63       * @param specific Contextual information on what caused the exception.
64       * @param lo Lower end of the interval.
65       * @param hi Higher end of the interval.
66       * @param fLo Value at lower end of the interval.
67       * @param fHi Value at higher end of the interval.
68       * @param args Additional arguments.
69       */
70      public NoBracketingException(Localizable specific,
71                                   double lo, double hi,
72                                   double fLo, double fHi,
73                                   Object ... args) {
74          super(specific, Double.valueOf(lo), Double.valueOf(hi), Double.valueOf(fLo), Double.valueOf(fHi), args);
75          this.lo = lo;
76          this.hi = hi;
77          this.fLo = fLo;
78          this.fHi = fHi;
79      }
80  
81      /**
82       * Get the lower end of the interval.
83       *
84       * @return the lower end.
85       */
86      public double getLo() {
87          return lo;
88      }
89      /**
90       * Get the higher end of the interval.
91       *
92       * @return the higher end.
93       */
94      public double getHi() {
95          return hi;
96      }
97      /**
98       * Get the value at the lower end of the interval.
99       *
100      * @return the value at the lower end.
101      */
102     public double getFLo() {
103         return fLo;
104     }
105     /**
106      * Get the value at the higher end of the interval.
107      *
108      * @return the value at the higher end.
109      */
110     public double getFHi() {
111         return fHi;
112     }
113 }