Ejemplo n.º 1
0
 /**
  * @param rh
  * @throws BankException
  */
 public void setRC(ResourceHand rh) throws BankException {
   brick.setQuantity(rh.getBrick());
   ore.setQuantity(rh.getOre());
   wheat.setQuantity(rh.getWheat());
   wood.setQuantity(rh.getWood());
   sheep.setQuantity(rh.getSheep());
 }
Ejemplo n.º 2
0
 /**
  * @param rh a ResourceHand object
  * @throws BankException
  * @pre all attributes of the rh are non negative and do not exceed limits
  * @post all resource attributes are increased by their corresponding rh attribute.
  */
 public void modifyRC(ResourceHand rh) throws BankException {
   brick.modify(rh.getBrick());
   wheat.modify(rh.getWheat());
   ore.modify(rh.getOre());
   wood.modify(rh.getWood());
   sheep.modify(rh.getSheep());
 }
Ejemplo n.º 3
0
 /**
  * @param rh
  * @return
  */
 public boolean hasRC(ResourceHand rh) {
   if (ore.getQuantity() < rh.getOre()) return false;
   if (wood.getQuantity() < rh.getWood()) return false;
   if (sheep.getQuantity() < rh.getSheep()) return false;
   if (wheat.getQuantity() < rh.getWheat()) return false;
   if (brick.getQuantity() < rh.getBrick()) return false;
   return true;
 }