From f9788d162fec6c8bc44f951498b5c169e397a5cb Mon Sep 17 00:00:00 2001 From: asofold Date: Sun, 21 Oct 2012 06:21:04 +0200 Subject: [PATCH] Simplify internals of ExecutionHistory. --- .../nocheatplus/players/ExecutionHistory.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/fr/neatmonster/nocheatplus/players/ExecutionHistory.java b/src/fr/neatmonster/nocheatplus/players/ExecutionHistory.java index e5190e5c..39d2da32 100644 --- a/src/fr/neatmonster/nocheatplus/players/ExecutionHistory.java +++ b/src/fr/neatmonster/nocheatplus/players/ExecutionHistory.java @@ -32,7 +32,7 @@ public class ExecutionHistory { /** * Represents an entry in the execution history. */ - private static class ExecutionHistoryEntry { + public static class ExecutionHistoryEntry { /** The execution times. */ private final int executionTimes[]; @@ -132,13 +132,13 @@ public class ExecutionHistory { } /** Store data between events (time + action + action-counter). **/ - private final Map> executionHistories; + private final Map entries; /** * Instantiates a new execution history. */ public ExecutionHistory() { - executionHistories = new HashMap>(); + entries = new HashMap(); } /** @@ -154,18 +154,11 @@ public class ExecutionHistory { * @return true, if the action is to be executed. */ public boolean executeAction(final ViolationData violationData, final Action action, final long time) { - final String check = violationData.check.getType().getName(); - Map executionHistory = executionHistories.get(check); - if (executionHistory == null) { - executionHistory = new HashMap(); - executionHistories.put(check, executionHistory); - } - - ExecutionHistoryEntry entry = executionHistory.get(action); + ExecutionHistoryEntry entry = entries.get(action); if (entry == null) { entry = new ExecutionHistoryEntry(60); - executionHistory.put(action, entry); + entries.put(action, entry); } // Update entry.