package de.ivu.elect.business.system.entity;

import static java.util.Arrays.asList;

public class HibernateSecondLevelCacheStatistik {

  private final String name;

  public HibernateSecondLevelCacheStatistik(String name) {
    this.name = name;
  }

  public String getName() {
    return name;
  }

  public long getSizeInMemory() {
    return 0L;
  }

  public long getElementCountOnDisk() {
    return 0L;
  }

  public long getElementCountInMemory() {
    return 0L;
  }

  public long getPutCount() {
    return 0L;
  }

  public long getMissCount() {
    return 0L;
  }

  public long getHitCount() {
    return 0L;
  }

  public boolean isWertVorhanden() {
    return getSizeInMemory() > 0 || getElementCountOnDisk() > 0 || getElementCountInMemory() > 0 || getPutCount() > 0 || getMissCount() > 0 || getHitCount() > 0;
  }

  @Override
  public String toString() {
    return "|" + String.join("|", asList(getName(), Long.toString(getPutCount()), Long.toString(getHitCount()), Long.toString(getMissCount()),
            Long.toString(getElementCountInMemory()), Long.toString(getElementCountOnDisk()), Long.toString(getSizeInMemory()))) + "|";
  }

  public static String toStringHeader() {
    return "||" + String.join("||",
            asList("Name", "Puts", "Hits", "Misses", "Element count in memory", "Element count on disk", "Size in memory")) + "||";
  }

}
