package jp.co.jid.exBasic;

public class Marriage {
	/** 結婚可能年齢：男 */
	private static final int MAN_MARRIAGABLE_AGE = 18;
	/** 結婚可能年齢：女 */
	private static final int WOMAN_MARRIAGABLE_AGE = 16;

	public boolean checkMarriage(Human human) {
		if (human.getSex().isMan() && human.getAge() >= MAN_MARRIAGABLE_AGE) {
			return true;
		} else if (human.getSex().isWoman() && human.getAge() >= WOMAN_MARRIAGABLE_AGE) {
			return true;
		} else {
			return false;
		}
	}

	public boolean checkMarriage(Human human1, Human human2) {
		if (human1.getSex().getSex() != human2.getSex().getSex()) {
			return false;
		}
		if (!checkMarriage(human1)) {
			return false;
		}
		if (!checkMarriage(human2)) {
			return false;
		}
		return true;
	}
}
