skadistats.clarity.model.GameEventDescriptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clarity Show documentation
Show all versions of clarity Show documentation
Clarity is an open source replay parser for Dota 2, CSGO, CS2 and Deadlock written in Java.
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();
}
}