FactorialDouble.java

  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.numbers.combinatorics;

  18. /**
  19.  * @deprecated Since 1.1 this functionality has been replaced with {@link Factorial#doubleValue(int)}.
  20.  *
  21.  * <a href="http://mathworld.wolfram.com/Factorial.html">Factorial of a number</a>.
  22.  */
  23. @Deprecated
  24. public final class FactorialDouble {
  25.     /** Single instance. */
  26.     private static final FactorialDouble INSTANCE = new FactorialDouble();

  27.     /** No public instances. */
  28.     private FactorialDouble() {}

  29.     /**
  30.      * @deprecated Since 1.1 this functionality has been replaced with {@link Factorial#doubleValue(int)}.
  31.      *
  32.      * <p>This class no longer supports a cache. This method returns a reference to a single instance.
  33.      *
  34.      * @return instance
  35.      */
  36.     @Deprecated
  37.     public static FactorialDouble create() {
  38.         return INSTANCE;
  39.     }

  40.     /**
  41.      * @deprecated Since 1.1 this functionality has been replaced with {@link Factorial#doubleValue(int)}.
  42.      *
  43.      * <p>This class no longer supports a cache. This method returns a reference to the same object.
  44.      *
  45.      * @param cacheSize Ignored.
  46.      * @return instance
  47.      */
  48.     @Deprecated
  49.     public FactorialDouble withCache(final int cacheSize) {
  50.         return this;
  51.     }

  52.     /**
  53.      * @deprecated Since 1.1 this functionality has been replaced with {@link Factorial#doubleValue(int)}.
  54.      *
  55.      * <p>The result of calling this method is the same as calling the {@link Factorial#doubleValue(int)}.
  56.      *
  57.      * @param n Argument.
  58.      * @return {@code n!}
  59.      * @throws IllegalArgumentException if {@code n < 0}.
  60.      */
  61.     @Deprecated
  62.     public double value(int n) {
  63.         return Factorial.doubleValue(n);
  64.     }
  65. }