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    *      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  
18  package org.apache.commons.numbers.combinatorics;
19  
20  /**
21   * @deprecated Since 1.1 this functionality has been replaced with {@link Factorial#doubleValue(int)}.
22   *
23   * <a href="http://mathworld.wolfram.com/Factorial.html">Factorial of a number</a>.
24   */
25  @Deprecated
26  public final class FactorialDouble {
27      /** Single instance. */
28      private static final FactorialDouble INSTANCE = new FactorialDouble();
29  
30      /** No public instances. */
31      private FactorialDouble() {}
32  
33      /**
34       * @deprecated Since 1.1 this functionality has been replaced with {@link Factorial#doubleValue(int)}.
35       *
36       * <p>This class no longer supports a cache. This method returns a reference to a single instance.
37       *
38       * @return instance
39       */
40      @Deprecated
41      public static FactorialDouble create() {
42          return INSTANCE;
43      }
44  
45      /**
46       * @deprecated Since 1.1 this functionality has been replaced with {@link Factorial#doubleValue(int)}.
47       *
48       * <p>This class no longer supports a cache. This method returns a reference to the same object.
49       *
50       * @param cacheSize Ignored.
51       * @return instance
52       */
53      @Deprecated
54      public FactorialDouble withCache(final int cacheSize) {
55          return this;
56      }
57  
58      /**
59       * @deprecated Since 1.1 this functionality has been replaced with {@link Factorial#doubleValue(int)}.
60       *
61       * <p>The result of calling this method is the same as calling the {@link Factorial#doubleValue(int)}.
62       *
63       * @param n Argument.
64       * @return {@code n!}
65       * @throws IllegalArgumentException if {@code n < 0}.
66       */
67      @Deprecated
68      public double value(int n) {
69          return Factorial.doubleValue(n);
70      }
71  }