Ejemplo n.º 1
0
  /**
   * @param seenOffer
   * @param delta acceptable difference in percent
   * @return
   */
  public boolean sameAs(Offer seenOffer, double delta) {
    if (!(availabeItems.size() == seenOffer.availabeItems.size())) return false;

    for (OfferItem item : availabeItems) {
      OfferItem sameItem = seenOffer.findItem(item.getProductData().getProductId());
      if (sameItem == null) return false;
      if (!sameItem.sameAs(item, delta)) return false;
    }

    return true;
  }
Ejemplo n.º 2
0
 private OfferItem findItem(Id productId) {
   for (OfferItem item : availabeItems) {
     if (item.getProductData().getProductId().equals(productId)) return item;
   }
   return null;
 }