From 91a69adae18935b8369ace9e203494a166f11d26 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 9 Nov 2019 20:09:16 -0800 Subject: [PATCH] Split out Results class. --- .../calculators/IslandLevelCalculator.java | 10 + .../bentobox/level/calculators/Results.java | 173 ++++++++++++++++++ 2 files changed, 183 insertions(+) create mode 100644 src/main/java/world/bentobox/level/calculators/IslandLevelCalculator.java create mode 100644 src/main/java/world/bentobox/level/calculators/Results.java diff --git a/src/main/java/world/bentobox/level/calculators/IslandLevelCalculator.java b/src/main/java/world/bentobox/level/calculators/IslandLevelCalculator.java new file mode 100644 index 0000000..d3cde39 --- /dev/null +++ b/src/main/java/world/bentobox/level/calculators/IslandLevelCalculator.java @@ -0,0 +1,10 @@ +package world.bentobox.level.calculators; + +public interface IslandLevelCalculator { + + /** + * @return the results of the island calculation + */ + public Results getResult(); + +} diff --git a/src/main/java/world/bentobox/level/calculators/Results.java b/src/main/java/world/bentobox/level/calculators/Results.java new file mode 100644 index 0000000..28b70b9 --- /dev/null +++ b/src/main/java/world/bentobox/level/calculators/Results.java @@ -0,0 +1,173 @@ +package world.bentobox.level.calculators; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Material; + +import com.google.common.collect.HashMultiset; +import com.google.common.collect.Multiset; + +/** + * Results class + * + */ +public class Results { + private int deathHandicap = 0; + private long initialLevel = 0; + private long level = 0; + private final Multiset mdCount = HashMultiset.create(); + private final Multiset ncCount = HashMultiset.create(); + private final Multiset ofCount = HashMultiset.create(); + private long pointsToNextLevel = 0; + private long rawBlockCount = 0; + private List report = new ArrayList<>(); + private long underWaterBlockCount = 0; + private final Multiset uwCount = HashMultiset.create(); + + /** + * @return the deathHandicap + */ + public int getDeathHandicap() { + return deathHandicap; + } + + public long getInitialLevel() { + return initialLevel; + } + /** + * @return the level + */ + public long getLevel() { + return level; + } + /** + * @return the mdCount + */ + public Multiset getMdCount() { + return mdCount; + } + /** + * @return the ncCount + */ + public Multiset getNcCount() { + return ncCount; + } + + /** + * @return the ofCount + */ + public Multiset getOfCount() { + return ofCount; + } + + /** + * @return the pointsToNextLevel + */ + public long getPointsToNextLevel() { + return pointsToNextLevel; + } + + /** + * @return the rawBlockCount + */ + public long getRawBlockCount() { + return rawBlockCount; + } + + /** + * @return the report + */ + public List getReport() { + return report; + } + + /** + * @return the underWaterBlockCount + */ + public long getUnderWaterBlockCount() { + return underWaterBlockCount; + } + + /** + * @return the uwCount + */ + public Multiset getUwCount() { + return uwCount; + } + + /** + * @param deathHandicap the deathHandicap to set + */ + public void setDeathHandicap(int deathHandicap) { + this.deathHandicap = deathHandicap; + } + + public void setInitialLevel(long initialLevel) { + this.initialLevel = initialLevel; + } + + /** + * Set level + * @param level - level + */ + public void setLevel(int level) { + this.level = level; + } + + /** + * @param level the level to set + */ + public void setLevel(long level) { + this.level = level; + } + + /** + * @param pointsToNextLevel the pointsToNextLevel to set + */ + public void setPointsToNextLevel(long pointsToNextLevel) { + this.pointsToNextLevel = pointsToNextLevel; + } + + /** + * @param rawBlockCount the rawBlockCount to set + */ + public void setRawBlockCount(long rawBlockCount) { + this.rawBlockCount = rawBlockCount; + } + + /** + * @param report the report to set + */ + public void setReport(List report) { + this.report = report; + } + + /** + * @param underWaterBlockCount the underWaterBlockCount to set + */ + public void setUnderWaterBlockCount(long underWaterBlockCount) { + this.underWaterBlockCount = underWaterBlockCount; + } + + /** + * Add to death handicap + * @param deaths - number to add + */ + public void addToDeathHandicap(int deaths) { + this.deathHandicap += deaths; + + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Results [report=" + report + ", mdCount=" + mdCount + ", uwCount=" + getUwCount() + ", ncCount=" + + ncCount + ", ofCount=" + ofCount + ", rawBlockCount=" + rawBlockCount + ", underWaterBlockCount=" + + getUnderWaterBlockCount() + ", level=" + level + ", deathHandicap=" + deathHandicap + + ", pointsToNextLevel=" + pointsToNextLevel + ", initialLevel=" + initialLevel + "]"; + } + +} \ No newline at end of file