[Polycasso-commit] SF.net SVN: polycasso:[71] trunk/polycasso/src/com/mebigfatguy/polycasso/ Improv
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2009-11-27 19:39:11
|
Revision: 71
http://polycasso.svn.sourceforge.net/polycasso/?rev=71&view=rev
Author: dbrosius
Date: 2009-11-27 19:39:00 +0000 (Fri, 27 Nov 2009)
Log Message:
-----------
rollback keeping of overall stats, as that is not what is needed, we need sum of individual stats
Modified Paths:
--------------
trunk/polycasso/src/com/mebigfatguy/polycasso/ImprovementTypeStats.java
Modified: trunk/polycasso/src/com/mebigfatguy/polycasso/ImprovementTypeStats.java
===================================================================
--- trunk/polycasso/src/com/mebigfatguy/polycasso/ImprovementTypeStats.java 2009-11-27 19:32:52 UTC (rev 70)
+++ trunk/polycasso/src/com/mebigfatguy/polycasso/ImprovementTypeStats.java 2009-11-27 19:39:00 UTC (rev 71)
@@ -40,8 +40,6 @@
return successes + "/" + totals + " [" + pct + "]";
}
}
- private int overallSuccesses = 1;
- private int overallTotals = 1;
private Map<ImprovementType, Stats> typeStats = new EnumMap<ImprovementType, Stats>(ImprovementType.class);
private Random r = new Random();
@@ -64,10 +62,8 @@
Stats stats = typeStats.get(type);
if (successful) {
stats.successes++;
- overallSuccesses++;
}
stats.totals++;
- overallTotals++;
failureRun = successful ? 0 : failureRun + 1;
if (failureRun > MAX_FAILURE_RUN) {
initStats();
@@ -85,7 +81,10 @@
public ImprovementType getRandomImprovementType() {
double pct = r.nextDouble();
- double totalPct = ((double) overallSuccesses) / ((double) overallTotals);
+ double totalPct = 0.0;
+ for (Stats stat : typeStats.values()) {
+ totalPct += stat.pct;
+ }
for (Map.Entry<ImprovementType, Stats> entry : typeStats.entrySet()) {
Stats stat = entry.getValue();
@@ -102,11 +101,9 @@
@Override
public String toString() {
StringBuilder sb = new StringBuilder(100);
- double pct = ((double) overallSuccesses) / ((double) overallTotals);
- sb.append("Overall Success %: ").append(pct);
for (Map.Entry<ImprovementType, Stats> entry : typeStats.entrySet()) {
Stats stat = entry.getValue();
- sb.append(" ").append(entry.getKey().name()).append(" % = ").append(stat.pct);
+ sb.append(" ").append(entry.getKey().name()).append("% = ").append(stat.pct);
}
return sb.toString();
}
@@ -118,8 +115,6 @@
for (ImprovementType type : values) {
typeStats.put(type, new Stats());
}
- overallSuccesses = 1;
- overallTotals = 1;
failureRun = 0;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|