From commits-return-7723-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Tue Nov 27 14:59:23 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id D7114180791 for ; Tue, 27 Nov 2018 14:59:20 +0100 (CET) Received: (qmail 79345 invoked by uid 500); 27 Nov 2018 13:59:20 -0000 Mailing-List: contact commits-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list commits@groovy.apache.org Received: (qmail 79232 invoked by uid 99); 27 Nov 2018 13:59:19 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Nov 2018 13:59:19 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 409CCE1361; Tue, 27 Nov 2018 13:59:19 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sunlan@apache.org To: commits@groovy.apache.org Date: Tue, 27 Nov 2018 13:59:24 -0000 Message-Id: In-Reply-To: <5b7fa31672d348d4872068c7d1d9ebd2@git.apache.org> References: <5b7fa31672d348d4872068c7d1d9ebd2@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [6/8] groovy git commit: Move tuple improvements to its own project http://git-wip-us.apache.org/repos/asf/groovy/blob/892f67cd/src/main/groovy/groovy/lang/Tuple15.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple15.java b/src/main/groovy/groovy/lang/Tuple15.java index b995753..5589d77 100644 --- a/src/main/groovy/groovy/lang/Tuple15.java +++ b/src/main/groovy/groovy/lang/Tuple15.java @@ -20,9 +20,6 @@ package groovy.lang; -import groovy.util.function.Function1; -import groovy.util.function.Function15; - /** * Represents a list of 15 typed Objects. * @@ -130,491 +127,4 @@ public final class Tuple15 Tuple16 concat(T16 value) { - return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, value); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple15 concat(Tuple0 tuple) { - return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple16 concat(Tuple1 tuple) { - return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, tuple.getV1()); - } - - /** - * Split this tuple into two tuples of degree 0 and 15. - */ - public final Tuple2> split0() { - return new Tuple2<>(limit0(), skip0()); - } - - /** - * Split this tuple into two tuples of degree 1 and 14. - */ - public final Tuple2, Tuple14> split1() { - return new Tuple2<>(limit1(), skip1()); - } - - /** - * Split this tuple into two tuples of degree 2 and 13. - */ - public final Tuple2, Tuple13> split2() { - return new Tuple2<>(limit2(), skip2()); - } - - /** - * Split this tuple into two tuples of degree 3 and 12. - */ - public final Tuple2, Tuple12> split3() { - return new Tuple2<>(limit3(), skip3()); - } - - /** - * Split this tuple into two tuples of degree 4 and 11. - */ - public final Tuple2, Tuple11> split4() { - return new Tuple2<>(limit4(), skip4()); - } - - /** - * Split this tuple into two tuples of degree 5 and 10. - */ - public final Tuple2, Tuple10> split5() { - return new Tuple2<>(limit5(), skip5()); - } - - /** - * Split this tuple into two tuples of degree 6 and 9. - */ - public final Tuple2, Tuple9> split6() { - return new Tuple2<>(limit6(), skip6()); - } - - /** - * Split this tuple into two tuples of degree 7 and 8. - */ - public final Tuple2, Tuple8> split7() { - return new Tuple2<>(limit7(), skip7()); - } - - /** - * Split this tuple into two tuples of degree 8 and 7. - */ - public final Tuple2, Tuple7> split8() { - return new Tuple2<>(limit8(), skip8()); - } - - /** - * Split this tuple into two tuples of degree 9 and 6. - */ - public final Tuple2, Tuple6> split9() { - return new Tuple2<>(limit9(), skip9()); - } - - /** - * Split this tuple into two tuples of degree 10 and 5. - */ - public final Tuple2, Tuple5> split10() { - return new Tuple2<>(limit10(), skip10()); - } - - /** - * Split this tuple into two tuples of degree 11 and 4. - */ - public final Tuple2, Tuple4> split11() { - return new Tuple2<>(limit11(), skip11()); - } - - /** - * Split this tuple into two tuples of degree 12 and 3. - */ - public final Tuple2, Tuple3> split12() { - return new Tuple2<>(limit12(), skip12()); - } - - /** - * Split this tuple into two tuples of degree 13 and 2. - */ - public final Tuple2, Tuple2> split13() { - return new Tuple2<>(limit13(), skip13()); - } - - /** - * Split this tuple into two tuples of degree 14 and 1. - */ - public final Tuple2, Tuple1> split14() { - return new Tuple2<>(limit14(), skip14()); - } - - /** - * Split this tuple into two tuples of degree 15 and 0. - */ - public final Tuple2, Tuple0> split15() { - return new Tuple2<>(limit15(), skip15()); - } - - /** - * Limit this tuple to degree 0. - */ - public final Tuple0 limit0() { - return Tuple0.INSTANCE; - } - - /** - * Limit this tuple to degree 1. - */ - public final Tuple1 limit1() { - return new Tuple1<>(v1); - } - - /** - * Limit this tuple to degree 2. - */ - public final Tuple2 limit2() { - return new Tuple2<>(v1, v2); - } - - /** - * Limit this tuple to degree 3. - */ - public final Tuple3 limit3() { - return new Tuple3<>(v1, v2, v3); - } - - /** - * Limit this tuple to degree 4. - */ - public final Tuple4 limit4() { - return new Tuple4<>(v1, v2, v3, v4); - } - - /** - * Limit this tuple to degree 5. - */ - public final Tuple5 limit5() { - return new Tuple5<>(v1, v2, v3, v4, v5); - } - - /** - * Limit this tuple to degree 6. - */ - public final Tuple6 limit6() { - return new Tuple6<>(v1, v2, v3, v4, v5, v6); - } - - /** - * Limit this tuple to degree 7. - */ - public final Tuple7 limit7() { - return new Tuple7<>(v1, v2, v3, v4, v5, v6, v7); - } - - /** - * Limit this tuple to degree 8. - */ - public final Tuple8 limit8() { - return new Tuple8<>(v1, v2, v3, v4, v5, v6, v7, v8); - } - - /** - * Limit this tuple to degree 9. - */ - public final Tuple9 limit9() { - return new Tuple9<>(v1, v2, v3, v4, v5, v6, v7, v8, v9); - } - - /** - * Limit this tuple to degree 10. - */ - public final Tuple10 limit10() { - return new Tuple10<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10); - } - - /** - * Limit this tuple to degree 11. - */ - public final Tuple11 limit11() { - return new Tuple11<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11); - } - - /** - * Limit this tuple to degree 12. - */ - public final Tuple12 limit12() { - return new Tuple12<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12); - } - - /** - * Limit this tuple to degree 13. - */ - public final Tuple13 limit13() { - return new Tuple13<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13); - } - - /** - * Limit this tuple to degree 14. - */ - public final Tuple14 limit14() { - return new Tuple14<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14); - } - - /** - * Limit this tuple to degree 15. - */ - public final Tuple15 limit15() { - return this; - } - - /** - * Skip 0 degrees from this tuple. - */ - public final Tuple15 skip0() { - return this; - } - - /** - * Skip 1 degrees from this tuple. - */ - public final Tuple14 skip1() { - return new Tuple14<>(v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Skip 2 degrees from this tuple. - */ - public final Tuple13 skip2() { - return new Tuple13<>(v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Skip 3 degrees from this tuple. - */ - public final Tuple12 skip3() { - return new Tuple12<>(v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Skip 4 degrees from this tuple. - */ - public final Tuple11 skip4() { - return new Tuple11<>(v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Skip 5 degrees from this tuple. - */ - public final Tuple10 skip5() { - return new Tuple10<>(v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Skip 6 degrees from this tuple. - */ - public final Tuple9 skip6() { - return new Tuple9<>(v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Skip 7 degrees from this tuple. - */ - public final Tuple8 skip7() { - return new Tuple8<>(v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Skip 8 degrees from this tuple. - */ - public final Tuple7 skip8() { - return new Tuple7<>(v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Skip 9 degrees from this tuple. - */ - public final Tuple6 skip9() { - return new Tuple6<>(v10, v11, v12, v13, v14, v15); - } - - /** - * Skip 10 degrees from this tuple. - */ - public final Tuple5 skip10() { - return new Tuple5<>(v11, v12, v13, v14, v15); - } - - /** - * Skip 11 degrees from this tuple. - */ - public final Tuple4 skip11() { - return new Tuple4<>(v12, v13, v14, v15); - } - - /** - * Skip 12 degrees from this tuple. - */ - public final Tuple3 skip12() { - return new Tuple3<>(v13, v14, v15); - } - - /** - * Skip 13 degrees from this tuple. - */ - public final Tuple2 skip13() { - return new Tuple2<>(v14, v15); - } - - /** - * Skip 14 degrees from this tuple. - */ - public final Tuple1 skip14() { - return new Tuple1<>(v15); - } - - /** - * Skip 15 degrees from this tuple. - */ - public final Tuple0 skip15() { - return Tuple0.INSTANCE; - } - - /** - * Apply this tuple as arguments to a function. - */ - public final R map(Function15 function) { - return function.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Apply attribute 1 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple15 map1(Function1 function) { - return new Tuple15<>(function.apply(v1), v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Apply attribute 2 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple15 map2(Function1 function) { - return new Tuple15<>(v1, function.apply(v2), v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Apply attribute 3 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple15 map3(Function1 function) { - return new Tuple15<>(v1, v2, function.apply(v3), v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Apply attribute 4 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple15 map4(Function1 function) { - return new Tuple15<>(v1, v2, v3, function.apply(v4), v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Apply attribute 5 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple15 map5(Function1 function) { - return new Tuple15<>(v1, v2, v3, v4, function.apply(v5), v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Apply attribute 6 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple15 map6(Function1 function) { - return new Tuple15<>(v1, v2, v3, v4, v5, function.apply(v6), v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Apply attribute 7 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple15 map7(Function1 function) { - return new Tuple15<>(v1, v2, v3, v4, v5, v6, function.apply(v7), v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Apply attribute 8 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple15 map8(Function1 function) { - return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, function.apply(v8), v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Apply attribute 9 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple15 map9(Function1 function) { - return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, v8, function.apply(v9), v10, v11, v12, v13, v14, v15); - } - - /** - * Apply attribute 10 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple15 map10(Function1 function) { - return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, function.apply(v10), v11, v12, v13, v14, v15); - } - - /** - * Apply attribute 11 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple15 map11(Function1 function) { - return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, function.apply(v11), v12, v13, v14, v15); - } - - /** - * Apply attribute 12 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple15 map12(Function1 function) { - return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, function.apply(v12), v13, v14, v15); - } - - /** - * Apply attribute 13 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple15 map13(Function1 function) { - return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, function.apply(v13), v14, v15); - } - - /** - * Apply attribute 14 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple15 map14(Function1 function) { - return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, function.apply(v14), v15); - } - - /** - * Apply attribute 15 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple15 map15(Function1 function) { - return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, function.apply(v15)); - } - - /** - * Maps the attributes of this tuple using a mapper function. - */ - public final Tuple15 mapAll(Function15> function) { - return function.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Maps the attributes of this tuple using mapper functions. - */ - public final Tuple15 mapAll(Function1 function1, Function1 function2, Function1 function3, Function1 function4, Function1 function5, Function1 function6, Function1 function7, Function1 function8, Function1 function9, Function1 function10, Function1 function11, Function1 function12, Function1 function13, Function1 function14, Function1 function15) { - return new Tuple15<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4), function5.apply(v5), function6.apply(v6), function7.apply(v7), function8.apply(v8), function9.apply(v9), function10.apply(v10), function11.apply(v11), function12.apply(v12), function13.apply(v13), function14.apply(v14), function15.apply(v15)); - } - - @Override - public Tuple15 clone() { - return new Tuple15<>(this); - } } http://git-wip-us.apache.org/repos/asf/groovy/blob/892f67cd/src/main/groovy/groovy/lang/Tuple16.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple16.java b/src/main/groovy/groovy/lang/Tuple16.java index bcc8cc8..3cbecce 100644 --- a/src/main/groovy/groovy/lang/Tuple16.java +++ b/src/main/groovy/groovy/lang/Tuple16.java @@ -20,9 +20,6 @@ package groovy.lang; -import groovy.util.function.Function1; -import groovy.util.function.Function16; - /** * Represents a list of 16 typed Objects. * @@ -135,503 +132,4 @@ public final class Tuple16 concat(Tuple0 tuple) { - return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Split this tuple into two tuples of degree 0 and 16. - */ - public final Tuple2> split0() { - return new Tuple2<>(limit0(), skip0()); - } - - /** - * Split this tuple into two tuples of degree 1 and 15. - */ - public final Tuple2, Tuple15> split1() { - return new Tuple2<>(limit1(), skip1()); - } - - /** - * Split this tuple into two tuples of degree 2 and 14. - */ - public final Tuple2, Tuple14> split2() { - return new Tuple2<>(limit2(), skip2()); - } - - /** - * Split this tuple into two tuples of degree 3 and 13. - */ - public final Tuple2, Tuple13> split3() { - return new Tuple2<>(limit3(), skip3()); - } - - /** - * Split this tuple into two tuples of degree 4 and 12. - */ - public final Tuple2, Tuple12> split4() { - return new Tuple2<>(limit4(), skip4()); - } - - /** - * Split this tuple into two tuples of degree 5 and 11. - */ - public final Tuple2, Tuple11> split5() { - return new Tuple2<>(limit5(), skip5()); - } - - /** - * Split this tuple into two tuples of degree 6 and 10. - */ - public final Tuple2, Tuple10> split6() { - return new Tuple2<>(limit6(), skip6()); - } - - /** - * Split this tuple into two tuples of degree 7 and 9. - */ - public final Tuple2, Tuple9> split7() { - return new Tuple2<>(limit7(), skip7()); - } - - /** - * Split this tuple into two tuples of degree 8 and 8. - */ - public final Tuple2, Tuple8> split8() { - return new Tuple2<>(limit8(), skip8()); - } - - /** - * Split this tuple into two tuples of degree 9 and 7. - */ - public final Tuple2, Tuple7> split9() { - return new Tuple2<>(limit9(), skip9()); - } - - /** - * Split this tuple into two tuples of degree 10 and 6. - */ - public final Tuple2, Tuple6> split10() { - return new Tuple2<>(limit10(), skip10()); - } - - /** - * Split this tuple into two tuples of degree 11 and 5. - */ - public final Tuple2, Tuple5> split11() { - return new Tuple2<>(limit11(), skip11()); - } - - /** - * Split this tuple into two tuples of degree 12 and 4. - */ - public final Tuple2, Tuple4> split12() { - return new Tuple2<>(limit12(), skip12()); - } - - /** - * Split this tuple into two tuples of degree 13 and 3. - */ - public final Tuple2, Tuple3> split13() { - return new Tuple2<>(limit13(), skip13()); - } - - /** - * Split this tuple into two tuples of degree 14 and 2. - */ - public final Tuple2, Tuple2> split14() { - return new Tuple2<>(limit14(), skip14()); - } - - /** - * Split this tuple into two tuples of degree 15 and 1. - */ - public final Tuple2, Tuple1> split15() { - return new Tuple2<>(limit15(), skip15()); - } - - /** - * Split this tuple into two tuples of degree 16 and 0. - */ - public final Tuple2, Tuple0> split16() { - return new Tuple2<>(limit16(), skip16()); - } - - /** - * Limit this tuple to degree 0. - */ - public final Tuple0 limit0() { - return Tuple0.INSTANCE; - } - - /** - * Limit this tuple to degree 1. - */ - public final Tuple1 limit1() { - return new Tuple1<>(v1); - } - - /** - * Limit this tuple to degree 2. - */ - public final Tuple2 limit2() { - return new Tuple2<>(v1, v2); - } - - /** - * Limit this tuple to degree 3. - */ - public final Tuple3 limit3() { - return new Tuple3<>(v1, v2, v3); - } - - /** - * Limit this tuple to degree 4. - */ - public final Tuple4 limit4() { - return new Tuple4<>(v1, v2, v3, v4); - } - - /** - * Limit this tuple to degree 5. - */ - public final Tuple5 limit5() { - return new Tuple5<>(v1, v2, v3, v4, v5); - } - - /** - * Limit this tuple to degree 6. - */ - public final Tuple6 limit6() { - return new Tuple6<>(v1, v2, v3, v4, v5, v6); - } - - /** - * Limit this tuple to degree 7. - */ - public final Tuple7 limit7() { - return new Tuple7<>(v1, v2, v3, v4, v5, v6, v7); - } - - /** - * Limit this tuple to degree 8. - */ - public final Tuple8 limit8() { - return new Tuple8<>(v1, v2, v3, v4, v5, v6, v7, v8); - } - - /** - * Limit this tuple to degree 9. - */ - public final Tuple9 limit9() { - return new Tuple9<>(v1, v2, v3, v4, v5, v6, v7, v8, v9); - } - - /** - * Limit this tuple to degree 10. - */ - public final Tuple10 limit10() { - return new Tuple10<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10); - } - - /** - * Limit this tuple to degree 11. - */ - public final Tuple11 limit11() { - return new Tuple11<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11); - } - - /** - * Limit this tuple to degree 12. - */ - public final Tuple12 limit12() { - return new Tuple12<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12); - } - - /** - * Limit this tuple to degree 13. - */ - public final Tuple13 limit13() { - return new Tuple13<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13); - } - - /** - * Limit this tuple to degree 14. - */ - public final Tuple14 limit14() { - return new Tuple14<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14); - } - - /** - * Limit this tuple to degree 15. - */ - public final Tuple15 limit15() { - return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Limit this tuple to degree 16. - */ - public final Tuple16 limit16() { - return this; - } - - /** - * Skip 0 degrees from this tuple. - */ - public final Tuple16 skip0() { - return this; - } - - /** - * Skip 1 degrees from this tuple. - */ - public final Tuple15 skip1() { - return new Tuple15<>(v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Skip 2 degrees from this tuple. - */ - public final Tuple14 skip2() { - return new Tuple14<>(v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Skip 3 degrees from this tuple. - */ - public final Tuple13 skip3() { - return new Tuple13<>(v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Skip 4 degrees from this tuple. - */ - public final Tuple12 skip4() { - return new Tuple12<>(v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Skip 5 degrees from this tuple. - */ - public final Tuple11 skip5() { - return new Tuple11<>(v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Skip 6 degrees from this tuple. - */ - public final Tuple10 skip6() { - return new Tuple10<>(v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Skip 7 degrees from this tuple. - */ - public final Tuple9 skip7() { - return new Tuple9<>(v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Skip 8 degrees from this tuple. - */ - public final Tuple8 skip8() { - return new Tuple8<>(v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Skip 9 degrees from this tuple. - */ - public final Tuple7 skip9() { - return new Tuple7<>(v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Skip 10 degrees from this tuple. - */ - public final Tuple6 skip10() { - return new Tuple6<>(v11, v12, v13, v14, v15, v16); - } - - /** - * Skip 11 degrees from this tuple. - */ - public final Tuple5 skip11() { - return new Tuple5<>(v12, v13, v14, v15, v16); - } - - /** - * Skip 12 degrees from this tuple. - */ - public final Tuple4 skip12() { - return new Tuple4<>(v13, v14, v15, v16); - } - - /** - * Skip 13 degrees from this tuple. - */ - public final Tuple3 skip13() { - return new Tuple3<>(v14, v15, v16); - } - - /** - * Skip 14 degrees from this tuple. - */ - public final Tuple2 skip14() { - return new Tuple2<>(v15, v16); - } - - /** - * Skip 15 degrees from this tuple. - */ - public final Tuple1 skip15() { - return new Tuple1<>(v16); - } - - /** - * Skip 16 degrees from this tuple. - */ - public final Tuple0 skip16() { - return Tuple0.INSTANCE; - } - - /** - * Apply this tuple as arguments to a function. - */ - public final R map(Function16 function) { - return function.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Apply attribute 1 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple16 map1(Function1 function) { - return new Tuple16<>(function.apply(v1), v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Apply attribute 2 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple16 map2(Function1 function) { - return new Tuple16<>(v1, function.apply(v2), v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Apply attribute 3 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple16 map3(Function1 function) { - return new Tuple16<>(v1, v2, function.apply(v3), v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Apply attribute 4 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple16 map4(Function1 function) { - return new Tuple16<>(v1, v2, v3, function.apply(v4), v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Apply attribute 5 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple16 map5(Function1 function) { - return new Tuple16<>(v1, v2, v3, v4, function.apply(v5), v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Apply attribute 6 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple16 map6(Function1 function) { - return new Tuple16<>(v1, v2, v3, v4, v5, function.apply(v6), v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Apply attribute 7 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple16 map7(Function1 function) { - return new Tuple16<>(v1, v2, v3, v4, v5, v6, function.apply(v7), v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Apply attribute 8 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple16 map8(Function1 function) { - return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, function.apply(v8), v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Apply attribute 9 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple16 map9(Function1 function) { - return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, function.apply(v9), v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Apply attribute 10 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple16 map10(Function1 function) { - return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, function.apply(v10), v11, v12, v13, v14, v15, v16); - } - - /** - * Apply attribute 11 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple16 map11(Function1 function) { - return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, function.apply(v11), v12, v13, v14, v15, v16); - } - - /** - * Apply attribute 12 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple16 map12(Function1 function) { - return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, function.apply(v12), v13, v14, v15, v16); - } - - /** - * Apply attribute 13 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple16 map13(Function1 function) { - return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, function.apply(v13), v14, v15, v16); - } - - /** - * Apply attribute 14 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple16 map14(Function1 function) { - return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, function.apply(v14), v15, v16); - } - - /** - * Apply attribute 15 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple16 map15(Function1 function) { - return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, function.apply(v15), v16); - } - - /** - * Apply attribute 16 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple16 map16(Function1 function) { - return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, function.apply(v16)); - } - - /** - * Maps the attributes of this tuple using a mapper function. - */ - public final Tuple16 mapAll(Function16> function) { - return function.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Maps the attributes of this tuple using mapper functions. - */ - public final Tuple16 mapAll(Function1 function1, Function1 function2, Function1 function3, Function1 function4, Function1 function5, Function1 function6, Function1 function7, Function1 function8, Function1 function9, Function1 function10, Function1 function11, Function1 function12, Function1 function13, Function1 function14, Function1 function15, Function1 function16) { - return new Tuple16<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4), function5.apply(v5), function6.apply(v6), function7.apply(v7), function8.apply(v8), function9.apply(v9), function10.apply(v10), function11.apply(v11), function12.apply(v12), function13.apply(v13), function14.apply(v14), function15.apply(v15), function16.apply(v16)); - } - - @Override - public Tuple16 clone() { - return new Tuple16<>(this); - } } http://git-wip-us.apache.org/repos/asf/groovy/blob/892f67cd/src/main/groovy/groovy/lang/Tuple2.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple2.java b/src/main/groovy/groovy/lang/Tuple2.java index 3e48afc..e1e87e9 100644 --- a/src/main/groovy/groovy/lang/Tuple2.java +++ b/src/main/groovy/groovy/lang/Tuple2.java @@ -18,11 +18,6 @@ */ package groovy.lang; -import groovy.util.function.Function1; -import groovy.util.function.Function2; - -import java.util.Optional; - /** * Represents a list of 2 typed Objects. */ @@ -60,247 +55,4 @@ public final class Tuple2 extends Tuple { return v2; } - - /** - * Concatenate a value to this tuple. - */ - public final Tuple3 concat(T3 value) { - return new Tuple3<>(v1, v2, value); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple2 concat(Tuple0 tuple) { - return new Tuple2<>(v1, v2); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple3 concat(Tuple1 tuple) { - return new Tuple3<>(v1, v2, tuple.getV1()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple4 concat(Tuple2 tuple) { - return new Tuple4<>(v1, v2, tuple.getV1(), tuple.getV2()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple5 concat(Tuple3 tuple) { - return new Tuple5<>(v1, v2, tuple.getV1(), tuple.getV2(), tuple.getV3()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple6 concat(Tuple4 tuple) { - return new Tuple6<>(v1, v2, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple7 concat(Tuple5 tuple) { - return new Tuple7<>(v1, v2, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple8 concat(Tuple6 tuple) { - return new Tuple8<>(v1, v2, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple9 concat(Tuple7 tuple) { - return new Tuple9<>(v1, v2, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple10 concat(Tuple8 tuple) { - return new Tuple10<>(v1, v2, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple11 concat(Tuple9 tuple) { - return new Tuple11<>(v1, v2, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple12 concat(Tuple10 tuple) { - return new Tuple12<>(v1, v2, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9(), tuple.getV10()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple13 concat(Tuple11 tuple) { - return new Tuple13<>(v1, v2, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9(), tuple.getV10(), tuple.getV11()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple14 concat(Tuple12 tuple) { - return new Tuple14<>(v1, v2, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9(), tuple.getV10(), tuple.getV11(), tuple.getV12()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple15 concat(Tuple13 tuple) { - return new Tuple15<>(v1, v2, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9(), tuple.getV10(), tuple.getV11(), tuple.getV12(), tuple.getV13()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple16 concat(Tuple14 tuple) { - return new Tuple16<>(v1, v2, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9(), tuple.getV10(), tuple.getV11(), tuple.getV12(), tuple.getV13(), tuple.getV14()); - } - - /** - * Split this tuple into two tuples of degree 0 and 2. - */ - public final Tuple2> split0() { - return new Tuple2<>(limit0(), skip0()); - } - - /** - * Split this tuple into two tuples of degree 1 and 1. - */ - public final Tuple2, Tuple1> split1() { - return new Tuple2<>(limit1(), skip1()); - } - - /** - * Split this tuple into two tuples of degree 2 and 0. - */ - public final Tuple2, Tuple0> split2() { - return new Tuple2<>(limit2(), skip2()); - } - - /** - * Limit this tuple to degree 0. - */ - public final Tuple0 limit0() { - return Tuple0.INSTANCE; - } - - /** - * Limit this tuple to degree 1. - */ - public final Tuple1 limit1() { - return new Tuple1<>(v1); - } - - /** - * Limit this tuple to degree 2. - */ - public final Tuple2 limit2() { - return this; - } - - /** - * Skip 0 degrees from this tuple. - */ - public final Tuple2 skip0() { - return this; - } - - /** - * Skip 1 degrees from this tuple. - */ - public final Tuple1 skip1() { - return new Tuple1<>(v2); - } - - /** - * Skip 2 degrees from this tuple. - */ - public final Tuple0 skip2() { - return Tuple0.INSTANCE; - } - - /** - * Get a tuple with the two attributes swapped. - */ - public final Tuple2 swap() { - return new Tuple2<>(v2, v1); - } - - /** - * Whether two ranges represented by tuples overlap. - */ - public static final > boolean overlaps(Tuple2 left, Tuple2 right) { - return left.v1.compareTo(right.v2) <= 0 - && left.v2.compareTo(right.v1) >= 0; - } - - /** - * The intersection of two ranges represented by tuples - */ - public static final > Optional> intersect(Tuple2 left, Tuple2 right) { - if (overlaps(left, right)) - return Optional.of(new Tuple2<>( - left.v1.compareTo(right.v1) >= 0 ? left.v1 : right.v1, - left.v2.compareTo(right.v2) <= 0 ? left.v2 : right.v2 - )); - else - return Optional.empty(); - } - - /** - * Apply this tuple as arguments to a function. - */ - public final R map(Function2 function) { - return function.apply(v1, v2); - } - - /** - * Apply attribute 1 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple2 map1(Function1 function) { - return new Tuple2<>(function.apply(v1), v2); - } - - /** - * Apply attribute 2 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple2 map2(Function1 function) { - return new Tuple2<>(v1, function.apply(v2)); - } - - /** - * Maps the attributes of this tuple using a mapper function. - */ - public final Tuple2 mapAll(Function2> function) { - return function.apply(v1, v2); - } - - /** - * Maps the attributes of this tuple using mapper functions. - */ - public final Tuple2 mapAll(Function1 function1, Function1 function2) { - return new Tuple2<>(function1.apply(v1), function2.apply(v2)); - } - - @Override - public Tuple2 clone() { - return new Tuple2<>(this); - } } http://git-wip-us.apache.org/repos/asf/groovy/blob/892f67cd/src/main/groovy/groovy/lang/Tuple3.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple3.java b/src/main/groovy/groovy/lang/Tuple3.java index 6ce9b65..6e55651 100644 --- a/src/main/groovy/groovy/lang/Tuple3.java +++ b/src/main/groovy/groovy/lang/Tuple3.java @@ -19,9 +19,6 @@ package groovy.lang; -import groovy.util.function.Function1; -import groovy.util.function.Function3; - /** * Represents a list of 3 typed Objects. * @@ -72,240 +69,4 @@ public final class Tuple3 extends Tuple { return v3; } - /** - * Concatenate a value to this tuple. - */ - public final Tuple4 concat(T4 value) { - return new Tuple4<>(v1, v2, v3, value); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple3 concat(Tuple0 tuple) { - return new Tuple3<>(v1, v2, v3); - } - - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple4 concat(Tuple1 tuple) { - return new Tuple4<>(v1, v2, v3, tuple.getV1()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple5 concat(Tuple2 tuple) { - return new Tuple5<>(v1, v2, v3, tuple.getV1(), tuple.getV2()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple6 concat(Tuple3 tuple) { - return new Tuple6<>(v1, v2, v3, tuple.getV1(), tuple.getV2(), tuple.getV3()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple7 concat(Tuple4 tuple) { - return new Tuple7<>(v1, v2, v3, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple8 concat(Tuple5 tuple) { - return new Tuple8<>(v1, v2, v3, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple9 concat(Tuple6 tuple) { - return new Tuple9<>(v1, v2, v3, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple10 concat(Tuple7 tuple) { - return new Tuple10<>(v1, v2, v3, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple11 concat(Tuple8 tuple) { - return new Tuple11<>(v1, v2, v3, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple12 concat(Tuple9 tuple) { - return new Tuple12<>(v1, v2, v3, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple13 concat(Tuple10 tuple) { - return new Tuple13<>(v1, v2, v3, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9(), tuple.getV10()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple14 concat(Tuple11 tuple) { - return new Tuple14<>(v1, v2, v3, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9(), tuple.getV10(), tuple.getV11()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple15 concat(Tuple12 tuple) { - return new Tuple15<>(v1, v2, v3, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9(), tuple.getV10(), tuple.getV11(), tuple.getV12()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple16 concat(Tuple13 tuple) { - return new Tuple16<>(v1, v2, v3, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9(), tuple.getV10(), tuple.getV11(), tuple.getV12(), tuple.getV13()); - } - - /** - * Split this tuple into two tuples of degree 0 and 3. - */ - public final Tuple2> split0() { - return new Tuple2<>(limit0(), skip0()); - } - - /** - * Split this tuple into two tuples of degree 1 and 2. - */ - public final Tuple2, Tuple2> split1() { - return new Tuple2<>(limit1(), skip1()); - } - - /** - * Split this tuple into two tuples of degree 2 and 1. - */ - public final Tuple2, Tuple1> split2() { - return new Tuple2<>(limit2(), skip2()); - } - - /** - * Split this tuple into two tuples of degree 3 and 0. - */ - public final Tuple2, Tuple0> split3() { - return new Tuple2<>(limit3(), skip3()); - } - - /** - * Limit this tuple to degree 0. - */ - public final Tuple0 limit0() { - return Tuple0.INSTANCE; - } - - /** - * Limit this tuple to degree 1. - */ - public final Tuple1 limit1() { - return new Tuple1<>(v1); - } - - /** - * Limit this tuple to degree 2. - */ - public final Tuple2 limit2() { - return new Tuple2<>(v1, v2); - } - - /** - * Limit this tuple to degree 3. - */ - public final Tuple3 limit3() { - return this; - } - - /** - * Skip 0 degrees from this tuple. - */ - public final Tuple3 skip0() { - return this; - } - - /** - * Skip 1 degrees from this tuple. - */ - public final Tuple2 skip1() { - return new Tuple2<>(v2, v3); - } - - /** - * Skip 2 degrees from this tuple. - */ - public final Tuple1 skip2() { - return new Tuple1<>(v3); - } - - /** - * Skip 3 degrees from this tuple. - */ - public final Tuple0 skip3() { - return Tuple0.INSTANCE; - } - - /** - * Apply this tuple as arguments to a function. - */ - public final R map(Function3 function) { - return function.apply(v1, v2, v3); - } - - /** - * Apply attribute 1 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple3 map1(Function1 function) { - return new Tuple3<>(function.apply(v1), v2, v3); - } - - /** - * Apply attribute 2 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple3 map2(Function1 function) { - return new Tuple3<>(v1, function.apply(v2), v3); - } - - /** - * Apply attribute 3 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple3 map3(Function1 function) { - return new Tuple3<>(v1, v2, function.apply(v3)); - } - - /** - * Maps the attributes of this tuple using a mapper function. - */ - public final Tuple3 mapAll(Function3> function) { - return function.apply(v1, v2, v3); - } - - /** - * Maps the attributes of this tuple using mapper functions. - */ - public final Tuple3 mapAll(Function1 function1, Function1 function2, Function1 function3) { - return new Tuple3<>(function1.apply(v1), function2.apply(v2), function3.apply(v3)); - } - - @Override - public Tuple3 clone() { - return new Tuple3<>(this); - } } http://git-wip-us.apache.org/repos/asf/groovy/blob/892f67cd/src/main/groovy/groovy/lang/Tuple4.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple4.java b/src/main/groovy/groovy/lang/Tuple4.java index ce26f00..8c564b7 100644 --- a/src/main/groovy/groovy/lang/Tuple4.java +++ b/src/main/groovy/groovy/lang/Tuple4.java @@ -19,9 +19,6 @@ package groovy.lang; -import groovy.util.function.Function1; -import groovy.util.function.Function4; - /** * Represents a list of 4 typed Objects. * @@ -83,262 +80,4 @@ public final class Tuple4 extends Tuple { return v4; } - - /** - * Concatenate a value to this tuple. - */ - public final Tuple5 concat(T5 value) { - return new Tuple5<>(v1, v2, v3, v4, value); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple4 concat(Tuple0 tuple) { - return new Tuple4<>(v1, v2, v3, v4); - } - - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple5 concat(Tuple1 tuple) { - return new Tuple5<>(v1, v2, v3, v4, tuple.getV1()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple6 concat(Tuple2 tuple) { - return new Tuple6<>(v1, v2, v3, v4, tuple.getV1(), tuple.getV2()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple7 concat(Tuple3 tuple) { - return new Tuple7<>(v1, v2, v3, v4, tuple.getV1(), tuple.getV2(), tuple.getV3()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple8 concat(Tuple4 tuple) { - return new Tuple8<>(v1, v2, v3, v4, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple9 concat(Tuple5 tuple) { - return new Tuple9<>(v1, v2, v3, v4, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple10 concat(Tuple6 tuple) { - return new Tuple10<>(v1, v2, v3, v4, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple11 concat(Tuple7 tuple) { - return new Tuple11<>(v1, v2, v3, v4, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple12 concat(Tuple8 tuple) { - return new Tuple12<>(v1, v2, v3, v4, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple13 concat(Tuple9 tuple) { - return new Tuple13<>(v1, v2, v3, v4, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple14 concat(Tuple10 tuple) { - return new Tuple14<>(v1, v2, v3, v4, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9(), tuple.getV10()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple15 concat(Tuple11 tuple) { - return new Tuple15<>(v1, v2, v3, v4, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9(), tuple.getV10(), tuple.getV11()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple16 concat(Tuple12 tuple) { - return new Tuple16<>(v1, v2, v3, v4, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9(), tuple.getV10(), tuple.getV11(), tuple.getV12()); - } - - /** - * Split this tuple into two tuples of degree 0 and 4. - */ - public final Tuple2> split0() { - return new Tuple2<>(limit0(), skip0()); - } - - /** - * Split this tuple into two tuples of degree 1 and 3. - */ - public final Tuple2, Tuple3> split1() { - return new Tuple2<>(limit1(), skip1()); - } - - /** - * Split this tuple into two tuples of degree 2 and 2. - */ - public final Tuple2, Tuple2> split2() { - return new Tuple2<>(limit2(), skip2()); - } - - /** - * Split this tuple into two tuples of degree 3 and 1. - */ - public final Tuple2, Tuple1> split3() { - return new Tuple2<>(limit3(), skip3()); - } - - /** - * Split this tuple into two tuples of degree 4 and 0. - */ - public final Tuple2, Tuple0> split4() { - return new Tuple2<>(limit4(), skip4()); - } - - /** - * Limit this tuple to degree 0. - */ - public final Tuple0 limit0() { - return Tuple0.INSTANCE; - } - - /** - * Limit this tuple to degree 1. - */ - public final Tuple1 limit1() { - return new Tuple1<>(v1); - } - - /** - * Limit this tuple to degree 2. - */ - public final Tuple2 limit2() { - return new Tuple2<>(v1, v2); - } - - /** - * Limit this tuple to degree 3. - */ - public final Tuple3 limit3() { - return new Tuple3<>(v1, v2, v3); - } - - /** - * Limit this tuple to degree 4. - */ - public final Tuple4 limit4() { - return this; - } - - /** - * Skip 0 degrees from this tuple. - */ - public final Tuple4 skip0() { - return this; - } - - /** - * Skip 1 degrees from this tuple. - */ - public final Tuple3 skip1() { - return new Tuple3<>(v2, v3, v4); - } - - /** - * Skip 2 degrees from this tuple. - */ - public final Tuple2 skip2() { - return new Tuple2<>(v3, v4); - } - - /** - * Skip 3 degrees from this tuple. - */ - public final Tuple1 skip3() { - return new Tuple1<>(v4); - } - - /** - * Skip 4 degrees from this tuple. - */ - public final Tuple0 skip4() { - return Tuple0.INSTANCE; - } - - /** - * Apply this tuple as arguments to a function. - */ - public final R map(Function4 function) { - return function.apply(v1, v2, v3, v4); - } - - /** - * Apply attribute 1 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple4 map1(Function1 function) { - return new Tuple4<>(function.apply(v1), v2, v3, v4); - } - - /** - * Apply attribute 2 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple4 map2(Function1 function) { - return new Tuple4<>(v1, function.apply(v2), v3, v4); - } - - /** - * Apply attribute 3 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple4 map3(Function1 function) { - return new Tuple4<>(v1, v2, function.apply(v3), v4); - } - - /** - * Apply attribute 4 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple4 map4(Function1 function) { - return new Tuple4<>(v1, v2, v3, function.apply(v4)); - } - - /** - * Maps the attributes of this tuple using a mapper function. - */ - public final Tuple4 mapAll(Function4> function) { - return function.apply(v1, v2, v3, v4); - } - - /** - * Maps the attributes of this tuple using mapper functions. - */ - public final Tuple4 mapAll(Function1 function1, Function1 function2, Function1 function3, Function1 function4) { - return new Tuple4<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4)); - } - - @Override - public Tuple4 clone() { - return new Tuple4<>(this); - } } http://git-wip-us.apache.org/repos/asf/groovy/blob/892f67cd/src/main/groovy/groovy/lang/Tuple5.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple5.java b/src/main/groovy/groovy/lang/Tuple5.java index 74067bd..b4e9cc6 100644 --- a/src/main/groovy/groovy/lang/Tuple5.java +++ b/src/main/groovy/groovy/lang/Tuple5.java @@ -19,9 +19,6 @@ package groovy.lang; -import groovy.util.function.Function1; -import groovy.util.function.Function5; - /** * Represents a list of 5 typed Objects. * @@ -94,283 +91,4 @@ public final class Tuple5 extends Tuple { return v5; } - - /** - * Concatenate a value to this tuple. - */ - public final Tuple6 concat(T6 value) { - return new Tuple6<>(v1, v2, v3, v4, v5, value); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple5 concat(Tuple0 tuple) { - return new Tuple5<>(v1, v2, v3, v4, v5); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple6 concat(Tuple1 tuple) { - return new Tuple6<>(v1, v2, v3, v4, v5, tuple.getV1()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple7 concat(Tuple2 tuple) { - return new Tuple7<>(v1, v2, v3, v4, v5, tuple.getV1(), tuple.getV2()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple8 concat(Tuple3 tuple) { - return new Tuple8<>(v1, v2, v3, v4, v5, tuple.getV1(), tuple.getV2(), tuple.getV3()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple9 concat(Tuple4 tuple) { - return new Tuple9<>(v1, v2, v3, v4, v5, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple10 concat(Tuple5 tuple) { - return new Tuple10<>(v1, v2, v3, v4, v5, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple11 concat(Tuple6 tuple) { - return new Tuple11<>(v1, v2, v3, v4, v5, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple12 concat(Tuple7 tuple) { - return new Tuple12<>(v1, v2, v3, v4, v5, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple13 concat(Tuple8 tuple) { - return new Tuple13<>(v1, v2, v3, v4, v5, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple14 concat(Tuple9 tuple) { - return new Tuple14<>(v1, v2, v3, v4, v5, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple15 concat(Tuple10 tuple) { - return new Tuple15<>(v1, v2, v3, v4, v5, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9(), tuple.getV10()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple16 concat(Tuple11 tuple) { - return new Tuple16<>(v1, v2, v3, v4, v5, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5(), tuple.getV6(), tuple.getV7(), tuple.getV8(), tuple.getV9(), tuple.getV10(), tuple.getV11()); - } - - /** - * Split this tuple into two tuples of degree 0 and 5. - */ - public final Tuple2> split0() { - return new Tuple2<>(limit0(), skip0()); - } - - /** - * Split this tuple into two tuples of degree 1 and 4. - */ - public final Tuple2, Tuple4> split1() { - return new Tuple2<>(limit1(), skip1()); - } - - /** - * Split this tuple into two tuples of degree 2 and 3. - */ - public final Tuple2, Tuple3> split2() { - return new Tuple2<>(limit2(), skip2()); - } - - /** - * Split this tuple into two tuples of degree 3 and 2. - */ - public final Tuple2, Tuple2> split3() { - return new Tuple2<>(limit3(), skip3()); - } - - /** - * Split this tuple into two tuples of degree 4 and 1. - */ - public final Tuple2, Tuple1> split4() { - return new Tuple2<>(limit4(), skip4()); - } - - /** - * Split this tuple into two tuples of degree 5 and 0. - */ - public final Tuple2, Tuple0> split5() { - return new Tuple2<>(limit5(), skip5()); - } - - /** - * Limit this tuple to degree 0. - */ - public final Tuple0 limit0() { - return Tuple0.INSTANCE; - } - - /** - * Limit this tuple to degree 1. - */ - public final Tuple1 limit1() { - return new Tuple1<>(v1); - } - - /** - * Limit this tuple to degree 2. - */ - public final Tuple2 limit2() { - return new Tuple2<>(v1, v2); - } - - /** - * Limit this tuple to degree 3. - */ - public final Tuple3 limit3() { - return new Tuple3<>(v1, v2, v3); - } - - /** - * Limit this tuple to degree 4. - */ - public final Tuple4 limit4() { - return new Tuple4<>(v1, v2, v3, v4); - } - - /** - * Limit this tuple to degree 5. - */ - public final Tuple5 limit5() { - return this; - } - - /** - * Skip 0 degrees from this tuple. - */ - public final Tuple5 skip0() { - return this; - } - - /** - * Skip 1 degrees from this tuple. - */ - public final Tuple4 skip1() { - return new Tuple4<>(v2, v3, v4, v5); - } - - /** - * Skip 2 degrees from this tuple. - */ - public final Tuple3 skip2() { - return new Tuple3<>(v3, v4, v5); - } - - /** - * Skip 3 degrees from this tuple. - */ - public final Tuple2 skip3() { - return new Tuple2<>(v4, v5); - } - - /** - * Skip 4 degrees from this tuple. - */ - public final Tuple1 skip4() { - return new Tuple1<>(v5); - } - - /** - * Skip 5 degrees from this tuple. - */ - public final Tuple0 skip5() { - return Tuple0.INSTANCE; - } - - /** - * Apply this tuple as arguments to a function. - */ - public final R map(Function5 function) { - return function.apply(v1, v2, v3, v4, v5); - } - - /** - * Apply attribute 1 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple5 map1(Function1 function) { - return new Tuple5<>(function.apply(v1), v2, v3, v4, v5); - } - - /** - * Apply attribute 2 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple5 map2(Function1 function) { - return new Tuple5<>(v1, function.apply(v2), v3, v4, v5); - } - - /** - * Apply attribute 3 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple5 map3(Function1 function) { - return new Tuple5<>(v1, v2, function.apply(v3), v4, v5); - } - - /** - * Apply attribute 4 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple5 map4(Function1 function) { - return new Tuple5<>(v1, v2, v3, function.apply(v4), v5); - } - - /** - * Apply attribute 5 as argument to a function and return a new tuple with the substituted argument. - */ - public final Tuple5 map5(Function1 function) { - return new Tuple5<>(v1, v2, v3, v4, function.apply(v5)); - } - - /** - * Maps the attributes of this tuple using a mapper function. - */ - public final Tuple5 mapAll(Function5> function) { - return function.apply(v1, v2, v3, v4, v5); - } - - /** - * Maps the attributes of this tuple using mapper functions. - */ - public final Tuple5 mapAll(Function1 function1, Function1 function2, Function1 function3, Function1 function4, Function1 function5) { - return new Tuple5<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4), function5.apply(v5)); - } - - - @Override - public Tuple5 clone() { - return new Tuple5<>(this); - } }