From 49b878b1b0f2e52bbd5282c22ac32a68e1e8736c Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Tue, 8 Mar 2011 08:18:07 +0000 Subject: Change ATOM and RSS feed representations to use name value pairs instead of just strings, to allow support for all ATOM and RSS attributes and avoid confusion with non-feed string results. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1079292 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/tuscany/IterableUtil.java | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'sca-cpp/trunk/modules/java/org/apache/tuscany/IterableUtil.java') diff --git a/sca-cpp/trunk/modules/java/org/apache/tuscany/IterableUtil.java b/sca-cpp/trunk/modules/java/org/apache/tuscany/IterableUtil.java index 6d559f370a..2366d79af6 100644 --- a/sca-cpp/trunk/modules/java/org/apache/tuscany/IterableUtil.java +++ b/sca-cpp/trunk/modules/java/org/apache/tuscany/IterableUtil.java @@ -116,6 +116,13 @@ public class IterableUtil { return cdr(cdr(l)); } + /** + * Return the cdr of the cdr of the cdr of a list. + */ + public static Iterable cdddr(final Object l) { + return cdr(cdr(cdr(l))); + } + /** * Return the car of the cdr of the cdr of a list. */ @@ -124,6 +131,24 @@ public class IterableUtil { return (T)car(cddr(l)); } + /** + * Return the car of the cdr of the cdr of the cdr of a list. + */ + @SuppressWarnings("unchecked") + public static T cadddr(final Object l) { + return (T)car(cdddr(l)); + } + + /** + * Appends a list and another list. + */ + @SuppressWarnings("unchecked") + public static Iterable append(final Object a, final Object b) { + if (isNil(a)) + return (Iterable)b; + return cons(car(a), append(cdr(a), b)); + } + /** * Return the first pair matching a key from a list of key value pairs. */ @@ -352,6 +377,11 @@ public class IterableUtil { assert car(al) == Integer.valueOf(1); assert cadr(al) == Integer.valueOf(2); assert caddr(al) == Integer.valueOf(3); + + final Iterable a = list(0, 1, 2); + final Iterable b = list(3, 4); + final Iterable ab = append(a, b); + assert ab.toString().equals("[0, 1, 2, 3, 4]"); return true; } } -- cgit v1.2.3