Esempio n. 1
0
 public Special addItemToSpecial(Special special, MenuItem item, double price)
     throws PizzaException {
   if ((special == null)
       || !(parentSystem.getPizzaStore().getSpecials().contains(special))
       || (item == null)
       || !(parentSystem.getPizzaStore().getMenu().getMenuItems().contains(item))
       || (price < 0)
       || ((Double) price == null)) {
     throw new PizzaException(
         "Incorrect parameter addItemToSpecial(<"
             + special.getSpecialName()
             + ">:Special, <"
             + item.getDesc()
             + ">:MenuItem, <"
             + price
             + ">:double)");
   } else {
     // Given good params and doesn't already have item
     if (special.getItem() == null) {
       item.setPrice(price);
       special.addItemToSpecial(item, price);
       return special;
     }
     // Given good params but already has item. Create new special, add
     // to specials
     else {
       Special temp = new Special(special.getSpecialName());
       temp.addItemToSpecial(item, price);
       parentSystem.getPizzaStore().getSpecials().add(temp);
       return temp;
     }
   }
 }
Esempio n. 2
0
 public Special addPizzaToSpecial(Special special, PizzaSize size, double price)
     throws PizzaException {
   if ((special == null)
       || !(parentSystem.getPizzaStore().getSpecials().contains(special))
       || (size == null)
       || !(parentSystem.getPizzaStore().getMenu().getPizzaSizes().contains(size))
       || (price < 0)
       || ((Double) price == null)) {
     throw new PizzaException(
         "Incorrect parameter addPizzaToSpecial(<"
             + special.getSpecialName()
             + ">:Special, <"
             + size.getDesc()
             + ">:PizzaSize, <"
             + price
             + ">:double)");
   } else {
     if (special.getSize() == null) {
       size.setPrice(price);
       special.addPizzaToSpecial(size, price);
       return special;
     } else {
       special.removePizzaSizeFromSpecial();
       special.addPizzaToSpecial(size, price);
       return special;
     }
   }
 }
Esempio n. 3
0
 public void removePizzaFromSpecial(Special special) throws PizzaException {
   if ((special == null) || !(parentSystem.getPizzaStore().getSpecials().contains(special))) {
     throw new PizzaException(
         "Incorrect parameter removePizzaFromSpecial(<" + special.getSpecialName() + ">:Special)");
   } else {
     special.removePizzaSizeFromSpecial();
   }
 }
Esempio n. 4
0
 public void modifySpecialPrice(Special special, double price) throws PizzaException {
   if (!(parentSystem.getPizzaStore().getSpecials().contains(special))
       || (special == null)
       || (special.getItem() == null)
       || (price < 0)
       || (Double) price == null) {
     throw new PizzaException(
         "Incorrect parameter removeItemFromSpecial(<" + special.getSpecialName() + ">:Special)");
   } else {
     special.setSpecialPrice(price);
   }
 }