DicePair.java
package edu.chl.hajo.monopoly.core;
/**
* Monopoly specific pair of dices
*
* @author hajo
*/
public class DicePair {
private final Dice first;
private final Dice second;
private boolean isEnabled = true;
public DicePair(Dice d1, Dice d2) {
this.first = d1;
this.second = d2;
}
public void roll() {
if (isEnabled) {
first.roll();
second.roll();
}
}
public int getFirst() {
return first.getLastResult();
}
public int getSecond() {
return second.getLastResult();
}
public int getTotal() {
return first.getLastResult() + second.getLastResult();
}
// TODO Needed?
public boolean areEqual() {
return first.getLastResult() == second.getLastResult();
}
public boolean bothAre(int value) {
return areEqual() && first.getLastResult() == value;
}
public void setEnabled(boolean b) {
isEnabled = b;
}
public boolean isEnabled() {
return isEnabled;
}
}