コード例 #1
0
 private boolean isWithinPriceRange(Traveller traveller, Accommodation accommodation) {
   PriceRange priceRange = traveller.getPriceRange();
   int price = accommodation.getPrice();
   if (price >= priceRange.getMin() && price <= priceRange.getMax()) {
     return true;
   }
   return false;
 }
コード例 #2
0
 private boolean meetRequirements(Traveller traveller, Accommodation accommodation) {
   boolean requirementSatisfied = false;
   for (String requirement : traveller.getRequirements()) {
     if (accommodation.getAttributes().contains(requirement)) {
       requirementSatisfied = true;
     } else {
       return false;
     }
   }
   return requirementSatisfied;
 }