Newer
Older
Algolike / src / main / java / models / HandsB.java
package models;

import java.util.*;

public class HandsB {
	private Map.Entry<Boolean, Integer> succeedDrawB;
	private Map.Entry<Boolean, Map.Entry<Integer, Integer>> succeedSelectA;
	private Map.Entry<Boolean, Integer> succeedDrawA;
	private Map.Entry<Boolean, Map.Entry<Integer, Integer>> succeedSelectB;
	private LoseB loseB;
	private List<Map.Entry<Integer, Boolean>> value = new ArrayList<Map.Entry<Integer, Boolean>>();
	public HandsB(LoseB loseB) {
		this.loseB = loseB;
	}
	public List<Map.Entry<Integer, Boolean>> getValue() {
		return value;
	}
	public void updateSucceedDrawB(Map.Entry<Boolean, Integer> succeedDrawB, List<Map.Entry<Integer, Boolean>> deck) {
		this.succeedDrawB = succeedDrawB;
		List<Map.Entry<Integer, Boolean>> temp_if0;
		if (succeedDrawB.getKey()) {
			this.value.add(0, new AbstractMap.SimpleEntry<>(deck.get(0).getKey(), false));
			this.value.sort(Comparator.comparing(Map.Entry<Integer, Boolean>::getKey));
			temp_if0 = 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_if0 = this.value;
		}
		value = temp_if0;
		this.loseB.updateHandsB(value);
	}
	public void updateSucceedSelectA(Map.Entry<Boolean, Map.Entry<Integer, Integer>> succeedSelectA) {
		this.succeedSelectA = succeedSelectA;
		List<Map.Entry<Integer, Boolean>> temp_if1;
		if (succeedSelectA.getKey()) {
			this.value.set(succeedSelectA.getValue().getKey(),new AbstractMap.SimpleEntry<>(this.value.get(succeedSelectA.getValue().getKey()).getKey(), true));
			temp_if1 = this.value;
		} else {
			temp_if1 = this.value;
		}
		value = temp_if1;
		this.loseB.updateHandsB(value);
	}
	public void updateSucceedDrawA(Map.Entry<Boolean, Integer> succeedDrawA, List deck) {
		this.succeedDrawA = succeedDrawA;
		List<Map.Entry<Integer, Boolean>> temp_if2;
		if (succeedDrawA.getKey()) {
			this.value.set(succeedDrawA.getValue(),new AbstractMap.SimpleEntry<>(this.value.get(succeedDrawA.getValue()).getKey(), true));
			temp_if2 = this.value;
		} else {
			temp_if2 = this.value;
		}
		value = temp_if2;
		this.loseB.updateHandsB(value);
	}
	public void updateSucceedSelectB(Map.Entry<Boolean, Map.Entry<Integer, Integer>> succeedSelectB) {
		this.succeedSelectB = succeedSelectB;
		List<Map.Entry<Integer, Boolean>> temp_if5;
		if (succeedSelectB.getKey()) {
			temp_if5 = this.value;
		} else {
			this.value.set(succeedSelectB.getValue().getKey(),new AbstractMap.SimpleEntry<>(this.value.get(succeedSelectB.getValue().getValue()).getKey(), true));
			temp_if5 = this.value;
		}
		value = temp_if5;
		this.loseB.updateHandsB(value);
	}
}