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<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T1 return v15; } - /** - * Concatenate a value to this tuple. - */ - public final <T16> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> 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<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> 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 <T16> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> concat(Tuple1<T16> 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<Tuple0, Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>> split0() { - return new Tuple2<>(limit0(), skip0()); - } - - /** - * Split this tuple into two tuples of degree 1 and 14. - */ - public final Tuple2<Tuple1<T1>, Tuple14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>> split1() { - return new Tuple2<>(limit1(), skip1()); - } - - /** - * Split this tuple into two tuples of degree 2 and 13. - */ - public final Tuple2<Tuple2<T1, T2>, Tuple13<T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>> split2() { - return new Tuple2<>(limit2(), skip2()); - } - - /** - * Split this tuple into two tuples of degree 3 and 12. - */ - public final Tuple2<Tuple3<T1, T2, T3>, Tuple12<T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>> split3() { - return new Tuple2<>(limit3(), skip3()); - } - - /** - * Split this tuple into two tuples of degree 4 and 11. - */ - public final Tuple2<Tuple4<T1, T2, T3, T4>, Tuple11<T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>> split4() { - return new Tuple2<>(limit4(), skip4()); - } - - /** - * Split this tuple into two tuples of degree 5 and 10. - */ - public final Tuple2<Tuple5<T1, T2, T3, T4, T5>, Tuple10<T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>> split5() { - return new Tuple2<>(limit5(), skip5()); - } - - /** - * Split this tuple into two tuples of degree 6 and 9. - */ - public final Tuple2<Tuple6<T1, T2, T3, T4, T5, T6>, Tuple9<T7, T8, T9, T10, T11, T12, T13, T14, T15>> split6() { - return new Tuple2<>(limit6(), skip6()); - } - - /** - * Split this tuple into two tuples of degree 7 and 8. - */ - public final Tuple2<Tuple7<T1, T2, T3, T4, T5, T6, T7>, Tuple8<T8, T9, T10, T11, T12, T13, T14, T15>> split7() { - return new Tuple2<>(limit7(), skip7()); - } - - /** - * Split this tuple into two tuples of degree 8 and 7. - */ - public final Tuple2<Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>, Tuple7<T9, T10, T11, T12, T13, T14, T15>> split8() { - return new Tuple2<>(limit8(), skip8()); - } - - /** - * Split this tuple into two tuples of degree 9 and 6. - */ - public final Tuple2<Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9>, Tuple6<T10, T11, T12, T13, T14, T15>> split9() { - return new Tuple2<>(limit9(), skip9()); - } - - /** - * Split this tuple into two tuples of degree 10 and 5. - */ - public final Tuple2<Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, Tuple5<T11, T12, T13, T14, T15>> split10() { - return new Tuple2<>(limit10(), skip10()); - } - - /** - * Split this tuple into two tuples of degree 11 and 4. - */ - public final Tuple2<Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, Tuple4<T12, T13, T14, T15>> split11() { - return new Tuple2<>(limit11(), skip11()); - } - - /** - * Split this tuple into two tuples of degree 12 and 3. - */ - public final Tuple2<Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, Tuple3<T13, T14, T15>> split12() { - return new Tuple2<>(limit12(), skip12()); - } - - /** - * Split this tuple into two tuples of degree 13 and 2. - */ - public final Tuple2<Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, Tuple2<T14, T15>> split13() { - return new Tuple2<>(limit13(), skip13()); - } - - /** - * Split this tuple into two tuples of degree 14 and 1. - */ - public final Tuple2<Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, Tuple1<T15>> split14() { - return new Tuple2<>(limit14(), skip14()); - } - - /** - * Split this tuple into two tuples of degree 15 and 0. - */ - public final Tuple2<Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, 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<T1> limit1() { - return new Tuple1<>(v1); - } - - /** - * Limit this tuple to degree 2. - */ - public final Tuple2<T1, T2> limit2() { - return new Tuple2<>(v1, v2); - } - - /** - * Limit this tuple to degree 3. - */ - public final Tuple3<T1, T2, T3> limit3() { - return new Tuple3<>(v1, v2, v3); - } - - /** - * Limit this tuple to degree 4. - */ - public final Tuple4<T1, T2, T3, T4> limit4() { - return new Tuple4<>(v1, v2, v3, v4); - } - - /** - * Limit this tuple to degree 5. - */ - public final Tuple5<T1, T2, T3, T4, T5> limit5() { - return new Tuple5<>(v1, v2, v3, v4, v5); - } - - /** - * Limit this tuple to degree 6. - */ - public final Tuple6<T1, T2, T3, T4, T5, T6> limit6() { - return new Tuple6<>(v1, v2, v3, v4, v5, v6); - } - - /** - * Limit this tuple to degree 7. - */ - public final Tuple7<T1, T2, T3, T4, T5, T6, T7> limit7() { - return new Tuple7<>(v1, v2, v3, v4, v5, v6, v7); - } - - /** - * Limit this tuple to degree 8. - */ - public final Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> limit8() { - return new Tuple8<>(v1, v2, v3, v4, v5, v6, v7, v8); - } - - /** - * Limit this tuple to degree 9. - */ - public final Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> limit9() { - return new Tuple9<>(v1, v2, v3, v4, v5, v6, v7, v8, v9); - } - - /** - * Limit this tuple to degree 10. - */ - public final Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> limit10() { - return new Tuple10<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10); - } - - /** - * Limit this tuple to degree 11. - */ - public final Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> limit11() { - return new Tuple11<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11); - } - - /** - * Limit this tuple to degree 12. - */ - public final Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> 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<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> 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<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> 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<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> limit15() { - return this; - } - - /** - * Skip 0 degrees from this tuple. - */ - public final Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> skip0() { - return this; - } - - /** - * Skip 1 degrees from this tuple. - */ - public final Tuple14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> 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<T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> 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<T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> 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<T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> skip4() { - return new Tuple11<>(v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Skip 5 degrees from this tuple. - */ - public final Tuple10<T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> skip5() { - return new Tuple10<>(v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Skip 6 degrees from this tuple. - */ - public final Tuple9<T7, T8, T9, T10, T11, T12, T13, T14, T15> skip6() { - return new Tuple9<>(v7, v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Skip 7 degrees from this tuple. - */ - public final Tuple8<T8, T9, T10, T11, T12, T13, T14, T15> skip7() { - return new Tuple8<>(v8, v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Skip 8 degrees from this tuple. - */ - public final Tuple7<T9, T10, T11, T12, T13, T14, T15> skip8() { - return new Tuple7<>(v9, v10, v11, v12, v13, v14, v15); - } - - /** - * Skip 9 degrees from this tuple. - */ - public final Tuple6<T10, T11, T12, T13, T14, T15> skip9() { - return new Tuple6<>(v10, v11, v12, v13, v14, v15); - } - - /** - * Skip 10 degrees from this tuple. - */ - public final Tuple5<T11, T12, T13, T14, T15> skip10() { - return new Tuple5<>(v11, v12, v13, v14, v15); - } - - /** - * Skip 11 degrees from this tuple. - */ - public final Tuple4<T12, T13, T14, T15> skip11() { - return new Tuple4<>(v12, v13, v14, v15); - } - - /** - * Skip 12 degrees from this tuple. - */ - public final Tuple3<T13, T14, T15> skip12() { - return new Tuple3<>(v13, v14, v15); - } - - /** - * Skip 13 degrees from this tuple. - */ - public final Tuple2<T14, T15> skip13() { - return new Tuple2<>(v14, v15); - } - - /** - * Skip 14 degrees from this tuple. - */ - public final Tuple1<T15> 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> R map(Function15<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? super T10, ? super T11, ? super T12, ? super T13, ? super T14, ? super T15, ? extends R> 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 <U1> Tuple15<U1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> map1(Function1<? super T1, ? extends U1> 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 <U2> Tuple15<T1, U2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> map2(Function1<? super T2, ? extends U2> 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 <U3> Tuple15<T1, T2, U3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> map3(Function1<? super T3, ? extends U3> 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 <U4> Tuple15<T1, T2, T3, U4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> map4(Function1<? super T4, ? extends U4> 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 <U5> Tuple15<T1, T2, T3, T4, U5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> map5(Function1<? super T5, ? extends U5> 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 <U6> Tuple15<T1, T2, T3, T4, T5, U6, T7, T8, T9, T10, T11, T12, T13, T14, T15> map6(Function1<? super T6, ? extends U6> 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 <U7> Tuple15<T1, T2, T3, T4, T5, T6, U7, T8, T9, T10, T11, T12, T13, T14, T15> map7(Function1<? super T7, ? extends U7> 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 <U8> Tuple15<T1, T2, T3, T4, T5, T6, T7, U8, T9, T10, T11, T12, T13, T14, T15> map8(Function1<? super T8, ? extends U8> 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 <U9> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, U9, T10, T11, T12, T13, T14, T15> map9(Function1<? super T9, ? extends U9> 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 <U10> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, U10, T11, T12, T13, T14, T15> map10(Function1<? super T10, ? extends U10> 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 <U11> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, U11, T12, T13, T14, T15> map11(Function1<? super T11, ? extends U11> 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 <U12> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, U12, T13, T14, T15> map12(Function1<? super T12, ? extends U12> 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 <U13> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, U13, T14, T15> map13(Function1<? super T13, ? extends U13> 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 <U14> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, U14, T15> map14(Function1<? super T14, ? extends U14> 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 <U15> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, U15> map15(Function1<? super T15, ? extends U15> 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 <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15> Tuple15<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15> mapAll(Function15<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? super T10, ? super T11, ? super T12, ? super T13, ? super T14, ? super T15, Tuple15<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15>> 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 <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15> Tuple15<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3, Function1<? super T4, ? extends U4> function4, Function1<? super T5, ? extends U5> function5, Function1<? super T6, ? extends U6> function6, Function1<? super T7, ? extends U7> function7, Function1<? super T8, ? extends U8> function8, Function1<? super T9, ? extends U9> function9, Function1<? super T10, ? extends U10> function10, Function1<? super T11, ? extends U11> function11, Function1<? super T12, ? extends U12> function12, Function1<? super T13, ? extends U13> function13, Function1<? super T14, ? extends U14> function14, Function1<? super T15, ? extends U15> 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<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> 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<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T1 public T16 getV16() { return v16; } - - public final Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> 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<Tuple0, Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>> split0() { - return new Tuple2<>(limit0(), skip0()); - } - - /** - * Split this tuple into two tuples of degree 1 and 15. - */ - public final Tuple2<Tuple1<T1>, Tuple15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>> split1() { - return new Tuple2<>(limit1(), skip1()); - } - - /** - * Split this tuple into two tuples of degree 2 and 14. - */ - public final Tuple2<Tuple2<T1, T2>, Tuple14<T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>> split2() { - return new Tuple2<>(limit2(), skip2()); - } - - /** - * Split this tuple into two tuples of degree 3 and 13. - */ - public final Tuple2<Tuple3<T1, T2, T3>, Tuple13<T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>> split3() { - return new Tuple2<>(limit3(), skip3()); - } - - /** - * Split this tuple into two tuples of degree 4 and 12. - */ - public final Tuple2<Tuple4<T1, T2, T3, T4>, Tuple12<T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>> split4() { - return new Tuple2<>(limit4(), skip4()); - } - - /** - * Split this tuple into two tuples of degree 5 and 11. - */ - public final Tuple2<Tuple5<T1, T2, T3, T4, T5>, Tuple11<T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>> split5() { - return new Tuple2<>(limit5(), skip5()); - } - - /** - * Split this tuple into two tuples of degree 6 and 10. - */ - public final Tuple2<Tuple6<T1, T2, T3, T4, T5, T6>, Tuple10<T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>> split6() { - return new Tuple2<>(limit6(), skip6()); - } - - /** - * Split this tuple into two tuples of degree 7 and 9. - */ - public final Tuple2<Tuple7<T1, T2, T3, T4, T5, T6, T7>, Tuple9<T8, T9, T10, T11, T12, T13, T14, T15, T16>> split7() { - return new Tuple2<>(limit7(), skip7()); - } - - /** - * Split this tuple into two tuples of degree 8 and 8. - */ - public final Tuple2<Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>, Tuple8<T9, T10, T11, T12, T13, T14, T15, T16>> split8() { - return new Tuple2<>(limit8(), skip8()); - } - - /** - * Split this tuple into two tuples of degree 9 and 7. - */ - public final Tuple2<Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9>, Tuple7<T10, T11, T12, T13, T14, T15, T16>> split9() { - return new Tuple2<>(limit9(), skip9()); - } - - /** - * Split this tuple into two tuples of degree 10 and 6. - */ - public final Tuple2<Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, Tuple6<T11, T12, T13, T14, T15, T16>> split10() { - return new Tuple2<>(limit10(), skip10()); - } - - /** - * Split this tuple into two tuples of degree 11 and 5. - */ - public final Tuple2<Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, Tuple5<T12, T13, T14, T15, T16>> split11() { - return new Tuple2<>(limit11(), skip11()); - } - - /** - * Split this tuple into two tuples of degree 12 and 4. - */ - public final Tuple2<Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, Tuple4<T13, T14, T15, T16>> split12() { - return new Tuple2<>(limit12(), skip12()); - } - - /** - * Split this tuple into two tuples of degree 13 and 3. - */ - public final Tuple2<Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, Tuple3<T14, T15, T16>> split13() { - return new Tuple2<>(limit13(), skip13()); - } - - /** - * Split this tuple into two tuples of degree 14 and 2. - */ - public final Tuple2<Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, Tuple2<T15, T16>> split14() { - return new Tuple2<>(limit14(), skip14()); - } - - /** - * Split this tuple into two tuples of degree 15 and 1. - */ - public final Tuple2<Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, Tuple1<T16>> split15() { - return new Tuple2<>(limit15(), skip15()); - } - - /** - * Split this tuple into two tuples of degree 16 and 0. - */ - public final Tuple2<Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>, 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<T1> limit1() { - return new Tuple1<>(v1); - } - - /** - * Limit this tuple to degree 2. - */ - public final Tuple2<T1, T2> limit2() { - return new Tuple2<>(v1, v2); - } - - /** - * Limit this tuple to degree 3. - */ - public final Tuple3<T1, T2, T3> limit3() { - return new Tuple3<>(v1, v2, v3); - } - - /** - * Limit this tuple to degree 4. - */ - public final Tuple4<T1, T2, T3, T4> limit4() { - return new Tuple4<>(v1, v2, v3, v4); - } - - /** - * Limit this tuple to degree 5. - */ - public final Tuple5<T1, T2, T3, T4, T5> limit5() { - return new Tuple5<>(v1, v2, v3, v4, v5); - } - - /** - * Limit this tuple to degree 6. - */ - public final Tuple6<T1, T2, T3, T4, T5, T6> limit6() { - return new Tuple6<>(v1, v2, v3, v4, v5, v6); - } - - /** - * Limit this tuple to degree 7. - */ - public final Tuple7<T1, T2, T3, T4, T5, T6, T7> limit7() { - return new Tuple7<>(v1, v2, v3, v4, v5, v6, v7); - } - - /** - * Limit this tuple to degree 8. - */ - public final Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> limit8() { - return new Tuple8<>(v1, v2, v3, v4, v5, v6, v7, v8); - } - - /** - * Limit this tuple to degree 9. - */ - public final Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> limit9() { - return new Tuple9<>(v1, v2, v3, v4, v5, v6, v7, v8, v9); - } - - /** - * Limit this tuple to degree 10. - */ - public final Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> limit10() { - return new Tuple10<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10); - } - - /** - * Limit this tuple to degree 11. - */ - public final Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> limit11() { - return new Tuple11<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11); - } - - /** - * Limit this tuple to degree 12. - */ - public final Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> 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<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> 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<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> 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<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> 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<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> limit16() { - return this; - } - - /** - * Skip 0 degrees from this tuple. - */ - public final Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> skip0() { - return this; - } - - /** - * Skip 1 degrees from this tuple. - */ - public final Tuple15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> 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<T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> 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<T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> 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<T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> 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<T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> skip5() { - return new Tuple11<>(v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Skip 6 degrees from this tuple. - */ - public final Tuple10<T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> skip6() { - return new Tuple10<>(v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Skip 7 degrees from this tuple. - */ - public final Tuple9<T8, T9, T10, T11, T12, T13, T14, T15, T16> skip7() { - return new Tuple9<>(v8, v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Skip 8 degrees from this tuple. - */ - public final Tuple8<T9, T10, T11, T12, T13, T14, T15, T16> skip8() { - return new Tuple8<>(v9, v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Skip 9 degrees from this tuple. - */ - public final Tuple7<T10, T11, T12, T13, T14, T15, T16> skip9() { - return new Tuple7<>(v10, v11, v12, v13, v14, v15, v16); - } - - /** - * Skip 10 degrees from this tuple. - */ - public final Tuple6<T11, T12, T13, T14, T15, T16> skip10() { - return new Tuple6<>(v11, v12, v13, v14, v15, v16); - } - - /** - * Skip 11 degrees from this tuple. - */ - public final Tuple5<T12, T13, T14, T15, T16> skip11() { - return new Tuple5<>(v12, v13, v14, v15, v16); - } - - /** - * Skip 12 degrees from this tuple. - */ - public final Tuple4<T13, T14, T15, T16> skip12() { - return new Tuple4<>(v13, v14, v15, v16); - } - - /** - * Skip 13 degrees from this tuple. - */ - public final Tuple3<T14, T15, T16> skip13() { - return new Tuple3<>(v14, v15, v16); - } - - /** - * Skip 14 degrees from this tuple. - */ - public final Tuple2<T15, T16> skip14() { - return new Tuple2<>(v15, v16); - } - - /** - * Skip 15 degrees from this tuple. - */ - public final Tuple1<T16> 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> R map(Function16<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? super T10, ? super T11, ? super T12, ? super T13, ? super T14, ? super T15, ? super T16, ? extends R> 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 <U1> Tuple16<U1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> map1(Function1<? super T1, ? extends U1> 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 <U2> Tuple16<T1, U2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> map2(Function1<? super T2, ? extends U2> 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 <U3> Tuple16<T1, T2, U3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> map3(Function1<? super T3, ? extends U3> 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 <U4> Tuple16<T1, T2, T3, U4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> map4(Function1<? super T4, ? extends U4> 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 <U5> Tuple16<T1, T2, T3, T4, U5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> map5(Function1<? super T5, ? extends U5> 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 <U6> Tuple16<T1, T2, T3, T4, T5, U6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> map6(Function1<? super T6, ? extends U6> 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 <U7> Tuple16<T1, T2, T3, T4, T5, T6, U7, T8, T9, T10, T11, T12, T13, T14, T15, T16> map7(Function1<? super T7, ? extends U7> 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 <U8> Tuple16<T1, T2, T3, T4, T5, T6, T7, U8, T9, T10, T11, T12, T13, T14, T15, T16> map8(Function1<? super T8, ? extends U8> 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 <U9> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, U9, T10, T11, T12, T13, T14, T15, T16> map9(Function1<? super T9, ? extends U9> 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 <U10> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, U10, T11, T12, T13, T14, T15, T16> map10(Function1<? super T10, ? extends U10> 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 <U11> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, U11, T12, T13, T14, T15, T16> map11(Function1<? super T11, ? extends U11> 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 <U12> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, U12, T13, T14, T15, T16> map12(Function1<? super T12, ? extends U12> 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 <U13> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, U13, T14, T15, T16> map13(Function1<? super T13, ? extends U13> 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 <U14> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, U14, T15, T16> map14(Function1<? super T14, ? extends U14> 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 <U15> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, U15, T16> map15(Function1<? super T15, ? extends U15> 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 <U16> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, U16> map16(Function1<? super T16, ? extends U16> 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 <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16> Tuple16<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16> mapAll(Function16<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? super T10, ? super T11, ? super T12, ? super T13, ? super T14, ? super T15, ? super T16, Tuple16<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16>> 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 <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16> Tuple16<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3, Function1<? super T4, ? extends U4> function4, Function1<? super T5, ? extends U5> function5, Function1<? super T6, ? extends U6> function6, Function1<? super T7, ? extends U7> function7, Function1<? super T8, ? extends U8> function8, Function1<? super T9, ? extends U9> function9, Function1<? super T10, ? extends U10> function10, Function1<? super T11, ? extends U11> function11, Function1<? super T12, ? extends U12> function12, Function1<? super T13, ? extends U13> function13, Function1<? super T14, ? extends U14> function14, Function1<? super T15, ? extends U15> function15, Function1<? super T16, ? extends U16> 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<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> 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<T1, T2> extends Tuple { return v2; } - - /** - * Concatenate a value to this tuple. - */ - public final <T3> Tuple3<T1, T2, T3> concat(T3 value) { - return new Tuple3<>(v1, v2, value); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple2<T1, T2> concat(Tuple0 tuple) { - return new Tuple2<>(v1, v2); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T3> Tuple3<T1, T2, T3> concat(Tuple1<T3> tuple) { - return new Tuple3<>(v1, v2, tuple.getV1()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T3, T4> Tuple4<T1, T2, T3, T4> concat(Tuple2<T3, T4> tuple) { - return new Tuple4<>(v1, v2, tuple.getV1(), tuple.getV2()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T3, T4, T5> Tuple5<T1, T2, T3, T4, T5> concat(Tuple3<T3, T4, T5> tuple) { - return new Tuple5<>(v1, v2, tuple.getV1(), tuple.getV2(), tuple.getV3()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T3, T4, T5, T6> Tuple6<T1, T2, T3, T4, T5, T6> concat(Tuple4<T3, T4, T5, T6> tuple) { - return new Tuple6<>(v1, v2, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T3, T4, T5, T6, T7> Tuple7<T1, T2, T3, T4, T5, T6, T7> concat(Tuple5<T3, T4, T5, T6, T7> tuple) { - return new Tuple7<>(v1, v2, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4(), tuple.getV5()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T3, T4, T5, T6, T7, T8> Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> concat(Tuple6<T3, T4, T5, T6, T7, T8> 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 <T3, T4, T5, T6, T7, T8, T9> Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> concat(Tuple7<T3, T4, T5, T6, T7, T8, T9> 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 <T3, T4, T5, T6, T7, T8, T9, T10> Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> concat(Tuple8<T3, T4, T5, T6, T7, T8, T9, T10> 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 <T3, T4, T5, T6, T7, T8, T9, T10, T11> Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> concat(Tuple9<T3, T4, T5, T6, T7, T8, T9, T10, T11> 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 <T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> concat(Tuple10<T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> 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 <T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> concat(Tuple11<T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> 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 <T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> concat(Tuple12<T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> 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 <T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> concat(Tuple13<T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> 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 <T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> concat(Tuple14<T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> 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<Tuple0, Tuple2<T1, T2>> split0() { - return new Tuple2<>(limit0(), skip0()); - } - - /** - * Split this tuple into two tuples of degree 1 and 1. - */ - public final Tuple2<Tuple1<T1>, Tuple1<T2>> split1() { - return new Tuple2<>(limit1(), skip1()); - } - - /** - * Split this tuple into two tuples of degree 2 and 0. - */ - public final Tuple2<Tuple2<T1, T2>, 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<T1> limit1() { - return new Tuple1<>(v1); - } - - /** - * Limit this tuple to degree 2. - */ - public final Tuple2<T1, T2> limit2() { - return this; - } - - /** - * Skip 0 degrees from this tuple. - */ - public final Tuple2<T1, T2> skip0() { - return this; - } - - /** - * Skip 1 degrees from this tuple. - */ - public final Tuple1<T2> 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<T2, T1> swap() { - return new Tuple2<>(v2, v1); - } - - /** - * Whether two ranges represented by tuples overlap. - */ - public static final <T extends Comparable<? super T>> boolean overlaps(Tuple2<T, T> left, Tuple2<T, T> 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 <T extends Comparable<? super T>> Optional<Tuple2<T, T>> intersect(Tuple2<T, T> left, Tuple2<T, T> 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> R map(Function2<? super T1, ? super T2, ? extends R> 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 <U1> Tuple2<U1, T2> map1(Function1<? super T1, ? extends U1> 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 <U2> Tuple2<T1, U2> map2(Function1<? super T2, ? extends U2> function) { - return new Tuple2<>(v1, function.apply(v2)); - } - - /** - * Maps the attributes of this tuple using a mapper function. - */ - public final <U1, U2> Tuple2<U1, U2> mapAll(Function2<? super T1, ? super T2, Tuple2<U1, U2>> function) { - return function.apply(v1, v2); - } - - /** - * Maps the attributes of this tuple using mapper functions. - */ - public final <U1, U2> Tuple2<U1, U2> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2) { - return new Tuple2<>(function1.apply(v1), function2.apply(v2)); - } - - @Override - public Tuple2<T1, T2> 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<T1, T2, T3> extends Tuple { return v3; } - /** - * Concatenate a value to this tuple. - */ - public final <T4> Tuple4<T1, T2, T3, T4> concat(T4 value) { - return new Tuple4<>(v1, v2, v3, value); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple3<T1, T2, T3> concat(Tuple0 tuple) { - return new Tuple3<>(v1, v2, v3); - } - - - /** - * Concatenate a tuple to this tuple. - */ - public final <T4> Tuple4<T1, T2, T3, T4> concat(Tuple1<T4> tuple) { - return new Tuple4<>(v1, v2, v3, tuple.getV1()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T4, T5> Tuple5<T1, T2, T3, T4, T5> concat(Tuple2<T4, T5> tuple) { - return new Tuple5<>(v1, v2, v3, tuple.getV1(), tuple.getV2()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T4, T5, T6> Tuple6<T1, T2, T3, T4, T5, T6> concat(Tuple3<T4, T5, T6> tuple) { - return new Tuple6<>(v1, v2, v3, tuple.getV1(), tuple.getV2(), tuple.getV3()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T4, T5, T6, T7> Tuple7<T1, T2, T3, T4, T5, T6, T7> concat(Tuple4<T4, T5, T6, T7> tuple) { - return new Tuple7<>(v1, v2, v3, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T4, T5, T6, T7, T8> Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> concat(Tuple5<T4, T5, T6, T7, T8> 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 <T4, T5, T6, T7, T8, T9> Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> concat(Tuple6<T4, T5, T6, T7, T8, T9> 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 <T4, T5, T6, T7, T8, T9, T10> Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> concat(Tuple7<T4, T5, T6, T7, T8, T9, T10> 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 <T4, T5, T6, T7, T8, T9, T10, T11> Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> concat(Tuple8<T4, T5, T6, T7, T8, T9, T10, T11> 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 <T4, T5, T6, T7, T8, T9, T10, T11, T12> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> concat(Tuple9<T4, T5, T6, T7, T8, T9, T10, T11, T12> 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 <T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> concat(Tuple10<T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> 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 <T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> concat(Tuple11<T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> 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 <T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> concat(Tuple12<T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> 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 <T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> concat(Tuple13<T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> 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<Tuple0, Tuple3<T1, T2, T3>> split0() { - return new Tuple2<>(limit0(), skip0()); - } - - /** - * Split this tuple into two tuples of degree 1 and 2. - */ - public final Tuple2<Tuple1<T1>, Tuple2<T2, T3>> split1() { - return new Tuple2<>(limit1(), skip1()); - } - - /** - * Split this tuple into two tuples of degree 2 and 1. - */ - public final Tuple2<Tuple2<T1, T2>, Tuple1<T3>> split2() { - return new Tuple2<>(limit2(), skip2()); - } - - /** - * Split this tuple into two tuples of degree 3 and 0. - */ - public final Tuple2<Tuple3<T1, T2, T3>, 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<T1> limit1() { - return new Tuple1<>(v1); - } - - /** - * Limit this tuple to degree 2. - */ - public final Tuple2<T1, T2> limit2() { - return new Tuple2<>(v1, v2); - } - - /** - * Limit this tuple to degree 3. - */ - public final Tuple3<T1, T2, T3> limit3() { - return this; - } - - /** - * Skip 0 degrees from this tuple. - */ - public final Tuple3<T1, T2, T3> skip0() { - return this; - } - - /** - * Skip 1 degrees from this tuple. - */ - public final Tuple2<T2, T3> skip1() { - return new Tuple2<>(v2, v3); - } - - /** - * Skip 2 degrees from this tuple. - */ - public final Tuple1<T3> 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> R map(Function3<? super T1, ? super T2, ? super T3, ? extends R> 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 <U1> Tuple3<U1, T2, T3> map1(Function1<? super T1, ? extends U1> 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 <U2> Tuple3<T1, U2, T3> map2(Function1<? super T2, ? extends U2> 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 <U3> Tuple3<T1, T2, U3> map3(Function1<? super T3, ? extends U3> function) { - return new Tuple3<>(v1, v2, function.apply(v3)); - } - - /** - * Maps the attributes of this tuple using a mapper function. - */ - public final <U1, U2, U3> Tuple3<U1, U2, U3> mapAll(Function3<? super T1, ? super T2, ? super T3, Tuple3<U1, U2, U3>> function) { - return function.apply(v1, v2, v3); - } - - /** - * Maps the attributes of this tuple using mapper functions. - */ - public final <U1, U2, U3> Tuple3<U1, U2, U3> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3) { - return new Tuple3<>(function1.apply(v1), function2.apply(v2), function3.apply(v3)); - } - - @Override - public Tuple3<T1, T2, T3> 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<T1, T2, T3, T4> extends Tuple { return v4; } - - /** - * Concatenate a value to this tuple. - */ - public final <T5> Tuple5<T1, T2, T3, T4, T5> concat(T5 value) { - return new Tuple5<>(v1, v2, v3, v4, value); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple4<T1, T2, T3, T4> concat(Tuple0 tuple) { - return new Tuple4<>(v1, v2, v3, v4); - } - - - /** - * Concatenate a tuple to this tuple. - */ - public final <T5> Tuple5<T1, T2, T3, T4, T5> concat(Tuple1<T5> tuple) { - return new Tuple5<>(v1, v2, v3, v4, tuple.getV1()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T5, T6> Tuple6<T1, T2, T3, T4, T5, T6> concat(Tuple2<T5, T6> tuple) { - return new Tuple6<>(v1, v2, v3, v4, tuple.getV1(), tuple.getV2()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T5, T6, T7> Tuple7<T1, T2, T3, T4, T5, T6, T7> concat(Tuple3<T5, T6, T7> tuple) { - return new Tuple7<>(v1, v2, v3, v4, tuple.getV1(), tuple.getV2(), tuple.getV3()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T5, T6, T7, T8> Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> concat(Tuple4<T5, T6, T7, T8> tuple) { - return new Tuple8<>(v1, v2, v3, v4, tuple.getV1(), tuple.getV2(), tuple.getV3(), tuple.getV4()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T5, T6, T7, T8, T9> Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> concat(Tuple5<T5, T6, T7, T8, T9> 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 <T5, T6, T7, T8, T9, T10> Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> concat(Tuple6<T5, T6, T7, T8, T9, T10> 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 <T5, T6, T7, T8, T9, T10, T11> Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> concat(Tuple7<T5, T6, T7, T8, T9, T10, T11> 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 <T5, T6, T7, T8, T9, T10, T11, T12> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> concat(Tuple8<T5, T6, T7, T8, T9, T10, T11, T12> 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 <T5, T6, T7, T8, T9, T10, T11, T12, T13> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> concat(Tuple9<T5, T6, T7, T8, T9, T10, T11, T12, T13> 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 <T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> concat(Tuple10<T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> 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 <T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> concat(Tuple11<T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> 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 <T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> concat(Tuple12<T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> 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<Tuple0, Tuple4<T1, T2, T3, T4>> split0() { - return new Tuple2<>(limit0(), skip0()); - } - - /** - * Split this tuple into two tuples of degree 1 and 3. - */ - public final Tuple2<Tuple1<T1>, Tuple3<T2, T3, T4>> split1() { - return new Tuple2<>(limit1(), skip1()); - } - - /** - * Split this tuple into two tuples of degree 2 and 2. - */ - public final Tuple2<Tuple2<T1, T2>, Tuple2<T3, T4>> split2() { - return new Tuple2<>(limit2(), skip2()); - } - - /** - * Split this tuple into two tuples of degree 3 and 1. - */ - public final Tuple2<Tuple3<T1, T2, T3>, Tuple1<T4>> split3() { - return new Tuple2<>(limit3(), skip3()); - } - - /** - * Split this tuple into two tuples of degree 4 and 0. - */ - public final Tuple2<Tuple4<T1, T2, T3, T4>, 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<T1> limit1() { - return new Tuple1<>(v1); - } - - /** - * Limit this tuple to degree 2. - */ - public final Tuple2<T1, T2> limit2() { - return new Tuple2<>(v1, v2); - } - - /** - * Limit this tuple to degree 3. - */ - public final Tuple3<T1, T2, T3> limit3() { - return new Tuple3<>(v1, v2, v3); - } - - /** - * Limit this tuple to degree 4. - */ - public final Tuple4<T1, T2, T3, T4> limit4() { - return this; - } - - /** - * Skip 0 degrees from this tuple. - */ - public final Tuple4<T1, T2, T3, T4> skip0() { - return this; - } - - /** - * Skip 1 degrees from this tuple. - */ - public final Tuple3<T2, T3, T4> skip1() { - return new Tuple3<>(v2, v3, v4); - } - - /** - * Skip 2 degrees from this tuple. - */ - public final Tuple2<T3, T4> skip2() { - return new Tuple2<>(v3, v4); - } - - /** - * Skip 3 degrees from this tuple. - */ - public final Tuple1<T4> 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> R map(Function4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> 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 <U1> Tuple4<U1, T2, T3, T4> map1(Function1<? super T1, ? extends U1> 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 <U2> Tuple4<T1, U2, T3, T4> map2(Function1<? super T2, ? extends U2> 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 <U3> Tuple4<T1, T2, U3, T4> map3(Function1<? super T3, ? extends U3> 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 <U4> Tuple4<T1, T2, T3, U4> map4(Function1<? super T4, ? extends U4> function) { - return new Tuple4<>(v1, v2, v3, function.apply(v4)); - } - - /** - * Maps the attributes of this tuple using a mapper function. - */ - public final <U1, U2, U3, U4> Tuple4<U1, U2, U3, U4> mapAll(Function4<? super T1, ? super T2, ? super T3, ? super T4, Tuple4<U1, U2, U3, U4>> function) { - return function.apply(v1, v2, v3, v4); - } - - /** - * Maps the attributes of this tuple using mapper functions. - */ - public final <U1, U2, U3, U4> Tuple4<U1, U2, U3, U4> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3, Function1<? super T4, ? extends U4> function4) { - return new Tuple4<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4)); - } - - @Override - public Tuple4<T1, T2, T3, T4> 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<T1, T2, T3, T4, T5> extends Tuple { return v5; } - - /** - * Concatenate a value to this tuple. - */ - public final <T6> Tuple6<T1, T2, T3, T4, T5, T6> concat(T6 value) { - return new Tuple6<>(v1, v2, v3, v4, v5, value); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final Tuple5<T1, T2, T3, T4, T5> concat(Tuple0 tuple) { - return new Tuple5<>(v1, v2, v3, v4, v5); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T6> Tuple6<T1, T2, T3, T4, T5, T6> concat(Tuple1<T6> tuple) { - return new Tuple6<>(v1, v2, v3, v4, v5, tuple.getV1()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T6, T7> Tuple7<T1, T2, T3, T4, T5, T6, T7> concat(Tuple2<T6, T7> tuple) { - return new Tuple7<>(v1, v2, v3, v4, v5, tuple.getV1(), tuple.getV2()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T6, T7, T8> Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> concat(Tuple3<T6, T7, T8> tuple) { - return new Tuple8<>(v1, v2, v3, v4, v5, tuple.getV1(), tuple.getV2(), tuple.getV3()); - } - - /** - * Concatenate a tuple to this tuple. - */ - public final <T6, T7, T8, T9> Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> concat(Tuple4<T6, T7, T8, T9> 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 <T6, T7, T8, T9, T10> Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> concat(Tuple5<T6, T7, T8, T9, T10> 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 <T6, T7, T8, T9, T10, T11> Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> concat(Tuple6<T6, T7, T8, T9, T10, T11> 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 <T6, T7, T8, T9, T10, T11, T12> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> concat(Tuple7<T6, T7, T8, T9, T10, T11, T12> 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 <T6, T7, T8, T9, T10, T11, T12, T13> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> concat(Tuple8<T6, T7, T8, T9, T10, T11, T12, T13> 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 <T6, T7, T8, T9, T10, T11, T12, T13, T14> Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> concat(Tuple9<T6, T7, T8, T9, T10, T11, T12, T13, T14> 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 <T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> concat(Tuple10<T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> 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 <T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> concat(Tuple11<T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> 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<Tuple0, Tuple5<T1, T2, T3, T4, T5>> split0() { - return new Tuple2<>(limit0(), skip0()); - } - - /** - * Split this tuple into two tuples of degree 1 and 4. - */ - public final Tuple2<Tuple1<T1>, Tuple4<T2, T3, T4, T5>> split1() { - return new Tuple2<>(limit1(), skip1()); - } - - /** - * Split this tuple into two tuples of degree 2 and 3. - */ - public final Tuple2<Tuple2<T1, T2>, Tuple3<T3, T4, T5>> split2() { - return new Tuple2<>(limit2(), skip2()); - } - - /** - * Split this tuple into two tuples of degree 3 and 2. - */ - public final Tuple2<Tuple3<T1, T2, T3>, Tuple2<T4, T5>> split3() { - return new Tuple2<>(limit3(), skip3()); - } - - /** - * Split this tuple into two tuples of degree 4 and 1. - */ - public final Tuple2<Tuple4<T1, T2, T3, T4>, Tuple1<T5>> split4() { - return new Tuple2<>(limit4(), skip4()); - } - - /** - * Split this tuple into two tuples of degree 5 and 0. - */ - public final Tuple2<Tuple5<T1, T2, T3, T4, T5>, 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<T1> limit1() { - return new Tuple1<>(v1); - } - - /** - * Limit this tuple to degree 2. - */ - public final Tuple2<T1, T2> limit2() { - return new Tuple2<>(v1, v2); - } - - /** - * Limit this tuple to degree 3. - */ - public final Tuple3<T1, T2, T3> limit3() { - return new Tuple3<>(v1, v2, v3); - } - - /** - * Limit this tuple to degree 4. - */ - public final Tuple4<T1, T2, T3, T4> limit4() { - return new Tuple4<>(v1, v2, v3, v4); - } - - /** - * Limit this tuple to degree 5. - */ - public final Tuple5<T1, T2, T3, T4, T5> limit5() { - return this; - } - - /** - * Skip 0 degrees from this tuple. - */ - public final Tuple5<T1, T2, T3, T4, T5> skip0() { - return this; - } - - /** - * Skip 1 degrees from this tuple. - */ - public final Tuple4<T2, T3, T4, T5> skip1() { - return new Tuple4<>(v2, v3, v4, v5); - } - - /** - * Skip 2 degrees from this tuple. - */ - public final Tuple3<T3, T4, T5> skip2() { - return new Tuple3<>(v3, v4, v5); - } - - /** - * Skip 3 degrees from this tuple. - */ - public final Tuple2<T4, T5> skip3() { - return new Tuple2<>(v4, v5); - } - - /** - * Skip 4 degrees from this tuple. - */ - public final Tuple1<T5> 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> R map(Function5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> 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 <U1> Tuple5<U1, T2, T3, T4, T5> map1(Function1<? super T1, ? extends U1> 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 <U2> Tuple5<T1, U2, T3, T4, T5> map2(Function1<? super T2, ? extends U2> 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 <U3> Tuple5<T1, T2, U3, T4, T5> map3(Function1<? super T3, ? extends U3> 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 <U4> Tuple5<T1, T2, T3, U4, T5> map4(Function1<? super T4, ? extends U4> 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 <U5> Tuple5<T1, T2, T3, T4, U5> map5(Function1<? super T5, ? extends U5> function) { - return new Tuple5<>(v1, v2, v3, v4, function.apply(v5)); - } - - /** - * Maps the attributes of this tuple using a mapper function. - */ - public final <U1, U2, U3, U4, U5> Tuple5<U1, U2, U3, U4, U5> mapAll(Function5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, Tuple5<U1, U2, U3, U4, U5>> function) { - return function.apply(v1, v2, v3, v4, v5); - } - - /** - * Maps the attributes of this tuple using mapper functions. - */ - public final <U1, U2, U3, U4, U5> Tuple5<U1, U2, U3, U4, U5> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3, Function1<? super T4, ? extends U4> function4, Function1<? super T5, ? extends U5> function5) { - return new Tuple5<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4), function5.apply(v5)); - } - - - @Override - public Tuple5<T1, T2, T3, T4, T5> clone() { - return new Tuple5<>(this); - } }