diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2013-01-03 08:10:25 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2013-01-03 08:10:25 +0000 |
commit | 2853156a2bce535bcaa440c37cf872916f76c03b (patch) | |
tree | 8e161033a9bac8274dcaca05940964b91cdb2bfc /sca-cpp/trunk/samples | |
parent | 55607ea78e10832838d52fdb17cbdfe4355c3265 (diff) |
Refactoring, rename isNil to isNull.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1428206 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/samples')
-rw-r--r-- | sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp | 10 | ||||
-rw-r--r-- | sca-cpp/trunk/samples/store-java/store/ShoppingCartImpl.java | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp b/sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp index e65aa0d392..46b032af94 100644 --- a/sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp +++ b/sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp @@ -45,7 +45,7 @@ const list<value> getcart(const value& id, const lvvlambda& cache) { cerr << "cart fvalue: " << fcart << "\n"; cerr << "cart content: " << content(fcart) << "\n"; cerr << "cart reason: " << reason(fcart) << "\n"; - if (isNil(cart)) + if (isNull(cart)) return value(nilListValue); return (list<value>)cart; } @@ -65,7 +65,7 @@ const failable<value> post(unused const list<value>& collection, const value& it * Find an item in the cart. */ const value find(const value& id, const list<value>& cart) { - if (isNil(cart)) + if (isNull(cart)) return mklist<value>(mklist<value>("entry", mklist<value>("title", string("Item")), mklist<value>("id", "0"))); if (id == cadr<value>(caddr<value>(car(cart)))) return mklist<value>(car(cart)); @@ -76,7 +76,7 @@ const value find(const value& id, const list<value>& cart) { * Return items from the cart. */ const failable<value> get(const list<value>& id, const lvvlambda& cache) { - if (isNil(id)) + if (isNull(id)) return value(mklist<value>(append(mklist<value>("feed", mklist<value>("title", string("Your Cart")), mklist<value>("id", cartId)), getcart(cartId, cache)))); return find(car(id), getcart(cartId, cache)); } @@ -85,7 +85,7 @@ const failable<value> get(const list<value>& id, const lvvlambda& cache) { * Delete items from the cart. */ const failable<value> del(const list<value>& id, unused const lvvlambda& cache) { - if (isNil(id)) + if (isNull(id)) return cache(mklist<value>("delete", mklist<value>(cartId))); return trueValue; } @@ -101,7 +101,7 @@ const double price(const list<value>& item) { * Sum the prices of a list of items. */ const double sum(const list<value>& items) { - if (isNil(items)) + if (isNull(items)) return 0; return price(car(items)) + sum(cdr(items)); } diff --git a/sca-cpp/trunk/samples/store-java/store/ShoppingCartImpl.java b/sca-cpp/trunk/samples/store-java/store/ShoppingCartImpl.java index bd7678cce7..b5329606d1 100644 --- a/sca-cpp/trunk/samples/store-java/store/ShoppingCartImpl.java +++ b/sca-cpp/trunk/samples/store-java/store/ShoppingCartImpl.java @@ -58,7 +58,7 @@ public class ShoppingCartImpl { * Find an item in the cart. */ Iterable<?> find(final String id, final Iterable<?> cart) { - if(isNil(cart)) + if(isNull(cart)) return list(list("'entry", list("'title", "Item"), list("'id", "0"))); if(id.equals(cadr(caddr(car(cart))))) return list(car(cart)); @@ -69,7 +69,7 @@ public class ShoppingCartImpl { * Return items from the cart. */ public Iterable<?> get(final Iterable<String> id, final Service cache) { - if(isNil(id)) + if(isNull(id)) return list(append(list("'feed", list("'title", "Your Cart"), list("'id", cartId)), this.getcart(cartId, cache))); return this.find((String)car(id), this.getcart(cartId, cache)); } @@ -78,7 +78,7 @@ public class ShoppingCartImpl { * Delete items from the cart. */ public Boolean delete(final Iterable<String> id, final Service cache) { - if(isNil(id)) { + if(isNull(id)) { final Iterable<String> iid = list(cartId); return cache.delete(iid); } @@ -97,7 +97,7 @@ public class ShoppingCartImpl { * Sum the prices of a list of items. */ Double sum(final Iterable<?> items) { - if(isNil(items)) + if(isNull(items)) return 0.0; return this.price((Iterable<?>)car(items)) + this.sum(cdr(items)); } |