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

skadistats.clarity.io.s2.Serializer Maven / Gradle / Ivy

Go to download

Clarity is an open source replay parser for Dota 2, CSGO, CS2 and Deadlock written in Java.

There is a newer version: 3.1.1
Show newest version
package skadistats.clarity.io.s2;

public class Serializer {

    private final SerializerId id;
    private final Field[] fields;
    private final String[] fieldNames;

    public Serializer(SerializerId id, Field[] fields, String[] fieldNames) {
        this.id = id;
        this.fields = fields;
        this.fieldNames = fieldNames;
    }

    public SerializerId getId() {
        return id;
    }

    public int getFieldCount() {
        return fields.length;
    }

    public Field getField(int idx) {
        return fields[idx];
    }

    public String getFieldName(int idx) {
        return fieldNames[idx];
    }

    public Integer getFieldIndex(String name) {
        var searchHash = name.hashCode();
        for (var i = 0; i < fields.length; i++) {
            var fieldName = fieldNames[i];
            if (searchHash != fieldName.hashCode()) continue;
            if (name.equals(fieldName)) return i;
        }
        return null;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy