Zone.java

net.minecraft.util.profiling.Zone

信息

  • 全限定名:net.minecraft.util.profiling.Zone
  • 类型:public class
  • 包:net.minecraft.util.profiling
  • 源码路径:src/main/java/net/minecraft/util/profiling/Zone.java
  • 起始行号:L6
  • 实现:AutoCloseable
  • 职责:

    TODO

字段/常量

  • INACTIVE

    • 类型: Zone
    • 修饰符: public static final
    • 源码定位: L7
    • 说明:

      TODO

  • profiler

    • 类型: ProfilerFiller
    • 修饰符: private final
    • 源码定位: L8
    • 说明:

      TODO

内部类/嵌套类型

构造器

Zone(ProfilerFiller profiler) @ L10

  • 构造器名:Zone
  • 源码定位:L10
  • 修饰符:package-private

参数:

  • profiler: ProfilerFiller

说明:

TODO

方法

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

public Zone addText(String text) @ L14

  • 方法名:addText
  • 源码定位:L14
  • 返回类型:Zone
  • 修饰符:public

参数:

  • text: String

说明:

TODO

public Zone addText(Supplier<String> text) @ L22

  • 方法名:addText
  • 源码定位:L22
  • 返回类型:Zone
  • 修饰符:public

参数:

  • text: Supplier

说明:

TODO

public Zone addValue(long value) @ L30

  • 方法名:addValue
  • 源码定位:L30
  • 返回类型:Zone
  • 修饰符:public

参数:

  • value: long

说明:

TODO

public Zone setColor(int color) @ L38

  • 方法名:setColor
  • 源码定位:L38
  • 返回类型:Zone
  • 修饰符:public

参数:

  • color: int

说明:

TODO

public void close() @ L46

  • 方法名:close
  • 源码定位:L46
  • 返回类型:void
  • 修饰符:public

参数:

说明:

TODO

代码

public class Zone implements AutoCloseable {
    public static final Zone INACTIVE = new Zone(null);
    private final @Nullable ProfilerFiller profiler;
 
    Zone(@Nullable ProfilerFiller profiler) {
        this.profiler = profiler;
    }
 
    public Zone addText(String text) {
        if (this.profiler != null) {
            this.profiler.addZoneText(text);
        }
 
        return this;
    }
 
    public Zone addText(Supplier<String> text) {
        if (this.profiler != null) {
            this.profiler.addZoneText(text.get());
        }
 
        return this;
    }
 
    public Zone addValue(long value) {
        if (this.profiler != null) {
            this.profiler.addZoneValue(value);
        }
 
        return this;
    }
 
    public Zone setColor(int color) {
        if (this.profiler != null) {
            this.profiler.setZoneColor(color);
        }
 
        return this;
    }
 
    @Override
    public void close() {
        if (this.profiler != null) {
            this.profiler.pop();
        }
    }
}

引用的其他类