From cfe7224d4385196244c556167c84c5593bddf252 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 15 Sep 2015 15:25:32 +0200 Subject: [PATCH] =?utf8?q?Continued:=20-=20added=20checkout=20wrapper=20cl?= =?utf8?q?ass=20and=20interface=20-=20added=20method=20clear()=20for=20cle?= =?utf8?q?aring=20the=20basket=20Signed-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../jshopcore/model/basket/BaseBasket.java | 6 ++ .../jshopcore/model/basket/Basket.java | 5 ++ .../jshopcore/wrapper/CheckoutWrapper.java | 66 +++++++++++++++++++ .../jshopcore/wrapper/WrapableCheckout.java | 55 ++++++++++++++++ 4 files changed, 132 insertions(+) create mode 100644 src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java create mode 100644 src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java diff --git a/src/org/mxchange/jshopcore/model/basket/BaseBasket.java b/src/org/mxchange/jshopcore/model/basket/BaseBasket.java index 06755b1..def5926 100644 --- a/src/org/mxchange/jshopcore/model/basket/BaseBasket.java +++ b/src/org/mxchange/jshopcore/model/basket/BaseBasket.java @@ -130,4 +130,10 @@ public abstract class BaseBasket implements Basket< // Return it return isAdded; } + + @Override + public void clear () { + // Deligate to deque + this.deque.clear(); + } } diff --git a/src/org/mxchange/jshopcore/model/basket/Basket.java b/src/org/mxchange/jshopcore/model/basket/Basket.java index f0824bb..ea7e899 100644 --- a/src/org/mxchange/jshopcore/model/basket/Basket.java +++ b/src/org/mxchange/jshopcore/model/basket/Basket.java @@ -36,6 +36,11 @@ public interface Basket extends Serializable { */ public void addItem (final T item) throws BasketItemAlreadyAddedException; + /** + * Clears the basket instance + */ + public void clear (); + /** * Checks whether the given item has already been added by checking the * item's id. diff --git a/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java b/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java new file mode 100644 index 0000000..2ee6882 --- /dev/null +++ b/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jshopcore.wrapper; + +import java.util.List; +import org.mxchange.jshopcore.model.basket.AddableBasketItem; +import org.mxchange.jshopcore.model.customer.Customer; + +/** + * A wrapper for checkouts (customer, ordered items) + * + * @author Roland Haeder + */ +public class CheckoutWrapper implements WrapableCheckout { + /** + * Serial number + */ + private static final long serialVersionUID = 94_358_758_475_481_781L; + + /** + * Customer instance + */ + private Customer customer; + + /** + * List instance + */ + private List list; + + /** + * Default constructor + */ + public CheckoutWrapper () { + } + + public Customer getCustomer () { + return this.customer; + } + + public void setCustomer (final Customer customer) { + this.customer = customer; + } + + public List getList () { + return this.list; + } + + public void setList (final List list) { + this.list = list; + } + +} diff --git a/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java b/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java new file mode 100644 index 0000000..7d5d9db --- /dev/null +++ b/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jshopcore.wrapper; + +import java.io.Serializable; +import java.util.List; +import org.mxchange.jshopcore.model.basket.AddableBasketItem; +import org.mxchange.jshopcore.model.customer.Customer; + +/** + * An interface for checkout wrapper + * + * @author Roland Haeder + */ +public interface WrapableCheckout extends Serializable { + + /** + * Getter for customer instance + * + * @return Customer indstance + */ + public Customer getCustomer (); + + /** + * Setter for customer instance + * @param customer Customer instance + */ + public void setCustomer (final Customer customer); + + /** + * Getter for a List of AddableBasktem instances + * @return List with AddableBasketItem instances + */ + public List getList (); + + /** + * Setter for a List of AddableBasktem instances + * @param list List with AddableBasketItem instances + */ + public void setList (final List list); +} -- 2.39.5