001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018package org.apache.commons.numbers.combinatorics;
019
020/**
021 * @deprecated Since 1.1 this functionality has been replaced with {@link Factorial#doubleValue(int)}.
022 *
023 * <a href="http://mathworld.wolfram.com/Factorial.html">Factorial of a number</a>.
024 */
025@Deprecated
026public final class FactorialDouble {
027    /** Single instance. */
028    private static final FactorialDouble INSTANCE = new FactorialDouble();
029
030    /** No public instances. */
031    private FactorialDouble() {}
032
033    /**
034     * @deprecated Since 1.1 this functionality has been replaced with {@link Factorial#doubleValue(int)}.
035     *
036     * <p>This class no longer supports a cache. This method returns a reference to a single instance.
037     *
038     * @return instance
039     */
040    @Deprecated
041    public static FactorialDouble create() {
042        return INSTANCE;
043    }
044
045    /**
046     * @deprecated Since 1.1 this functionality has been replaced with {@link Factorial#doubleValue(int)}.
047     *
048     * <p>This class no longer supports a cache. This method returns a reference to the same object.
049     *
050     * @param cacheSize Ignored.
051     * @return instance
052     */
053    @Deprecated
054    public FactorialDouble withCache(final int cacheSize) {
055        return this;
056    }
057
058    /**
059     * @deprecated Since 1.1 this functionality has been replaced with {@link Factorial#doubleValue(int)}.
060     *
061     * <p>The result of calling this method is the same as calling the {@link Factorial#doubleValue(int)}.
062     *
063     * @param n Argument.
064     * @return {@code n!}
065     * @throws IllegalArgumentException if {@code n < 0}.
066     */
067    @Deprecated
068    public double value(int n) {
069        return Factorial.doubleValue(n);
070    }
071}