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

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

import skadistats.clarity.model.FieldPath;
import skadistats.clarity.util.TextTable;

import java.util.Iterator;
import java.util.function.Function;

public interface EntityState {

    EntityState copy();

    // returns true if capacity has changed
    boolean setValueForFieldPath(FieldPath fp, Object value);
     T getValueForFieldPath(FieldPath fp);

    Iterator fieldPathIterator();

    default String dump(String title, Function nameResolver) {
        final var table = new TextTable.Builder()
                .setFrame(TextTable.FRAME_COMPAT)
                .addColumn("FP")
                .addColumn("Property")
                .addColumn("Value")
                .setTitle(title)
                .build();

        var i = 0;
        final var iter = fieldPathIterator();
        while (iter.hasNext()) {
            var fp = iter.next();
            table.setData(i, 0, fp);
            table.setData(i, 1, nameResolver.apply(fp));
            table.setData(i, 2, getValueForFieldPath(fp));
            i++;
        }

        return table.toString();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy