package models; import java.util.*; public class HandsB { private LoseB loseB; private List<Map.Entry<Integer, Boolean>> value = new ArrayList<Map.Entry<Integer, Boolean>>(); public HandsB(LoseB loseB) { this.loseB = loseB; } public void selectA(int guess, int attacker, List<Map.Entry<Integer, Boolean>> b, int target) { List<Map.Entry<Integer, Boolean>> temp_if2; if ((this.value.get(target).getKey()==guess)) { this.value.set(target,new AbstractMap.SimpleEntry<>(this.value.get(target).getKey(), true)); temp_if2 = this.value; } else { temp_if2 = this.value; } this.value = temp_if2; this.loseB.updateHandsB(value); } public void drawB(int guess, List<Map.Entry<Integer, Boolean>> a, List<Map.Entry<Integer, Boolean>> d, int target) { List<Map.Entry<Integer, Boolean>> temp_if1; if ((a.get(target).getKey()==guess)) { this.value.add(0, new AbstractMap.SimpleEntry<>(d.get(0).getKey(), false)); this.value.sort(Comparator.comparing(Map.Entry<Integer, Boolean>::getKey)); temp_if1 = this.value; } else { this.value.add(0, new AbstractMap.SimpleEntry<>(d.get(0).getKey(), true)); this.value.sort(Comparator.comparing(Map.Entry<Integer, Boolean>::getKey)); temp_if1 = this.value; } this.value = temp_if1; this.loseB.updateHandsB(value); } public void drawA(int guess, List<Map.Entry<Integer, Boolean>> b, List<Map.Entry<Integer, Boolean>> d, int target) { List<Map.Entry<Integer, Boolean>> temp_if3; if ((this.value.get(target).getKey()==guess)) { this.value.set(target,new AbstractMap.SimpleEntry<>(this.value.get(target).getKey(), true)); temp_if3 = this.value; } else { temp_if3 = this.value; } this.value = temp_if3; this.loseB.updateHandsB(value); } public void selectB(int guess, int attacker, List<Map.Entry<Integer, Boolean>> a, int target) { List<Map.Entry<Integer, Boolean>> temp_if0; if ((a.get(target).getKey()==guess)) { temp_if0 = this.value; } else { this.value.set(attacker,new AbstractMap.SimpleEntry<>(this.value.get(attacker).getKey(), true)); temp_if0 = this.value; } this.value = temp_if0; this.loseB.updateHandsB(value); } public List<Map.Entry<Integer, Boolean>> getValue() { return value; } }