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

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 void selectA(int guess, int attacker, List<Map.Entry<Integer, Boolean>> b, int target) {
		List<Map.Entry<Integer, Boolean>> temp_if6;
		if ((b.get(target).getKey()==guess)) {
			temp_if6 = this.value;
		} else {
			this.value.set(attacker,new AbstractMap.SimpleEntry<>(this.value.get(attacker).getKey(), true));
			temp_if6 = this.value;
		}
		this.value = temp_if6;
		this.loseA.updateHandsA(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_if5;
		if ((this.value.get(target).getKey()==guess)) {
			this.value.set(target,new AbstractMap.SimpleEntry<>(this.value.get(target).getKey(), true));
			temp_if5 = this.value;
		} else {
			temp_if5 = this.value;
		}
		this.value = temp_if5;
		this.loseA.updateHandsA(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_if7;
		if ((b.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_if7 = 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_if7 = this.value;
		}
		this.value = temp_if7;
		this.loseA.updateHandsA(value);
	}
	public void selectB(int guess, int attacker, List<Map.Entry<Integer, Boolean>> a, int target) {
		List<Map.Entry<Integer, Boolean>> temp_if4;
		if ((this.value.get(target).getKey()==guess)) {
			this.value.set(target,new AbstractMap.SimpleEntry<>(this.value.get(target).getKey(), true));
			temp_if4 = this.value;
		} else {
			temp_if4 = this.value;
		}
		this.value = temp_if4;
		this.loseA.updateHandsA(value);
	}
	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().getKey(),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);
	}
}