1 20 21 26 package golfShop.business.cart; 27 28 import java.lang.Cloneable ; 29 import golfShop.business.item.*; 30 import golfShop.spec.cart.*; 31 32 import golfShop.business.item.*; 33 34 public class CartItemPairImpl implements CartItemPair,java.io.Serializable { 35 private CartItem item; 36 private int quantity; 37 38 protected CartItemPairImpl(CartItem item, int quantity) { 40 this.item = item; 41 this.quantity = quantity; 42 } 43 44 public CartItem getItem() { 45 return item; 46 } 47 48 public int getQuantity() { 49 return quantity; 50 } 51 52 protected void setQuantity(int quantity) { 54 this.quantity = quantity; 55 } 56 57 protected void addToQuantity(int more) { 59 this.quantity += more; 60 } 61 62 protected CartItemPairImpl copy() { 65 return new CartItemPairImpl(this.item, this.quantity); 66 } 67 68 71 public String toString() { 72 return item.toString() + "(" + quantity + ")"; 73 } 74 } 75 76 | Popular Tags |