This commit is contained in:
Aubri Seebauer committed 2023-04-21 18:02:43 -04:00
1 parent 837b842c0e
commit 6176a61e05
6 files changed
+149 -163

No files matched your search

@@ -1,8 +1,6 @@
package org.aubrithehuman.entitybingo;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
public class BingoEvent {
@@ -10,11 +8,8 @@ public class BingoEvent {
private boolean done = false;
private final long age;
public BingoEvent() {
this.entries = new HashMap<>();
age = System.currentTimeMillis();
}
public HashMap<String, Integer> getEntries() {
@@ -25,12 +20,12 @@ public class BingoEvent {
* return 0 if this is first guess, 1 if previous guess, 2 if guess already exists.
*
* @param player player
* @param value value
* @param value value
* @return previous guess
*/
public int addEntry(String player, int value) {
if(!entries.containsValue(value)) {
if(!entries.containsKey(player)) {
if (!entries.containsValue(value)) {
if (!entries.containsKey(player)) {
entries.put(player, value);
return 0;
}
@@ -41,29 +36,6 @@ public class BingoEvent {
}
public int totalGuesses() {
return this.entries.size();
}
/**
* Return a player based on the entry, if none match then return null;
*
* @param i value
* @return player
*/
public String getByEntry(int i) {
for(String s : entries.keySet()) {
if (entries.get(s) == i) {
return s;
}
}
return null;
}
public long getAge() {
return age;
}
public boolean isDone() {
return done;
}