Newer
Older
Algolike / src / main / java / resources / HandsA.java
package resources;

import java.util.*;

public class HandsA {
    private Map.Entry<Boolean, Map.Entry<Integer, Integer>> succeedSelectA;
    private Map.Entry<Boolean, Map.Entry<Integer, Integer>> succeedSelectB;
    private Map.Entry<Boolean, Integer> succeedDrawB;
    private Map.Entry<Boolean, Integer> succeedDrawA;
    private LoseA loseA;
    private List<Map.Entry<Integer, Boolean>> value = new ArrayList<Map.Entry<Integer, Boolean>>();

    public HandsA(LoseA loseA) {
        this.loseA = loseA;
    }

    public List<Map.Entry<Integer, Boolean>> getValue() {
        return value;
    }

    public void updateSucceedSelectA(Map.Entry<Boolean, Map.Entry<Integer, Integer>> succeedSelectA) {
        this.succeedSelectA = succeedSelectA;
        List<Map.Entry<Integer, Boolean>> temp_if3;
        if (succeedSelectA.getKey()) {
            temp_if3 = this.value;
        } else {
            this.value.set(succeedSelectA.getValue().getValue(), new AbstractMap.SimpleEntry<>(this.value.get(succeedSelectA.getValue().getValue()).getKey(), true));
            temp_if3 = this.value;
        }
        value = temp_if3;
        this.loseA.updateHandsA(value);
    }

    public void updateSucceedSelectB(Map.Entry<Boolean, Map.Entry<Integer, Integer>> succeedSelectB) {
        this.succeedSelectB = succeedSelectB;
        List<Map.Entry<Integer, Boolean>> temp_if4;
        if (succeedSelectB.getKey()) {
            this.value.set(succeedSelectB.getValue().getKey(), new AbstractMap.SimpleEntry<>(this.value.get(succeedSelectB.getValue().getKey()).getKey(), true));
            temp_if4 = this.value;
        } else {
            temp_if4 = this.value;
        }
        value = temp_if4;
        this.loseA.updateHandsA(value);
    }

    public void updateSucceedDrawB(Map.Entry<Boolean, Integer> succeedDrawB, List<Map.Entry<Integer, Boolean>> deck) {
        this.succeedDrawB = succeedDrawB;
        List<Map.Entry<Integer, Boolean>> temp_if6;
        if (succeedDrawB.getKey()) {
            this.value.set(succeedDrawB.getValue(), new AbstractMap.SimpleEntry<>(this.value.get(succeedDrawB.getValue()).getKey(), true));
            temp_if6 = this.value;
        } else {
            temp_if6 = this.value;
        }
        value = temp_if6;
        this.loseA.updateHandsA(value);
    }

    public void updateSucceedDrawA(Map.Entry<Boolean, Integer> succeedDrawA, List<Map.Entry<Integer, Boolean>> deck) {
        this.succeedDrawA = succeedDrawA;
        List<Map.Entry<Integer, Boolean>> temp_if7;
        if (succeedDrawA.getKey()) {
            this.value.add(0, new AbstractMap.SimpleEntry<>(deck.get(0).getKey(), false));
            this.value.sort(Comparator.comparing(Map.Entry<Integer, Boolean>::getKey));
            temp_if7 = this.value;
        } else {
            this.value.add(0, new AbstractMap.SimpleEntry<>(deck.get(0).getKey(), true));
            this.value.sort(Comparator.comparing(Map.Entry<Integer, Boolean>::getKey));
            temp_if7 = this.value;
        }
        value = temp_if7;
        this.loseA.updateHandsA(value);
    }
}