All Downloads are FREE. Search and download functionalities are using the official Maven repository.

skadistats.clarity.wire.ClassToKindMessageRegistry Maven / Gradle / Ivy

Go to download

Clarity is an open source replay parser for Dota 2 and CSGO 1 and 2 written in Java. This JAR contains the protobuf classes for clarity.

There is a newer version: 5.3
Show newest version
package skadistats.clarity.wire;

import com.google.protobuf.GeneratedMessage;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;

public class ClassToKindMessageRegistry {

    private final Object2IntOpenHashMap> map;

    public ClassToKindMessageRegistry(int expected) {
        map = new Object2IntOpenHashMap<>(expected, .5f);
    }

    public void put(int kind, Class clazz) {
        map.put(clazz, kind);
    }

    public boolean containsClass(Class clazz) {
        return map.containsKey(clazz);
    }

    public Integer kindForClass(Class clazz) {
        int kind = map.getOrDefault(clazz, -1);
        return kind != -1 ? kind : null;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy