当前位置: 首页>>代码示例>>Java>>正文


Java IntToDoubleFunction.applyAsDouble方法代码示例

本文整理汇总了Java中java.util.function.IntToDoubleFunction.applyAsDouble方法的典型用法代码示例。如果您正苦于以下问题:Java IntToDoubleFunction.applyAsDouble方法的具体用法?Java IntToDoubleFunction.applyAsDouble怎么用?Java IntToDoubleFunction.applyAsDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.function.IntToDoubleFunction的用法示例。


在下文中一共展示了IntToDoubleFunction.applyAsDouble方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mapToDouble

import java.util.function.IntToDoubleFunction; //导入方法依赖的package包/类
/**
 * Apply an int -> double function to this range, producing a double[]
 *
 * @param lambda the int -> double function
 */
public double[] mapToDouble(final IntToDoubleFunction lambda) {
	JointCallingUtils.nonNull(lambda, "the lambda function cannot be null");
    final double[] result = new double[size()];
    for (int i = from; i < to; i++) {
        result[i - from] = lambda.applyAsDouble(i);
    }
    return result;
}
 
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:14,代码来源:IndexRange.java

示例2: sum

import java.util.function.IntToDoubleFunction; //导入方法依赖的package包/类
/**
 * Sums the values of an int -> double function applied to this range
 *
 * @param lambda the int -> double function
 */
public double sum(final IntToDoubleFunction lambda) {
	JointCallingUtils.nonNull(lambda, "the lambda function cannot be null");
    double result = 0;
    for (int i = from; i < to; i++) {
        result += lambda.applyAsDouble(i);
    }
    return result;
}
 
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:14,代码来源:IndexRange.java

示例3: setWeights

import java.util.function.IntToDoubleFunction; //导入方法依赖的package包/类
/**
 * Sets weights.
 *
 * @param f the f
 * @return the weights
 */
public BiasLayer setWeights(final IntToDoubleFunction f) {
  for (int i = 0; i < bias.length; i++) {
    bias[i] = f.applyAsDouble(i);
  }
  return this;
}
 
开发者ID:SimiaCryptus,项目名称:MindsEye,代码行数:13,代码来源:BiasLayer.java

示例4: create

import java.util.function.IntToDoubleFunction; //导入方法依赖的package包/类
public static FlightStick create(IntToDoubleFunction axisToValue, IntToBooleanFunction buttonNumberToSwitch,
        IntToIntFunction padToValue, ContinuousRange pitch, ContinuousRange yaw, ContinuousRange roll,
        ContinuousRange throttle, Switch trigger, Switch thumb) {
    return new FlightStick() {
        @Override
        public ContinuousRange getAxis(int axis) {
            return () -> axisToValue.applyAsDouble(axis);
        }

        @Override
        public Switch getButton(int button) {
            return () -> buttonNumberToSwitch.applyAsBoolean(button);
        }

        @Override
        public DirectionalAxis getDPad(int pad) {
            return () -> padToValue.applyAsInt(pad);
        }

        @Override
        public ContinuousRange getPitch() {
            return pitch;
        }

        @Override
        public ContinuousRange getYaw() {
            return yaw;
        }

        @Override
        public ContinuousRange getRoll() {
            return roll;
        }

        @Override
        public ContinuousRange getThrottle() {
            return throttle;
        }

        @Override
        public Switch getTrigger() {
            return trigger;
        }

        @Override
        public Switch getThumb() {
            return thumb;
        }
    };
}
 
开发者ID:strongback,项目名称:strongback-java,代码行数:51,代码来源:FlightStick.java

示例5: nChooseK

import java.util.function.IntToDoubleFunction; //导入方法依赖的package包/类
/**
 * <p>Calculate binomial coefficient for the specified <b>n</b> and <b>k</b>.
 * 
 * <p>In other words, for a set of specified size <b>n</b> method calculates
 * number of possible distinct combinations of the specified size <b>k</b>.
 * 
 * <p>Example, in the set [a, b, c] of size 3 - there're 3 possible combinations of size 2:
 * <ul>
 * 	<li>a, b
 * 	<li>a, c
 * 	<li>b, c
 * </ul>
 * Or one possible combination, of size 3:
 * <ul>
 * 	<li>a, b, c
 * </ul>
 * 
 * <p><b>Note:</b>
 * <pre>
 * 	<li>If <b>k</b> = 0		method returns 1 for any n
 * 	<li>If <b>k</b> = 1		method returns n for any n > 0
 * 	<li>If <b>k</b> = (n-1)		method returns n for any n > 0
 * 	<li>If <b>k</b> = n		method returns 1 for any n
 * </pre>
 * 
 * @param n - size of a set. Required positive.
 * @param k - size of a combination. Required to be >= 0 and <= n.
 */
public static int nChooseK(int n, int k) {
	IntToDoubleFunction f = DoubleMath::factorial;
	double nf = f.applyAsDouble(n);
	double kf = f.applyAsDouble(k);
	double nkf = f.applyAsDouble(n - k);
	return (int) Math.round(nf / (kf * nkf));
}
 
开发者ID:Whaka-project,项目名称:whakamatautau-util,代码行数:36,代码来源:UberMath.java

示例6: setAll

import java.util.function.IntToDoubleFunction; //导入方法依赖的package包/类
/**
 * Set all elements of the specified array, using the provided
 * generator function to compute each element.
 *
 * <p>If the generator function throws an exception, it is relayed to
 * the caller and the array is left in an indeterminate state.
 *
 * @param array array to be initialized
 * @param generator a function accepting an index and producing the desired
 *        value for that position
 * @throws NullPointerException if the generator is null
 * @since 1.8
 */
public static void setAll(double[] array, IntToDoubleFunction generator) {
    Objects.requireNonNull(generator);
    for (int i = 0; i < array.length; i++)
        array[i] = generator.applyAsDouble(i);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:Arrays.java

示例7: setAll

import java.util.function.IntToDoubleFunction; //导入方法依赖的package包/类
/**
 * Set all elements of the specified array, using the provided
 * generator function to compute each element.
 *
 * <p>If the generator function throws an exception, it is relayed to
 * the caller and the array is left in an indeterminate state.
 *
 * @apiNote
 * Setting a subrange of an array, using a generator function to compute
 * each element, can be written as follows:
 * <pre>{@code
 * IntStream.range(startInclusive, endExclusive)
 *          .forEach(i -> array[i] = generator.applyAsDouble(i));
 * }</pre>
 *
 * @param array array to be initialized
 * @param generator a function accepting an index and producing the desired
 *        value for that position
 * @throws NullPointerException if the generator is null
 * @since 1.8
 */
public static void setAll(double[] array, IntToDoubleFunction generator) {
    Objects.requireNonNull(generator);
    for (int i = 0; i < array.length; i++)
        array[i] = generator.applyAsDouble(i);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:Arrays.java

示例8: andThenToDouble

import java.util.function.IntToDoubleFunction; //导入方法依赖的package包/类
/**
 * Returns a composed {@link BiObjShortToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} function to the result. If evaluation of either operation throws an exception, it is
 * relayed to the caller of the composed operation. This method is just convenience, to provide the ability to
 * transform this primitive function to an operation returning {@code double}.
 *
 * @param after The function to apply after this function is applied
 * @return A composed {@code BiObjShortToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * double}.
 */
@Nonnull
default BiObjShortToDoubleFunction<T, U> andThenToDouble(@Nonnull final IntToDoubleFunction after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.applyAsDouble(applyAsInt(t, u, value));
}
 
开发者ID:gridtec,项目名称:lambda4j,代码行数:19,代码来源:BiObjShortToIntFunction.java

示例9: andThenToDouble

import java.util.function.IntToDoubleFunction; //导入方法依赖的package包/类
/**
 * Returns a composed {@link BiFloatToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} function to the result. If evaluation of either operation throws an exception, it is
 * relayed to the caller of the composed operation. This method is just convenience, to provide the ability to
 * transform this primitive function to an operation returning {@code double}.
 *
 * @param after The function to apply after this function is applied
 * @return A composed {@code BiFloatToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * double}.
 */
@Nonnull
default BiFloatToDoubleFunction andThenToDouble(@Nonnull final IntToDoubleFunction after) {
    Objects.requireNonNull(after);
    return (value1, value2) -> after.applyAsDouble(applyAsInt(value1, value2));
}
 
开发者ID:gridtec,项目名称:lambda4j,代码行数:19,代码来源:BiFloatToIntFunction.java

示例10: andThenToDouble

import java.util.function.IntToDoubleFunction; //导入方法依赖的package包/类
/**
 * Returns a composed {@link ObjBiShortToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} function to the result. If evaluation of either operation throws an exception, it is
 * relayed to the caller of the composed operation. This method is just convenience, to provide the ability to
 * transform this primitive function to an operation returning {@code double}.
 *
 * @param after The function to apply after this function is applied
 * @return A composed {@code ObjBiShortToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * double}.
 */
@Nonnull
default ObjBiShortToDoubleFunction<T> andThenToDouble(@Nonnull final IntToDoubleFunction after) {
    Objects.requireNonNull(after);
    return (t, value1, value2) -> after.applyAsDouble(applyAsInt(t, value1, value2));
}
 
开发者ID:gridtec,项目名称:lambda4j,代码行数:19,代码来源:ObjBiShortToIntFunction.java

示例11: andThenToDouble

import java.util.function.IntToDoubleFunction; //导入方法依赖的package包/类
/**
 * Returns a composed {@link BiObjCharToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} function to the result. If evaluation of either operation throws an exception, it is
 * relayed to the caller of the composed operation. This method is just convenience, to provide the ability to
 * transform this primitive function to an operation returning {@code double}.
 *
 * @param after The function to apply after this function is applied
 * @return A composed {@code BiObjCharToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * double}.
 */
@Nonnull
default BiObjCharToDoubleFunction<T, U> andThenToDouble(@Nonnull final IntToDoubleFunction after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.applyAsDouble(applyAsInt(t, u, value));
}
 
开发者ID:gridtec,项目名称:lambda4j,代码行数:19,代码来源:BiObjCharToIntFunction.java

示例12: andThenToDouble

import java.util.function.IntToDoubleFunction; //导入方法依赖的package包/类
/**
 * Returns a composed {@link ObjBiFloatToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} function to the result. If evaluation of either operation throws an exception, it is
 * relayed to the caller of the composed operation. This method is just convenience, to provide the ability to
 * transform this primitive function to an operation returning {@code double}.
 *
 * @param after The function to apply after this function is applied
 * @return A composed {@code ObjBiFloatToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * double}.
 */
@Nonnull
default ObjBiFloatToDoubleFunction<T> andThenToDouble(@Nonnull final IntToDoubleFunction after) {
    Objects.requireNonNull(after);
    return (t, value1, value2) -> after.applyAsDouble(applyAsInt(t, value1, value2));
}
 
开发者ID:gridtec,项目名称:lambda4j,代码行数:19,代码来源:ObjBiFloatToIntFunction.java

示例13: andThenToDouble

import java.util.function.IntToDoubleFunction; //导入方法依赖的package包/类
/**
 * Returns a composed {@link TriCharToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} function to the result. If evaluation of either operation throws an exception, it is
 * relayed to the caller of the composed operation. This method is just convenience, to provide the ability to
 * transform this primitive function to an operation returning {@code double}.
 *
 * @param after The function to apply after this function is applied
 * @return A composed {@code TriCharToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * double}.
 */
@Nonnull
default TriCharToDoubleFunction andThenToDouble(@Nonnull final IntToDoubleFunction after) {
    Objects.requireNonNull(after);
    return (value1, value2, value3) -> after.applyAsDouble(applyAsInt(value1, value2, value3));
}
 
开发者ID:gridtec,项目名称:lambda4j,代码行数:19,代码来源:TriCharToIntFunction.java

示例14: andThenToDouble

import java.util.function.IntToDoubleFunction; //导入方法依赖的package包/类
/**
 * Returns a composed {@link ObjBiDoubleToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} function to the result. If evaluation of either operation throws an exception, it is
 * relayed to the caller of the composed operation. This method is just convenience, to provide the ability to
 * transform this primitive function to an operation returning {@code double}.
 *
 * @param after The function to apply after this function is applied
 * @return A composed {@code ObjBiDoubleToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * double}.
 */
@Nonnull
default ObjBiDoubleToDoubleFunction<T> andThenToDouble(@Nonnull final IntToDoubleFunction after) {
    Objects.requireNonNull(after);
    return (t, value1, value2) -> after.applyAsDouble(applyAsInt(t, value1, value2));
}
 
开发者ID:gridtec,项目名称:lambda4j,代码行数:19,代码来源:ObjBiDoubleToIntFunction.java

示例15: andThenToDouble

import java.util.function.IntToDoubleFunction; //导入方法依赖的package包/类
/**
 * Returns a composed {@link TriByteToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} function to the result. If evaluation of either operation throws an exception, it is
 * relayed to the caller of the composed operation. This method is just convenience, to provide the ability to
 * transform this primitive function to an operation returning {@code double}.
 *
 * @param after The function to apply after this function is applied
 * @return A composed {@code TriByteToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * double}.
 */
@Nonnull
default TriByteToDoubleFunction andThenToDouble(@Nonnull final IntToDoubleFunction after) {
    Objects.requireNonNull(after);
    return (value1, value2, value3) -> after.applyAsDouble(applyAsInt(value1, value2, value3));
}
 
开发者ID:gridtec,项目名称:lambda4j,代码行数:19,代码来源:TriByteToIntFunction.java


注:本文中的java.util.function.IntToDoubleFunction.applyAsDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。