ZeroBitStorage.java

net.minecraft.util.ZeroBitStorage

信息

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

    TODO

字段/常量

  • RAW

    • 类型: long[]
    • 修饰符: public static final
    • 源码定位: L8
    • 说明:

      TODO

  • size

    • 类型: int
    • 修饰符: private final
    • 源码定位: L9
    • 说明:

      TODO

内部类/嵌套类型

构造器

public ZeroBitStorage(int size) @ L11

  • 构造器名:ZeroBitStorage
  • 源码定位:L11
  • 修饰符:public

参数:

  • size: int

说明:

TODO

方法

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

public int getAndSet(int index, int value) @ L15

  • 方法名:getAndSet
  • 源码定位:L15
  • 返回类型:int
  • 修饰符:public

参数:

  • index: int
  • value: int

说明:

TODO

public void set(int index, int value) @ L22

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

参数:

  • index: int
  • value: int

说明:

TODO

public int get(int index) @ L28

  • 方法名:get
  • 源码定位:L28
  • 返回类型:int
  • 修饰符:public

参数:

  • index: int

说明:

TODO

public long[] getRaw() @ L34

  • 方法名:getRaw
  • 源码定位:L34
  • 返回类型:long[]
  • 修饰符:public

参数:

说明:

TODO

public int getSize() @ L39

  • 方法名:getSize
  • 源码定位:L39
  • 返回类型:int
  • 修饰符:public

参数:

说明:

TODO

public int getBits() @ L44

  • 方法名:getBits
  • 源码定位:L44
  • 返回类型:int
  • 修饰符:public

参数:

说明:

TODO

public void getAll(IntConsumer output) @ L49

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

参数:

  • output: IntConsumer

说明:

TODO

public void unpack(int[] output) @ L56

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

参数:

  • output: int[]

说明:

TODO

public BitStorage copy() @ L61

  • 方法名:copy
  • 源码定位:L61
  • 返回类型:BitStorage
  • 修饰符:public

参数:

说明:

TODO

代码

public class ZeroBitStorage implements BitStorage {
    public static final long[] RAW = new long[0];
    private final int size;
 
    public ZeroBitStorage(int size) {
        this.size = size;
    }
 
    @Override
    public int getAndSet(int index, int value) {
        Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
        Validate.inclusiveBetween(0L, 0L, (long)value);
        return 0;
    }
 
    @Override
    public void set(int index, int value) {
        Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
        Validate.inclusiveBetween(0L, 0L, (long)value);
    }
 
    @Override
    public int get(int index) {
        Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
        return 0;
    }
 
    @Override
    public long[] getRaw() {
        return RAW;
    }
 
    @Override
    public int getSize() {
        return this.size;
    }
 
    @Override
    public int getBits() {
        return 0;
    }
 
    @Override
    public void getAll(IntConsumer output) {
        for (int i = 0; i < this.size; i++) {
            output.accept(0);
        }
    }
 
    @Override
    public void unpack(int[] output) {
        Arrays.fill(output, 0, this.size, 0);
    }
 
    @Override
    public BitStorage copy() {
        return this;
    }
}

引用的其他类