View Javadoc
1   /*
2    * Copyright (C) 2023 Alberto Irurueta Carro (alberto@irurueta.com)
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *         http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package com.irurueta.numerical.integration;
17  
18  import com.irurueta.numerical.EvaluationException;
19  
20  /**
21   * Abstract base class for elementary quadrature algorithms used for function integration.
22   */
23  public abstract class Quadrature {
24     /**
25      * Current level of refinement.
26      */
27     protected int n;
28  
29     /**
30      * Gets current level of refinement.
31      *
32      * @return current level of refinement.
33      */
34     public int getN() {
35        return n;
36     }
37  
38     /**
39      * Returns the value of the integral at the nth stage of refinement.
40      *
41      * @return the value of the integral at the nth stage of refinement.
42      * @throws EvaluationException Raised if something failed during the evaluation.
43      */
44     public abstract double next() throws EvaluationException;
45  
46     /**
47      * Gets type of quadrature.
48      *
49      * @return type of quadrature.
50      */
51     public abstract QuadratureType getType();
52  }