HashOps.java
net.minecraft.util.HashOps
信息
- 全限定名:net.minecraft.util.HashOps
- 类型:public class
- 包:net.minecraft.util
- 源码路径:src/main/java/net/minecraft/util/HashOps.java
- 起始行号:L28
- 实现:DynamicOps
- 职责:
TODO
字段/常量
-
TAG_EMPTY- 类型:
byte - 修饰符:
private static final - 源码定位:
L29 - 说明:
TODO
- 类型:
-
TAG_MAP_START- 类型:
byte - 修饰符:
private static final - 源码定位:
L30 - 说明:
TODO
- 类型:
-
TAG_MAP_END- 类型:
byte - 修饰符:
private static final - 源码定位:
L31 - 说明:
TODO
- 类型:
-
TAG_LIST_START- 类型:
byte - 修饰符:
private static final - 源码定位:
L32 - 说明:
TODO
- 类型:
-
TAG_LIST_END- 类型:
byte - 修饰符:
private static final - 源码定位:
L33 - 说明:
TODO
- 类型:
-
TAG_BYTE- 类型:
byte - 修饰符:
private static final - 源码定位:
L34 - 说明:
TODO
- 类型:
-
TAG_SHORT- 类型:
byte - 修饰符:
private static final - 源码定位:
L35 - 说明:
TODO
- 类型:
-
TAG_INT- 类型:
byte - 修饰符:
private static final - 源码定位:
L36 - 说明:
TODO
- 类型:
-
TAG_LONG- 类型:
byte - 修饰符:
private static final - 源码定位:
L37 - 说明:
TODO
- 类型:
-
TAG_FLOAT- 类型:
byte - 修饰符:
private static final - 源码定位:
L38 - 说明:
TODO
- 类型:
-
TAG_DOUBLE- 类型:
byte - 修饰符:
private static final - 源码定位:
L39 - 说明:
TODO
- 类型:
-
TAG_STRING- 类型:
byte - 修饰符:
private static final - 源码定位:
L40 - 说明:
TODO
- 类型:
-
TAG_BOOLEAN- 类型:
byte - 修饰符:
private static final - 源码定位:
L41 - 说明:
TODO
- 类型:
-
TAG_BYTE_ARRAY_START- 类型:
byte - 修饰符:
private static final - 源码定位:
L42 - 说明:
TODO
- 类型:
-
TAG_BYTE_ARRAY_END- 类型:
byte - 修饰符:
private static final - 源码定位:
L43 - 说明:
TODO
- 类型:
-
TAG_INT_ARRAY_START- 类型:
byte - 修饰符:
private static final - 源码定位:
L44 - 说明:
TODO
- 类型:
-
TAG_INT_ARRAY_END- 类型:
byte - 修饰符:
private static final - 源码定位:
L45 - 说明:
TODO
- 类型:
-
TAG_LONG_ARRAY_START- 类型:
byte - 修饰符:
private static final - 源码定位:
L46 - 说明:
TODO
- 类型:
-
TAG_LONG_ARRAY_END- 类型:
byte - 修饰符:
private static final - 源码定位:
L47 - 说明:
TODO
- 类型:
-
EMPTY_PAYLOAD- 类型:
byte[] - 修饰符:
private static final - 源码定位:
L48 - 说明:
TODO
- 类型:
-
FALSE_PAYLOAD- 类型:
byte[] - 修饰符:
private static final - 源码定位:
L49 - 说明:
TODO
- 类型:
-
TRUE_PAYLOAD- 类型:
byte[] - 修饰符:
private static final - 源码定位:
L50 - 说明:
TODO
- 类型:
-
EMPTY_MAP_PAYLOAD- 类型:
byte[] - 修饰符:
public static final - 源码定位:
L51 - 说明:
TODO
- 类型:
-
EMPTY_LIST_PAYLOAD- 类型:
byte[] - 修饰符:
public static final - 源码定位:
L52 - 说明:
TODO
- 类型:
-
UNSUPPORTED_OPERATION_ERROR- 类型:
DataResult<Object> - 修饰符:
private static final - 源码定位:
L53 - 说明:
TODO
- 类型:
-
HASH_COMPARATOR- 类型:
Comparator<HashCode> - 修饰符:
private static final - 源码定位:
L54 - 说明:
TODO
- 类型:
-
MAP_ENTRY_ORDER- 类型:
Comparator<Entry<HashCode,HashCode>> - 修饰符:
private static final - 源码定位:
L55 - 说明:
TODO
- 类型:
-
MAPLIKE_ENTRY_ORDER- 类型:
Comparator<Pair<HashCode,HashCode>> - 修饰符:
private static final - 源码定位:
L57 - 说明:
TODO
- 类型:
-
CRC32C_INSTANCE- 类型:
HashOps - 修饰符:
public static final - 源码定位:
L59 - 说明:
TODO
- 类型:
-
hashFunction- 类型:
HashFunction - 修饰符:
private final - 源码定位:
L60 - 说明:
TODO
- 类型:
-
empty- 类型:
HashCode - 修饰符:
private final - 源码定位:
L61 - 说明:
TODO
- 类型:
-
emptyMap- 类型:
HashCode - 修饰符:
private final - 源码定位:
L62 - 说明:
TODO
- 类型:
-
emptyList- 类型:
HashCode - 修饰符:
private final - 源码定位:
L63 - 说明:
TODO
- 类型:
-
trueHash- 类型:
HashCode - 修饰符:
private final - 源码定位:
L64 - 说明:
TODO
- 类型:
-
falseHash- 类型:
HashCode - 修饰符:
private final - 源码定位:
L65 - 说明:
TODO
- 类型:
内部类/嵌套类型
-
net.minecraft.util.HashOps.ListHashBuilder- 类型:
class - 修饰符:
private - 源码定位:
L305 - 说明:
TODO
- 类型:
-
net.minecraft.util.HashOps.MapHashBuilder- 类型:
class - 修饰符:
private final - 源码定位:
L327 - 说明:
TODO
- 类型:
构造器
public HashOps(HashFunction hashFunction) @ L67
- 构造器名:HashOps
- 源码定位:L67
- 修饰符:public
参数:
- hashFunction: HashFunction
说明:
TODO
方法
下面的方法块按源码顺序生成。
public HashCode empty() @ L76
- 方法名:empty
- 源码定位:L76
- 返回类型:HashCode
- 修饰符:public
参数:
- 无
说明:
TODO
public HashCode emptyMap() @ L80
- 方法名:emptyMap
- 源码定位:L80
- 返回类型:HashCode
- 修饰符:public
参数:
- 无
说明:
TODO
public HashCode emptyList() @ L84
- 方法名:emptyList
- 源码定位:L84
- 返回类型:HashCode
- 修饰符:public
参数:
- 无
说明:
TODO
public HashCode createNumeric(Number value) @ L88
- 方法名:createNumeric
- 源码定位:L88
- 返回类型:HashCode
- 修饰符:public
参数:
- value: Number
说明:
TODO
public HashCode createByte(byte value) @ L100
- 方法名:createByte
- 源码定位:L100
- 返回类型:HashCode
- 修饰符:public
参数:
- value: byte
说明:
TODO
public HashCode createShort(short value) @ L104
- 方法名:createShort
- 源码定位:L104
- 返回类型:HashCode
- 修饰符:public
参数:
- value: short
说明:
TODO
public HashCode createInt(int value) @ L108
- 方法名:createInt
- 源码定位:L108
- 返回类型:HashCode
- 修饰符:public
参数:
- value: int
说明:
TODO
public HashCode createLong(long value) @ L112
- 方法名:createLong
- 源码定位:L112
- 返回类型:HashCode
- 修饰符:public
参数:
- value: long
说明:
TODO
public HashCode createFloat(float value) @ L116
- 方法名:createFloat
- 源码定位:L116
- 返回类型:HashCode
- 修饰符:public
参数:
- value: float
说明:
TODO
public HashCode createDouble(double value) @ L120
- 方法名:createDouble
- 源码定位:L120
- 返回类型:HashCode
- 修饰符:public
参数:
- value: double
说明:
TODO
public HashCode createString(String value) @ L124
- 方法名:createString
- 源码定位:L124
- 返回类型:HashCode
- 修饰符:public
参数:
- value: String
说明:
TODO
public HashCode createBoolean(boolean value) @ L128
- 方法名:createBoolean
- 源码定位:L128
- 返回类型:HashCode
- 修饰符:public
参数:
- value: boolean
说明:
TODO
private static Hasher hashMap(Hasher hasher, Map<HashCode,HashCode> map) @ L132
- 方法名:hashMap
- 源码定位:L132
- 返回类型:Hasher
- 修饰符:private static
参数:
- hasher: Hasher
- map: Map<HashCode,HashCode>
说明:
TODO
private static Hasher hashMap(Hasher hasher, Stream<Pair<HashCode,HashCode>> map) @ L139
- 方法名:hashMap
- 源码定位:L139
- 返回类型:Hasher
- 修饰符:private static
参数:
- hasher: Hasher
- map: Stream<Pair<HashCode,HashCode>>
说明:
TODO
public HashCode createMap(Stream<Pair<HashCode,HashCode>> map) @ L146
- 方法名:createMap
- 源码定位:L146
- 返回类型:HashCode
- 修饰符:public
参数:
- map: Stream<Pair<HashCode,HashCode>>
说明:
TODO
public HashCode createMap(Map<HashCode,HashCode> map) @ L150
- 方法名:createMap
- 源码定位:L150
- 返回类型:HashCode
- 修饰符:public
参数:
- map: Map<HashCode,HashCode>
说明:
TODO
public HashCode createList(Stream<HashCode> input) @ L154
- 方法名:createList
- 源码定位:L154
- 返回类型:HashCode
- 修饰符:public
参数:
- input: Stream
说明:
TODO
public HashCode createByteList(ByteBuffer input) @ L162
- 方法名:createByteList
- 源码定位:L162
- 返回类型:HashCode
- 修饰符:public
参数:
- input: ByteBuffer
说明:
TODO
public HashCode createIntList(IntStream input) @ L170
- 方法名:createIntList
- 源码定位:L170
- 返回类型:HashCode
- 修饰符:public
参数:
- input: IntStream
说明:
TODO
public HashCode createLongList(LongStream input) @ L178
- 方法名:createLongList
- 源码定位:L178
- 返回类型:HashCode
- 修饰符:public
参数:
- input: LongStream
说明:
TODO
public HashCode remove(HashCode input, String key) @ L186
- 方法名:remove
- 源码定位:L186
- 返回类型:HashCode
- 修饰符:public
参数:
- input: HashCode
- key: String
说明:
TODO
public RecordBuilder<HashCode> mapBuilder() @ L190
- 方法名:mapBuilder
- 源码定位:L190
- 返回类型:RecordBuilder
- 修饰符:public
参数:
- 无
说明:
TODO
public ListBuilder<HashCode> listBuilder() @ L195
- 方法名:listBuilder
- 源码定位:L195
- 返回类型:ListBuilder
- 修饰符:public
参数:
- 无
说明:
TODO
public String toString() @ L200
- 方法名:toString
- 源码定位:L200
- 返回类型:String
- 修饰符:public
参数:
- 无
说明:
TODO
public <U> U convertTo(DynamicOps<U> outOps, HashCode input) @ L205
- 方法名:convertTo
- 源码定位:L205
- 返回类型: U
- 修饰符:public
参数:
- outOps: DynamicOps
- input: HashCode
说明:
TODO
public Number getNumberValue(HashCode input, Number defaultValue) @ L209
- 方法名:getNumberValue
- 源码定位:L209
- 返回类型:Number
- 修饰符:public
参数:
- input: HashCode
- defaultValue: Number
说明:
TODO
public HashCode set(HashCode input, String key, HashCode value) @ L213
- 方法名:set
- 源码定位:L213
- 返回类型:HashCode
- 修饰符:public
参数:
- input: HashCode
- key: String
- value: HashCode
说明:
TODO
public HashCode update(HashCode input, String key, Function<HashCode,HashCode> function) @ L217
- 方法名:update
- 源码定位:L217
- 返回类型:HashCode
- 修饰符:public
参数:
- input: HashCode
- key: String
- function: Function<HashCode,HashCode>
说明:
TODO
public HashCode updateGeneric(HashCode input, HashCode key, Function<HashCode,HashCode> function) @ L221
- 方法名:updateGeneric
- 源码定位:L221
- 返回类型:HashCode
- 修饰符:public
参数:
- input: HashCode
- key: HashCode
- function: Function<HashCode,HashCode>
说明:
TODO
private static <T> DataResult<T> unsupported() @ L225
- 方法名:unsupported
- 源码定位:L225
- 返回类型:
DataResult - 修饰符:private static
参数:
- 无
说明:
TODO
public DataResult<HashCode> get(HashCode input, String key) @ L229
- 方法名:get
- 源码定位:L229
- 返回类型:DataResult
- 修饰符:public
参数:
- input: HashCode
- key: String
说明:
TODO
public DataResult<HashCode> getGeneric(HashCode input, HashCode key) @ L233
- 方法名:getGeneric
- 源码定位:L233
- 返回类型:DataResult
- 修饰符:public
参数:
- input: HashCode
- key: HashCode
说明:
TODO
public DataResult<Number> getNumberValue(HashCode input) @ L237
- 方法名:getNumberValue
- 源码定位:L237
- 返回类型:DataResult
- 修饰符:public
参数:
- input: HashCode
说明:
TODO
public DataResult<Boolean> getBooleanValue(HashCode input) @ L241
- 方法名:getBooleanValue
- 源码定位:L241
- 返回类型:DataResult
- 修饰符:public
参数:
- input: HashCode
说明:
TODO
public DataResult<String> getStringValue(HashCode input) @ L245
- 方法名:getStringValue
- 源码定位:L245
- 返回类型:DataResult
- 修饰符:public
参数:
- input: HashCode
说明:
TODO
private boolean isEmpty(HashCode value) @ L249
- 方法名:isEmpty
- 源码定位:L249
- 返回类型:boolean
- 修饰符:private
参数:
- value: HashCode
说明:
TODO
public DataResult<HashCode> mergeToList(HashCode prefix, HashCode value) @ L253
- 方法名:mergeToList
- 源码定位:L253
- 返回类型:DataResult
- 修饰符:public
参数:
- prefix: HashCode
- value: HashCode
说明:
TODO
public DataResult<HashCode> mergeToList(HashCode prefix, List<HashCode> values) @ L257
- 方法名:mergeToList
- 源码定位:L257
- 返回类型:DataResult
- 修饰符:public
参数:
- prefix: HashCode
- values: List
说明:
TODO
public DataResult<HashCode> mergeToMap(HashCode prefix, HashCode key, HashCode value) @ L261
- 方法名:mergeToMap
- 源码定位:L261
- 返回类型:DataResult
- 修饰符:public
参数:
- prefix: HashCode
- key: HashCode
- value: HashCode
说明:
TODO
public DataResult<HashCode> mergeToMap(HashCode prefix, Map<HashCode,HashCode> values) @ L265
- 方法名:mergeToMap
- 源码定位:L265
- 返回类型:DataResult
- 修饰符:public
参数:
- prefix: HashCode
- values: Map<HashCode,HashCode>
说明:
TODO
public DataResult<HashCode> mergeToMap(HashCode prefix, MapLike<HashCode> values) @ L269
- 方法名:mergeToMap
- 源码定位:L269
- 返回类型:DataResult
- 修饰符:public
参数:
- prefix: HashCode
- values: MapLike
说明:
TODO
public DataResult<Stream<Pair<HashCode,HashCode>>> getMapValues(HashCode input) @ L273
- 方法名:getMapValues
- 源码定位:L273
- 返回类型:DataResult<Stream<Pair<HashCode,HashCode>>>
- 修饰符:public
参数:
- input: HashCode
说明:
TODO
public DataResult<Consumer<BiConsumer<HashCode,HashCode>>> getMapEntries(HashCode input) @ L277
- 方法名:getMapEntries
- 源码定位:L277
- 返回类型:DataResult<Consumer<BiConsumer<HashCode,HashCode>>>
- 修饰符:public
参数:
- input: HashCode
说明:
TODO
public DataResult<Stream<HashCode>> getStream(HashCode input) @ L281
- 方法名:getStream
- 源码定位:L281
- 返回类型:DataResult<Stream
> - 修饰符:public
参数:
- input: HashCode
说明:
TODO
public DataResult<Consumer<Consumer<HashCode>>> getList(HashCode input) @ L285
- 方法名:getList
- 源码定位:L285
- 返回类型:DataResult<Consumer<Consumer
>> - 修饰符:public
参数:
- input: HashCode
说明:
TODO
public DataResult<MapLike<HashCode>> getMap(HashCode input) @ L289
- 方法名:getMap
- 源码定位:L289
- 返回类型:DataResult<MapLike
> - 修饰符:public
参数:
- input: HashCode
说明:
TODO
public DataResult<ByteBuffer> getByteBuffer(HashCode input) @ L293
- 方法名:getByteBuffer
- 源码定位:L293
- 返回类型:DataResult
- 修饰符:public
参数:
- input: HashCode
说明:
TODO
public DataResult<IntStream> getIntStream(HashCode input) @ L297
- 方法名:getIntStream
- 源码定位:L297
- 返回类型:DataResult
- 修饰符:public
参数:
- input: HashCode
说明:
TODO
public DataResult<LongStream> getLongStream(HashCode input) @ L301
- 方法名:getLongStream
- 源码定位:L301
- 返回类型:DataResult
- 修饰符:public
参数:
- input: HashCode
说明:
TODO
代码
public class HashOps implements DynamicOps<HashCode> {
private static final byte TAG_EMPTY = 1;
private static final byte TAG_MAP_START = 2;
private static final byte TAG_MAP_END = 3;
private static final byte TAG_LIST_START = 4;
private static final byte TAG_LIST_END = 5;
private static final byte TAG_BYTE = 6;
private static final byte TAG_SHORT = 7;
private static final byte TAG_INT = 8;
private static final byte TAG_LONG = 9;
private static final byte TAG_FLOAT = 10;
private static final byte TAG_DOUBLE = 11;
private static final byte TAG_STRING = 12;
private static final byte TAG_BOOLEAN = 13;
private static final byte TAG_BYTE_ARRAY_START = 14;
private static final byte TAG_BYTE_ARRAY_END = 15;
private static final byte TAG_INT_ARRAY_START = 16;
private static final byte TAG_INT_ARRAY_END = 17;
private static final byte TAG_LONG_ARRAY_START = 18;
private static final byte TAG_LONG_ARRAY_END = 19;
private static final byte[] EMPTY_PAYLOAD = new byte[]{1};
private static final byte[] FALSE_PAYLOAD = new byte[]{13, 0};
private static final byte[] TRUE_PAYLOAD = new byte[]{13, 1};
public static final byte[] EMPTY_MAP_PAYLOAD = new byte[]{2, 3};
public static final byte[] EMPTY_LIST_PAYLOAD = new byte[]{4, 5};
private static final DataResult<Object> UNSUPPORTED_OPERATION_ERROR = DataResult.error(() -> "Unsupported operation");
private static final Comparator<HashCode> HASH_COMPARATOR = Comparator.comparingLong(HashCode::padToLong);
private static final Comparator<Entry<HashCode, HashCode>> MAP_ENTRY_ORDER = Entry.<HashCode, HashCode>comparingByKey(HASH_COMPARATOR)
.thenComparing(Entry.comparingByValue(HASH_COMPARATOR));
private static final Comparator<Pair<HashCode, HashCode>> MAPLIKE_ENTRY_ORDER = Comparator.<Pair<HashCode, HashCode>, HashCode>comparing(Pair::getFirst, HASH_COMPARATOR)
.thenComparing(Pair::getSecond, HASH_COMPARATOR);
public static final HashOps CRC32C_INSTANCE = new HashOps(Hashing.crc32c());
private final HashFunction hashFunction;
private final HashCode empty;
private final HashCode emptyMap;
private final HashCode emptyList;
private final HashCode trueHash;
private final HashCode falseHash;
public HashOps(HashFunction hashFunction) {
this.hashFunction = hashFunction;
this.empty = hashFunction.hashBytes(EMPTY_PAYLOAD);
this.emptyMap = hashFunction.hashBytes(EMPTY_MAP_PAYLOAD);
this.emptyList = hashFunction.hashBytes(EMPTY_LIST_PAYLOAD);
this.falseHash = hashFunction.hashBytes(FALSE_PAYLOAD);
this.trueHash = hashFunction.hashBytes(TRUE_PAYLOAD);
}
public HashCode empty() {
return this.empty;
}
public HashCode emptyMap() {
return this.emptyMap;
}
public HashCode emptyList() {
return this.emptyList;
}
public HashCode createNumeric(Number value) {
return switch (value) {
case Byte v -> this.createByte(v);
case Short vx -> this.createShort(vx);
case Integer vxx -> this.createInt(vxx);
case Long vxxx -> this.createLong(vxxx);
case Double vxxxx -> this.createDouble(vxxxx);
case Float vxxxxx -> this.createFloat(vxxxxx);
default -> this.createDouble(value.doubleValue());
};
}
public HashCode createByte(byte value) {
return this.hashFunction.newHasher(2).putByte((byte)6).putByte(value).hash();
}
public HashCode createShort(short value) {
return this.hashFunction.newHasher(3).putByte((byte)7).putShort(value).hash();
}
public HashCode createInt(int value) {
return this.hashFunction.newHasher(5).putByte((byte)8).putInt(value).hash();
}
public HashCode createLong(long value) {
return this.hashFunction.newHasher(9).putByte((byte)9).putLong(value).hash();
}
public HashCode createFloat(float value) {
return this.hashFunction.newHasher(5).putByte((byte)10).putFloat(value).hash();
}
public HashCode createDouble(double value) {
return this.hashFunction.newHasher(9).putByte((byte)11).putDouble(value).hash();
}
public HashCode createString(String value) {
return this.hashFunction.newHasher().putByte((byte)12).putInt(value.length()).putUnencodedChars(value).hash();
}
public HashCode createBoolean(boolean value) {
return value ? this.trueHash : this.falseHash;
}
private static Hasher hashMap(Hasher hasher, Map<HashCode, HashCode> map) {
hasher.putByte((byte)2);
map.entrySet().stream().sorted(MAP_ENTRY_ORDER).forEach(e -> hasher.putBytes(e.getKey().asBytes()).putBytes(e.getValue().asBytes()));
hasher.putByte((byte)3);
return hasher;
}
private static Hasher hashMap(Hasher hasher, Stream<Pair<HashCode, HashCode>> map) {
hasher.putByte((byte)2);
map.sorted(MAPLIKE_ENTRY_ORDER).forEach(e -> hasher.putBytes(e.getFirst().asBytes()).putBytes(e.getSecond().asBytes()));
hasher.putByte((byte)3);
return hasher;
}
public HashCode createMap(Stream<Pair<HashCode, HashCode>> map) {
return hashMap(this.hashFunction.newHasher(), map).hash();
}
public HashCode createMap(Map<HashCode, HashCode> map) {
return hashMap(this.hashFunction.newHasher(), map).hash();
}
public HashCode createList(Stream<HashCode> input) {
Hasher hasher = this.hashFunction.newHasher();
hasher.putByte((byte)4);
input.forEach(value -> hasher.putBytes(value.asBytes()));
hasher.putByte((byte)5);
return hasher.hash();
}
public HashCode createByteList(ByteBuffer input) {
Hasher hasher = this.hashFunction.newHasher();
hasher.putByte((byte)14);
hasher.putBytes(input);
hasher.putByte((byte)15);
return hasher.hash();
}
public HashCode createIntList(IntStream input) {
Hasher hasher = this.hashFunction.newHasher();
hasher.putByte((byte)16);
input.forEach(hasher::putInt);
hasher.putByte((byte)17);
return hasher.hash();
}
public HashCode createLongList(LongStream input) {
Hasher hasher = this.hashFunction.newHasher();
hasher.putByte((byte)18);
input.forEach(hasher::putLong);
hasher.putByte((byte)19);
return hasher.hash();
}
public HashCode remove(HashCode input, String key) {
return input;
}
@Override
public RecordBuilder<HashCode> mapBuilder() {
return new HashOps.MapHashBuilder();
}
@Override
public ListBuilder<HashCode> listBuilder() {
return new HashOps.ListHashBuilder();
}
@Override
public String toString() {
return "Hash " + this.hashFunction;
}
public <U> U convertTo(DynamicOps<U> outOps, HashCode input) {
throw new UnsupportedOperationException("Can't convert from this type");
}
public Number getNumberValue(HashCode input, Number defaultValue) {
return defaultValue;
}
public HashCode set(HashCode input, String key, HashCode value) {
return input;
}
public HashCode update(HashCode input, String key, Function<HashCode, HashCode> function) {
return input;
}
public HashCode updateGeneric(HashCode input, HashCode key, Function<HashCode, HashCode> function) {
return input;
}
private static <T> DataResult<T> unsupported() {
return (DataResult<T>)UNSUPPORTED_OPERATION_ERROR;
}
public DataResult<HashCode> get(HashCode input, String key) {
return unsupported();
}
public DataResult<HashCode> getGeneric(HashCode input, HashCode key) {
return unsupported();
}
public DataResult<Number> getNumberValue(HashCode input) {
return unsupported();
}
public DataResult<Boolean> getBooleanValue(HashCode input) {
return unsupported();
}
public DataResult<String> getStringValue(HashCode input) {
return unsupported();
}
private boolean isEmpty(HashCode value) {
return value.equals(this.empty);
}
public DataResult<HashCode> mergeToList(HashCode prefix, HashCode value) {
return this.isEmpty(prefix) ? DataResult.success(this.createList(Stream.of(value))) : unsupported();
}
public DataResult<HashCode> mergeToList(HashCode prefix, List<HashCode> values) {
return this.isEmpty(prefix) ? DataResult.success(this.createList(values.stream())) : unsupported();
}
public DataResult<HashCode> mergeToMap(HashCode prefix, HashCode key, HashCode value) {
return this.isEmpty(prefix) ? DataResult.success(this.createMap(Map.of(key, value))) : unsupported();
}
public DataResult<HashCode> mergeToMap(HashCode prefix, Map<HashCode, HashCode> values) {
return this.isEmpty(prefix) ? DataResult.success(this.createMap(values)) : unsupported();
}
public DataResult<HashCode> mergeToMap(HashCode prefix, MapLike<HashCode> values) {
return this.isEmpty(prefix) ? DataResult.success(this.createMap(values.entries())) : unsupported();
}
public DataResult<Stream<Pair<HashCode, HashCode>>> getMapValues(HashCode input) {
return unsupported();
}
public DataResult<Consumer<BiConsumer<HashCode, HashCode>>> getMapEntries(HashCode input) {
return unsupported();
}
public DataResult<Stream<HashCode>> getStream(HashCode input) {
return unsupported();
}
public DataResult<Consumer<Consumer<HashCode>>> getList(HashCode input) {
return unsupported();
}
public DataResult<MapLike<HashCode>> getMap(HashCode input) {
return unsupported();
}
public DataResult<ByteBuffer> getByteBuffer(HashCode input) {
return unsupported();
}
public DataResult<IntStream> getIntStream(HashCode input) {
return unsupported();
}
public DataResult<LongStream> getLongStream(HashCode input) {
return unsupported();
}
private class ListHashBuilder extends AbstractListBuilder<HashCode, Hasher> {
public ListHashBuilder() {
Objects.requireNonNull(HashOps.this);
super(HashOps.this);
}
protected Hasher initBuilder() {
return HashOps.this.hashFunction.newHasher().putByte((byte)4);
}
protected Hasher append(Hasher hasher, HashCode value) {
return hasher.putBytes(value.asBytes());
}
protected DataResult<HashCode> build(Hasher hasher, HashCode prefix) {
assert prefix.equals(HashOps.this.empty);
hasher.putByte((byte)5);
return DataResult.success(hasher.hash());
}
}
private final class MapHashBuilder extends AbstractUniversalBuilder<HashCode, List<Pair<HashCode, HashCode>>> {
public MapHashBuilder() {
Objects.requireNonNull(HashOps.this);
super(HashOps.this);
}
protected List<Pair<HashCode, HashCode>> initBuilder() {
return new ArrayList<>();
}
protected List<Pair<HashCode, HashCode>> append(HashCode key, HashCode value, List<Pair<HashCode, HashCode>> builder) {
builder.add(Pair.of(key, value));
return builder;
}
protected DataResult<HashCode> build(List<Pair<HashCode, HashCode>> builder, HashCode prefix) {
assert HashOps.this.isEmpty(prefix);
return DataResult.success(HashOps.hashMap(HashOps.this.hashFunction.newHasher(), builder.stream()).hash());
}
}
}引用的其他类
- CollectToTag
- 引用位置:
返回值
- 引用位置: