BoundedFloatFunction.java

net.minecraft.util.BoundedFloatFunction

信息

  • 全限定名:net.minecraft.util.BoundedFloatFunction
  • 类型:public interface
  • 包:net.minecraft.util
  • 源码路径:src/main/java/net/minecraft/util/BoundedFloatFunction.java
  • 起始行号:L7
  • 职责:

    TODO

字段/常量

  • IDENTITY
    • 类型: BoundedFloatFunction<Float>
    • 修饰符: package-private
    • 源码定位: L8
    • 说明:

      TODO

内部类/嵌套类型

构造器

方法

下面的方法块按源码顺序生成。

float apply(C c) @ L10

  • 方法名:apply
  • 源码定位:L10
  • 返回类型:float
  • 修饰符:package-private

参数:

  • c: C

说明:

TODO

float minValue() @ L12

  • 方法名:minValue
  • 源码定位:L12
  • 返回类型:float
  • 修饰符:package-private

参数:

说明:

TODO

float maxValue() @ L14

  • 方法名:maxValue
  • 源码定位:L14
  • 返回类型:float
  • 修饰符:package-private

参数:

说明:

TODO

static BoundedFloatFunction<Float> createUnlimited(Float2FloatFunction function) @ L16

  • 方法名:createUnlimited
  • 源码定位:L16
  • 返回类型:BoundedFloatFunction
  • 修饰符:static

参数:

  • function: Float2FloatFunction

说明:

TODO

default <C2> BoundedFloatFunction<C2> comap(Function<C2,C> function) @ L34

  • 方法名:comap
  • 源码定位:L34
  • 返回类型: BoundedFloatFunction
  • 修饰符:default

参数:

  • function: Function<C2,C>

说明:

TODO

代码

public interface BoundedFloatFunction<C> {
    BoundedFloatFunction<Float> IDENTITY = createUnlimited(input -> input);
 
    float apply(final C c);
 
    float minValue();
 
    float maxValue();
 
    static BoundedFloatFunction<Float> createUnlimited(Float2FloatFunction function) {
        return new BoundedFloatFunction<Float>() {
            public float apply(Float aFloat) {
                return function.apply(aFloat);
            }
 
            @Override
            public float minValue() {
                return Float.NEGATIVE_INFINITY;
            }
 
            @Override
            public float maxValue() {
                return Float.POSITIVE_INFINITY;
            }
        };
    }
 
    default <C2> BoundedFloatFunction<C2> comap(Function<C2, C> function) {
        final BoundedFloatFunction<C> outer = this;
        return new BoundedFloatFunction<C2>() {
            {
                Objects.requireNonNull(BoundedFloatFunction.this);
            }
 
            @Override
            public float apply(C2 c2) {
                return outer.apply(function.apply(c2));
            }
 
            @Override
            public float minValue() {
                return outer.minValue();
            }
 
            @Override
            public float maxValue() {
                return outer.maxValue();
            }
        };
    }
}

引用的其他类