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

skadistats.clarity.model.GameEventDescriptor 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.model;

import java.util.HashMap;
import java.util.Map;


public class GameEventDescriptor {

    private final int eventId;
    private final String name;
    private final String[] keys;
    private final Map indexByKey = new HashMap<>();


    public GameEventDescriptor(int eventId, String name, String[] keys) {
        this.eventId = eventId;
        this.name = name;
        this.keys = keys;
        for (var i = 0; i < keys.length; i++) {
            indexByKey.put(keys[i], i);
        }
    }

    public int getEventId() {
        return eventId;
    }

    public String getName() {
        return name;
    }

    public String[] getKeys() {
        return keys;
    }

    public Integer getIndexForKey(String key) {
        return indexByKey.get(key);
    }

    @Override
    public String toString() {
        final var sb = new StringBuilder("GameEventDescriptor [");
        sb.append("eventId=").append(eventId);
        sb.append(", name='").append(name).append('\'');
        sb.append(']');
        return sb.toString();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy