package xyz.etztech.serverapi.web.api; import com.expediagroup.graphql.annotations.GraphQLDescription; import com.expediagroup.graphql.annotations.GraphQLName; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.LinkedList; @GraphQLName("TPS") @GraphQLDescription("TPS GraphQL") public class TPSAPI { private final LinkedList history; public TPSAPI(LinkedList history) { this.history = history; } @GraphQLName("history") public LinkedList getHistory() { return history; } @JsonProperty("average") @GraphQLName("average") public float getAverageTPS() { float avg = 0; if (history.size() == 0) return avg; for (Float f : history) { if (f != null) { avg += f; } } return avg / history.size(); } }