http://git-wip-us.apache.org/repos/asf/groovy/blob/3ac1abcd/src/main/groovy/groovy/lang/Tuple1.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple1.java b/src/main/groovy/groovy/lang/Tuple1.java index 9b8d6bd..1e84013 100644 --- a/src/main/groovy/groovy/lang/Tuple1.java +++ b/src/main/groovy/groovy/lang/Tuple1.java @@ -18,6 +18,8 @@ */ package groovy.lang; +import groovy.util.function.Function1; + /** * Represents a list of 1 typed Object. * @@ -25,30 +27,197 @@ package groovy.lang; */ public class Tuple1<T1> extends Tuple { private static final long serialVersionUID = -4647790147461409603L; - private final T1 first; + private final T1 v1; - public Tuple1(T1 first) { - super(first); + public Tuple1(T1 t1) { + super(t1); - this.first = first; + this.v1 = t1; } - @Override - public Object get(int index) { - switch (index) { - case 0: - return first; - default: - throw new IndexOutOfBoundsException("index: " + index); - } + public Tuple1(Tuple1<T1> tuple) { + this(tuple.v1); } - @Override - public int size() { - return 1; + @Deprecated + public T1 getFirst() { + return v1; } - public T1 getFirst() { - return first; + public T1 v1() { + return v1; + } + + /** + * Concatenate a value to this tuple. + */ + public final <T2> Tuple2<T1, T2> concat(T2 value) { + return new Tuple2<>(v1, value); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T2> Tuple2<T1, T2> concat(Tuple1<T2> tuple) { + return new Tuple2<>(v1, tuple.v1()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T2, T3> Tuple3<T1, T2, T3> concat(Tuple2<T2, T3> tuple) { + return new Tuple3<>(v1, tuple.v1(), tuple.v2()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T2, T3, T4> Tuple4<T1, T2, T3, T4> concat(Tuple3<T2, T3, T4> tuple) { + return new Tuple4<>(v1, tuple.v1(), tuple.v2(), tuple.v3()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T2, T3, T4, T5> Tuple5<T1, T2, T3, T4, T5> concat(Tuple4<T2, T3, T4, T5> tuple) { + return new Tuple5<>(v1, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T2, T3, T4, T5, T6> Tuple6<T1, T2, T3, T4, T5, T6> concat(Tuple5<T2, T3, T4, T5, T6> tuple) { + return new Tuple6<>(v1, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T2, T3, T4, T5, T6, T7> Tuple7<T1, T2, T3, T4, T5, T6, T7> concat(Tuple6<T2, T3, T4, T5, T6, T7> tuple) { + return new Tuple7<>(v1, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T2, T3, T4, T5, T6, T7, T8> Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> concat(Tuple7<T2, T3, T4, T5, T6, T7, T8> tuple) { + return new Tuple8<>(v1, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T2, T3, T4, T5, T6, T7, T8, T9> Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> concat(Tuple8<T2, T3, T4, T5, T6, T7, T8, T9> tuple) { + return new Tuple9<>(v1, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T2, T3, T4, T5, T6, T7, T8, T9, T10> Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> concat(Tuple9<T2, T3, T4, T5, T6, T7, T8, T9, T10> tuple) { + return new Tuple10<>(v1, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8(), tuple.v9()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> concat(Tuple10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> tuple) { + return new Tuple11<>(v1, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8(), tuple.v9(), tuple.v10()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> concat(Tuple11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> tuple) { + return new Tuple12<>(v1, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8(), tuple.v9(), tuple.v10(), tuple.v11()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T2, 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(Tuple12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> tuple) { + return new Tuple13<>(v1, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8(), tuple.v9(), tuple.v10(), tuple.v11(), tuple.v12()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T2, 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(Tuple13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> tuple) { + return new Tuple14<>(v1, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8(), tuple.v9(), tuple.v10(), tuple.v11(), tuple.v12(), tuple.v13()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T2, 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(Tuple14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> tuple) { + return new Tuple15<>(v1, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8(), tuple.v9(), tuple.v10(), tuple.v11(), tuple.v12(), tuple.v13(), tuple.v14()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T2, 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(Tuple15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> tuple) { + return new Tuple16<>(v1, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8(), tuple.v9(), tuple.v10(), tuple.v11(), tuple.v12(), tuple.v13(), tuple.v14(), tuple.v15()); + } + + /** + * Split this tuple into two tuples of degree 0 and 1. + */ + public final Tuple2<Tuple0, Tuple1<T1>> split0() { + return new Tuple2<>(limit0(), skip0()); + } + + /** + * Split this tuple into two tuples of degree 1 and 0. + */ + public final Tuple2<Tuple1<T1>, Tuple0> split1() { + return new Tuple2<>(limit1(), skip1()); + } + + /** + * Limit this tuple to degree 0. + */ + public final Tuple0 limit0() { + return new Tuple0(); + } + + /** + * Limit this tuple to degree 1. + */ + public final Tuple1<T1> limit1() { + return this; + } + + /** + * Skip 0 degrees from this tuple. + */ + public final Tuple1<T1> skip0() { + return this; + } + + /** + * Skip 1 degrees from this tuple. + */ + public final Tuple0 skip1() { + return new Tuple0(); + } + + /** + * Apply this tuple as arguments to a function. + */ + public final <R> R map(Function1<? super T1, ? extends R> function) { + return function.apply(v1); + } + + /** + * Apply attribute 1 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U1> Tuple1<U1> map1(Function1<? super T1, ? extends U1> function) { + return new Tuple1<>(function.apply(v1)); + } + + @Override + public Tuple1<T1> clone() { + return new Tuple1<>(this); } }
http://git-wip-us.apache.org/repos/asf/groovy/blob/3ac1abcd/src/main/groovy/groovy/lang/Tuple10.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple10.java b/src/main/groovy/groovy/lang/Tuple10.java new file mode 100644 index 0000000..6d3ca62 --- /dev/null +++ b/src/main/groovy/groovy/lang/Tuple10.java @@ -0,0 +1,510 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +package groovy.lang; + +import groovy.util.function.Function1; +import groovy.util.function.Function10; + +/** + * Represents a list of 10 typed Objects. + * + * @since 3.0.0 + */ +public class Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> extends Tuple { + private static final long serialVersionUID = 7824474731525795360L; + private final T1 v1; + private final T2 v2; + private final T3 v3; + private final T4 v4; + private final T5 v5; + private final T6 v6; + private final T7 v7; + private final T8 v8; + private final T9 v9; + private final T10 v10; + + public Tuple10(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) { + super(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10); + + this.v1 = v1; + this.v2 = v2; + this.v3 = v3; + this.v4 = v4; + this.v5 = v5; + this.v6 = v6; + this.v7 = v7; + this.v8 = v8; + this.v9 = v9; + this.v10 = v10; + } + + public Tuple10(Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> tuple) { + this(tuple.v1, tuple.v2, tuple.v3, tuple.v4, tuple.v5, tuple.v6, tuple.v7, tuple.v8, tuple.v9, tuple.v10); + } + + @Deprecated + public T1 getFirst() { + return v1; + } + + @Deprecated + public T2 getSecond() { + return v2; + } + + @Deprecated + public T3 getThird() { + return v3; + } + + @Deprecated + public T4 getFourth() { + return v4; + } + + @Deprecated + public T5 getFifth() { + return v5; + } + + @Deprecated + public T6 getSixth() { + return v6; + } + + @Deprecated + public T7 getSeventh() { + return v7; + } + + @Deprecated + public T8 getEighth() { + return v8; + } + + @Deprecated + public T9 getNinth() { + return v9; + } + + public T1 v1() { + return v1; + } + + public T2 v2() { + return v2; + } + + public T3 v3() { + return v3; + } + + public T4 v4() { + return v4; + } + + public T5 v5() { + return v5; + } + + public T6 v6() { + return v6; + } + + public T7 v7() { + return v7; + } + + public T8 v8() { + return v8; + } + + public T9 v9() { + return v9; + } + + public T10 v10() { + return v10; + } + + + /** + * Concatenate a value to this tuple. + */ + public final <T11> Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> concat(T11 value) { + return new Tuple11<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, value); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T11> Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> concat(Tuple1<T11> tuple) { + return new Tuple11<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, tuple.v1()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T11, T12> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> concat(Tuple2<T11, T12> tuple) { + return new Tuple12<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, tuple.v1(), tuple.v2()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T11, T12, T13> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> concat(Tuple3<T11, T12, T13> tuple) { + return new Tuple13<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, tuple.v1(), tuple.v2(), tuple.v3()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T11, T12, T13, T14> Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> concat(Tuple4<T11, T12, T13, T14> tuple) { + return new Tuple14<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T11, T12, T13, T14, T15> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> concat(Tuple5<T11, T12, T13, T14, T15> tuple) { + return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T11, T12, T13, T14, T15, T16> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> concat(Tuple6<T11, T12, T13, T14, T15, T16> tuple) { + return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6()); + } + + /** + * Split this tuple into two tuples of degree 0 and 10. + */ + public final Tuple2<Tuple0, Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>> split0() { + return new Tuple2<>(limit0(), skip0()); + } + + /** + * Split this tuple into two tuples of degree 1 and 9. + */ + public final Tuple2<Tuple1<T1>, Tuple9<T2, T3, T4, T5, T6, T7, T8, T9, T10>> split1() { + return new Tuple2<>(limit1(), skip1()); + } + + /** + * Split this tuple into two tuples of degree 2 and 8. + */ + public final Tuple2<Tuple2<T1, T2>, Tuple8<T3, T4, T5, T6, T7, T8, T9, T10>> split2() { + return new Tuple2<>(limit2(), skip2()); + } + + /** + * Split this tuple into two tuples of degree 3 and 7. + */ + public final Tuple2<Tuple3<T1, T2, T3>, Tuple7<T4, T5, T6, T7, T8, T9, T10>> split3() { + return new Tuple2<>(limit3(), skip3()); + } + + /** + * Split this tuple into two tuples of degree 4 and 6. + */ + public final Tuple2<Tuple4<T1, T2, T3, T4>, Tuple6<T5, T6, T7, T8, T9, T10>> split4() { + return new Tuple2<>(limit4(), skip4()); + } + + /** + * Split this tuple into two tuples of degree 5 and 5. + */ + public final Tuple2<Tuple5<T1, T2, T3, T4, T5>, Tuple5<T6, T7, T8, T9, T10>> split5() { + return new Tuple2<>(limit5(), skip5()); + } + + /** + * Split this tuple into two tuples of degree 6 and 4. + */ + public final Tuple2<Tuple6<T1, T2, T3, T4, T5, T6>, Tuple4<T7, T8, T9, T10>> split6() { + return new Tuple2<>(limit6(), skip6()); + } + + /** + * Split this tuple into two tuples of degree 7 and 3. + */ + public final Tuple2<Tuple7<T1, T2, T3, T4, T5, T6, T7>, Tuple3<T8, T9, T10>> split7() { + return new Tuple2<>(limit7(), skip7()); + } + + /** + * Split this tuple into two tuples of degree 8 and 2. + */ + public final Tuple2<Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>, Tuple2<T9, T10>> split8() { + return new Tuple2<>(limit8(), skip8()); + } + + /** + * Split this tuple into two tuples of degree 9 and 1. + */ + public final Tuple2<Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9>, Tuple1<T10>> split9() { + return new Tuple2<>(limit9(), skip9()); + } + + /** + * Split this tuple into two tuples of degree 10 and 0. + */ + public final Tuple2<Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, Tuple0> split10() { + return new Tuple2<>(limit10(), skip10()); + } + + /** + * Limit this tuple to degree 0. + */ + public final Tuple0 limit0() { + return new Tuple0(); + } + + /** + * 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 this; + } + + /** + * Skip 0 degrees from this tuple. + */ + public final Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> skip0() { + return this; + } + + /** + * Skip 1 degrees from this tuple. + */ + public final Tuple9<T2, T3, T4, T5, T6, T7, T8, T9, T10> skip1() { + return new Tuple9<>(v2, v3, v4, v5, v6, v7, v8, v9, v10); + } + + /** + * Skip 2 degrees from this tuple. + */ + public final Tuple8<T3, T4, T5, T6, T7, T8, T9, T10> skip2() { + return new Tuple8<>(v3, v4, v5, v6, v7, v8, v9, v10); + } + + /** + * Skip 3 degrees from this tuple. + */ + public final Tuple7<T4, T5, T6, T7, T8, T9, T10> skip3() { + return new Tuple7<>(v4, v5, v6, v7, v8, v9, v10); + } + + /** + * Skip 4 degrees from this tuple. + */ + public final Tuple6<T5, T6, T7, T8, T9, T10> skip4() { + return new Tuple6<>(v5, v6, v7, v8, v9, v10); + } + + /** + * Skip 5 degrees from this tuple. + */ + public final Tuple5<T6, T7, T8, T9, T10> skip5() { + return new Tuple5<>(v6, v7, v8, v9, v10); + } + + /** + * Skip 6 degrees from this tuple. + */ + public final Tuple4<T7, T8, T9, T10> skip6() { + return new Tuple4<>(v7, v8, v9, v10); + } + + /** + * Skip 7 degrees from this tuple. + */ + public final Tuple3<T8, T9, T10> skip7() { + return new Tuple3<>(v8, v9, v10); + } + + /** + * Skip 8 degrees from this tuple. + */ + public final Tuple2<T9, T10> skip8() { + return new Tuple2<>(v9, v10); + } + + /** + * Skip 9 degrees from this tuple. + */ + public final Tuple1<T10> skip9() { + return new Tuple1<>(v10); + } + + /** + * Skip 10 degrees from this tuple. + */ + public final Tuple0 skip10() { + return new Tuple0(); + } + + /** + * Apply this tuple as arguments to a function. + */ + public final <R> R map(Function10<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? super T10, ? extends R> function) { + return function.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10); + } + + /** + * Apply attribute 1 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U1> Tuple10<U1, T2, T3, T4, T5, T6, T7, T8, T9, T10> map1(Function1<? super T1, ? extends U1> function) { + return new Tuple10<>(function.apply(v1), v2, v3, v4, v5, v6, v7, v8, v9, v10); + } + + /** + * Apply attribute 2 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U2> Tuple10<T1, U2, T3, T4, T5, T6, T7, T8, T9, T10> map2(Function1<? super T2, ? extends U2> function) { + return new Tuple10<>(v1, function.apply(v2), v3, v4, v5, v6, v7, v8, v9, v10); + } + + /** + * Apply attribute 3 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U3> Tuple10<T1, T2, U3, T4, T5, T6, T7, T8, T9, T10> map3(Function1<? super T3, ? extends U3> function) { + return new Tuple10<>(v1, v2, function.apply(v3), v4, v5, v6, v7, v8, v9, v10); + } + + /** + * Apply attribute 4 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U4> Tuple10<T1, T2, T3, U4, T5, T6, T7, T8, T9, T10> map4(Function1<? super T4, ? extends U4> function) { + return new Tuple10<>(v1, v2, v3, function.apply(v4), v5, v6, v7, v8, v9, v10); + } + + /** + * Apply attribute 5 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U5> Tuple10<T1, T2, T3, T4, U5, T6, T7, T8, T9, T10> map5(Function1<? super T5, ? extends U5> function) { + return new Tuple10<>(v1, v2, v3, v4, function.apply(v5), v6, v7, v8, v9, v10); + } + + /** + * Apply attribute 6 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U6> Tuple10<T1, T2, T3, T4, T5, U6, T7, T8, T9, T10> map6(Function1<? super T6, ? extends U6> function) { + return new Tuple10<>(v1, v2, v3, v4, v5, function.apply(v6), v7, v8, v9, v10); + } + + /** + * Apply attribute 7 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U7> Tuple10<T1, T2, T3, T4, T5, T6, U7, T8, T9, T10> map7(Function1<? super T7, ? extends U7> function) { + return new Tuple10<>(v1, v2, v3, v4, v5, v6, function.apply(v7), v8, v9, v10); + } + + /** + * Apply attribute 8 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U8> Tuple10<T1, T2, T3, T4, T5, T6, T7, U8, T9, T10> map8(Function1<? super T8, ? extends U8> function) { + return new Tuple10<>(v1, v2, v3, v4, v5, v6, v7, function.apply(v8), v9, v10); + } + + /** + * Apply attribute 9 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U9> Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, U9, T10> map9(Function1<? super T9, ? extends U9> function) { + return new Tuple10<>(v1, v2, v3, v4, v5, v6, v7, v8, function.apply(v9), v10); + } + + /** + * Apply attribute 10 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U10> Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, U10> map10(Function1<? super T10, ? extends U10> function) { + return new Tuple10<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, function.apply(v10)); + } + + @Override + public Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> clone() { + return new Tuple10<>(this); + } +} http://git-wip-us.apache.org/repos/asf/groovy/blob/3ac1abcd/src/main/groovy/groovy/lang/Tuple11.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple11.java b/src/main/groovy/groovy/lang/Tuple11.java new file mode 100644 index 0000000..9b2bab1 --- /dev/null +++ b/src/main/groovy/groovy/lang/Tuple11.java @@ -0,0 +1,537 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +package groovy.lang; + +import groovy.util.function.Function1; +import groovy.util.function.Function11; + +/** + * Represents a list of 10 typed Objects. + * + * @since 3.0.0 + */ +public class Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> extends Tuple { + private static final long serialVersionUID = -8882524414681687282L; + private final T1 v1; + private final T2 v2; + private final T3 v3; + private final T4 v4; + private final T5 v5; + private final T6 v6; + private final T7 v7; + private final T8 v8; + private final T9 v9; + private final T10 v10; + private final T11 v11; + + public Tuple11(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11) { + super(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11); + + this.v1 = v1; + this.v2 = v2; + this.v3 = v3; + this.v4 = v4; + this.v5 = v5; + this.v6 = v6; + this.v7 = v7; + this.v8 = v8; + this.v9 = v9; + this.v10 = v10; + this.v11 = v11; + } + + public Tuple11(Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> tuple) { + this(tuple.v1, tuple.v2, tuple.v3, tuple.v4, tuple.v5, tuple.v6, tuple.v7, tuple.v8, tuple.v9, tuple.v10, tuple.v11); + } + + @Deprecated + public T1 getFirst() { + return v1; + } + + @Deprecated + public T2 getSecond() { + return v2; + } + + @Deprecated + public T3 getThird() { + return v3; + } + + @Deprecated + public T4 getFourth() { + return v4; + } + + @Deprecated + public T5 getFifth() { + return v5; + } + + @Deprecated + public T6 getSixth() { + return v6; + } + + @Deprecated + public T7 getSeventh() { + return v7; + } + + @Deprecated + public T8 getEighth() { + return v8; + } + + @Deprecated + public T9 getNinth() { + return v9; + } + + public T1 v1() { + return v1; + } + + public T2 v2() { + return v2; + } + + public T3 v3() { + return v3; + } + + public T4 v4() { + return v4; + } + + public T5 v5() { + return v5; + } + + public T6 v6() { + return v6; + } + + public T7 v7() { + return v7; + } + + public T8 v8() { + return v8; + } + + public T9 v9() { + return v9; + } + + public T10 v10() { + return v10; + } + + public T11 v11() { + return v11; + } + + + /** + * Concatenate a value to this tuple. + */ + public final <T12> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> concat(T12 value) { + return new Tuple12<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, value); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T12> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> concat(Tuple1<T12> tuple) { + return new Tuple12<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, tuple.v1()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T12, T13> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> concat(Tuple2<T12, T13> tuple) { + return new Tuple13<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, tuple.v1(), tuple.v2()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T12, T13, T14> Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> concat(Tuple3<T12, T13, T14> tuple) { + return new Tuple14<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, tuple.v1(), tuple.v2(), tuple.v3()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T12, T13, T14, T15> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> concat(Tuple4<T12, T13, T14, T15> tuple) { + return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T12, T13, T14, T15, T16> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> concat(Tuple5<T12, T13, T14, T15, T16> tuple) { + return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5()); + } + + /** + * Split this tuple into two tuples of degree 0 and 11. + */ + public final Tuple2<Tuple0, Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>> split0() { + return new Tuple2<>(limit0(), skip0()); + } + + /** + * Split this tuple into two tuples of degree 1 and 10. + */ + public final Tuple2<Tuple1<T1>, Tuple10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>> split1() { + return new Tuple2<>(limit1(), skip1()); + } + + /** + * Split this tuple into two tuples of degree 2 and 9. + */ + public final Tuple2<Tuple2<T1, T2>, Tuple9<T3, T4, T5, T6, T7, T8, T9, T10, T11>> split2() { + return new Tuple2<>(limit2(), skip2()); + } + + /** + * Split this tuple into two tuples of degree 3 and 8. + */ + public final Tuple2<Tuple3<T1, T2, T3>, Tuple8<T4, T5, T6, T7, T8, T9, T10, T11>> split3() { + return new Tuple2<>(limit3(), skip3()); + } + + /** + * Split this tuple into two tuples of degree 4 and 7. + */ + public final Tuple2<Tuple4<T1, T2, T3, T4>, Tuple7<T5, T6, T7, T8, T9, T10, T11>> split4() { + return new Tuple2<>(limit4(), skip4()); + } + + /** + * Split this tuple into two tuples of degree 5 and 6. + */ + public final Tuple2<Tuple5<T1, T2, T3, T4, T5>, Tuple6<T6, T7, T8, T9, T10, T11>> split5() { + return new Tuple2<>(limit5(), skip5()); + } + + /** + * Split this tuple into two tuples of degree 6 and 5. + */ + public final Tuple2<Tuple6<T1, T2, T3, T4, T5, T6>, Tuple5<T7, T8, T9, T10, T11>> split6() { + return new Tuple2<>(limit6(), skip6()); + } + + /** + * Split this tuple into two tuples of degree 7 and 4. + */ + public final Tuple2<Tuple7<T1, T2, T3, T4, T5, T6, T7>, Tuple4<T8, T9, T10, T11>> split7() { + return new Tuple2<>(limit7(), skip7()); + } + + /** + * Split this tuple into two tuples of degree 8 and 3. + */ + public final Tuple2<Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>, Tuple3<T9, T10, T11>> split8() { + return new Tuple2<>(limit8(), skip8()); + } + + /** + * Split this tuple into two tuples of degree 9 and 2. + */ + public final Tuple2<Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9>, Tuple2<T10, T11>> split9() { + return new Tuple2<>(limit9(), skip9()); + } + + /** + * Split this tuple into two tuples of degree 10 and 1. + */ + public final Tuple2<Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, Tuple1<T11>> split10() { + return new Tuple2<>(limit10(), skip10()); + } + + /** + * Split this tuple into two tuples of degree 11 and 0. + */ + public final Tuple2<Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, Tuple0> split11() { + return new Tuple2<>(limit11(), skip11()); + } + + /** + * Limit this tuple to degree 0. + */ + public final Tuple0 limit0() { + return new Tuple0(); + } + + /** + * 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 this; + } + + /** + * Skip 0 degrees from this tuple. + */ + public final Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> skip0() { + return this; + } + + /** + * Skip 1 degrees from this tuple. + */ + public final Tuple10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> skip1() { + return new Tuple10<>(v2, v3, v4, v5, v6, v7, v8, v9, v10, v11); + } + + /** + * Skip 2 degrees from this tuple. + */ + public final Tuple9<T3, T4, T5, T6, T7, T8, T9, T10, T11> skip2() { + return new Tuple9<>(v3, v4, v5, v6, v7, v8, v9, v10, v11); + } + + /** + * Skip 3 degrees from this tuple. + */ + public final Tuple8<T4, T5, T6, T7, T8, T9, T10, T11> skip3() { + return new Tuple8<>(v4, v5, v6, v7, v8, v9, v10, v11); + } + + /** + * Skip 4 degrees from this tuple. + */ + public final Tuple7<T5, T6, T7, T8, T9, T10, T11> skip4() { + return new Tuple7<>(v5, v6, v7, v8, v9, v10, v11); + } + + /** + * Skip 5 degrees from this tuple. + */ + public final Tuple6<T6, T7, T8, T9, T10, T11> skip5() { + return new Tuple6<>(v6, v7, v8, v9, v10, v11); + } + + /** + * Skip 6 degrees from this tuple. + */ + public final Tuple5<T7, T8, T9, T10, T11> skip6() { + return new Tuple5<>(v7, v8, v9, v10, v11); + } + + /** + * Skip 7 degrees from this tuple. + */ + public final Tuple4<T8, T9, T10, T11> skip7() { + return new Tuple4<>(v8, v9, v10, v11); + } + + /** + * Skip 8 degrees from this tuple. + */ + public final Tuple3<T9, T10, T11> skip8() { + return new Tuple3<>(v9, v10, v11); + } + + /** + * Skip 9 degrees from this tuple. + */ + public final Tuple2<T10, T11> skip9() { + return new Tuple2<>(v10, v11); + } + + /** + * Skip 10 degrees from this tuple. + */ + public final Tuple1<T11> skip10() { + return new Tuple1<>(v11); + } + + /** + * Skip 11 degrees from this tuple. + */ + public final Tuple0 skip11() { + return new Tuple0(); + } + + /** + * Apply this tuple as arguments to a function. + */ + public final <R> R map(Function11<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? super T10, ? super T11, ? extends R> function) { + return function.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11); + } + + /** + * Apply attribute 1 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U1> Tuple11<U1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> map1(Function1<? super T1, ? extends U1> function) { + return new Tuple11<>(function.apply(v1), v2, v3, v4, v5, v6, v7, v8, v9, v10, v11); + } + + /** + * Apply attribute 2 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U2> Tuple11<T1, U2, T3, T4, T5, T6, T7, T8, T9, T10, T11> map2(Function1<? super T2, ? extends U2> function) { + return new Tuple11<>(v1, function.apply(v2), v3, v4, v5, v6, v7, v8, v9, v10, v11); + } + + /** + * Apply attribute 3 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U3> Tuple11<T1, T2, U3, T4, T5, T6, T7, T8, T9, T10, T11> map3(Function1<? super T3, ? extends U3> function) { + return new Tuple11<>(v1, v2, function.apply(v3), v4, v5, v6, v7, v8, v9, v10, v11); + } + + /** + * Apply attribute 4 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U4> Tuple11<T1, T2, T3, U4, T5, T6, T7, T8, T9, T10, T11> map4(Function1<? super T4, ? extends U4> function) { + return new Tuple11<>(v1, v2, v3, function.apply(v4), v5, v6, v7, v8, v9, v10, v11); + } + + /** + * Apply attribute 5 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U5> Tuple11<T1, T2, T3, T4, U5, T6, T7, T8, T9, T10, T11> map5(Function1<? super T5, ? extends U5> function) { + return new Tuple11<>(v1, v2, v3, v4, function.apply(v5), v6, v7, v8, v9, v10, v11); + } + + /** + * Apply attribute 6 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U6> Tuple11<T1, T2, T3, T4, T5, U6, T7, T8, T9, T10, T11> map6(Function1<? super T6, ? extends U6> function) { + return new Tuple11<>(v1, v2, v3, v4, v5, function.apply(v6), v7, v8, v9, v10, v11); + } + + /** + * Apply attribute 7 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U7> Tuple11<T1, T2, T3, T4, T5, T6, U7, T8, T9, T10, T11> map7(Function1<? super T7, ? extends U7> function) { + return new Tuple11<>(v1, v2, v3, v4, v5, v6, function.apply(v7), v8, v9, v10, v11); + } + + /** + * Apply attribute 8 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U8> Tuple11<T1, T2, T3, T4, T5, T6, T7, U8, T9, T10, T11> map8(Function1<? super T8, ? extends U8> function) { + return new Tuple11<>(v1, v2, v3, v4, v5, v6, v7, function.apply(v8), v9, v10, v11); + } + + /** + * Apply attribute 9 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U9> Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, U9, T10, T11> map9(Function1<? super T9, ? extends U9> function) { + return new Tuple11<>(v1, v2, v3, v4, v5, v6, v7, v8, function.apply(v9), v10, v11); + } + + /** + * Apply attribute 10 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U10> Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, U10, T11> map10(Function1<? super T10, ? extends U10> function) { + return new Tuple11<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, function.apply(v10), v11); + } + + /** + * Apply attribute 11 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U11> Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, U11> map11(Function1<? super T11, ? extends U11> function) { + return new Tuple11<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, function.apply(v11)); + } + + @Override + public Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> clone() { + return new Tuple11<>(this); + } +} http://git-wip-us.apache.org/repos/asf/groovy/blob/3ac1abcd/src/main/groovy/groovy/lang/Tuple12.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple12.java b/src/main/groovy/groovy/lang/Tuple12.java new file mode 100644 index 0000000..64fd51f --- /dev/null +++ b/src/main/groovy/groovy/lang/Tuple12.java @@ -0,0 +1,565 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +package groovy.lang; + +import groovy.util.function.Function1; +import groovy.util.function.Function12; + +/** + * Represents a list of 12 typed Objects. + * + * @since 3.0.0 + */ +public class Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> extends Tuple { + private static final long serialVersionUID = 8297587976812329899L; + private final T1 v1; + private final T2 v2; + private final T3 v3; + private final T4 v4; + private final T5 v5; + private final T6 v6; + private final T7 v7; + private final T8 v8; + private final T9 v9; + private final T10 v10; + private final T11 v11; + private final T12 v12; + + + public Tuple12(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12) { + super(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12); + + this.v1 = v1; + this.v2 = v2; + this.v3 = v3; + this.v4 = v4; + this.v5 = v5; + this.v6 = v6; + this.v7 = v7; + this.v8 = v8; + this.v9 = v9; + this.v10 = v10; + this.v11 = v11; + this.v12 = v12; + } + + public Tuple12(Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> tuple) { + this(tuple.v1, tuple.v2, tuple.v3, tuple.v4, tuple.v5, tuple.v6, tuple.v7, tuple.v8, tuple.v9, tuple.v10, tuple.v11, tuple.v12); + } + + @Deprecated + public T1 getFirst() { + return v1; + } + + @Deprecated + public T2 getSecond() { + return v2; + } + + @Deprecated + public T3 getThird() { + return v3; + } + + @Deprecated + public T4 getFourth() { + return v4; + } + + @Deprecated + public T5 getFifth() { + return v5; + } + + @Deprecated + public T6 getSixth() { + return v6; + } + + @Deprecated + public T7 getSeventh() { + return v7; + } + + @Deprecated + public T8 getEighth() { + return v8; + } + + @Deprecated + public T9 getNinth() { + return v9; + } + + public T1 v1() { + return v1; + } + + public T2 v2() { + return v2; + } + + public T3 v3() { + return v3; + } + + public T4 v4() { + return v4; + } + + public T5 v5() { + return v5; + } + + public T6 v6() { + return v6; + } + + public T7 v7() { + return v7; + } + + public T8 v8() { + return v8; + } + + public T9 v9() { + return v9; + } + + public T10 v10() { + return v10; + } + + public T11 v11() { + return v11; + } + + public T12 v12() { + return v12; + } + + + /** + * Concatenate a value to this tuple. + */ + public final <T13> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> concat(T13 value) { + return new Tuple13<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, value); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T13> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> concat(Tuple1<T13> tuple) { + return new Tuple13<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, tuple.v1()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T13, T14> Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> concat(Tuple2<T13, T14> tuple) { + return new Tuple14<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, tuple.v1(), tuple.v2()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T13, T14, T15> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> concat(Tuple3<T13, T14, T15> tuple) { + return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, tuple.v1(), tuple.v2(), tuple.v3()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T13, T14, T15, T16> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> concat(Tuple4<T13, T14, T15, T16> tuple) { + return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4()); + } + + /** + * Split this tuple into two tuples of degree 0 and 12. + */ + public final Tuple2<Tuple0, Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>> split0() { + return new Tuple2<>(limit0(), skip0()); + } + + /** + * Split this tuple into two tuples of degree 1 and 11. + */ + public final Tuple2<Tuple1<T1>, Tuple11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>> split1() { + return new Tuple2<>(limit1(), skip1()); + } + + /** + * Split this tuple into two tuples of degree 2 and 10. + */ + public final Tuple2<Tuple2<T1, T2>, Tuple10<T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>> split2() { + return new Tuple2<>(limit2(), skip2()); + } + + /** + * Split this tuple into two tuples of degree 3 and 9. + */ + public final Tuple2<Tuple3<T1, T2, T3>, Tuple9<T4, T5, T6, T7, T8, T9, T10, T11, T12>> split3() { + return new Tuple2<>(limit3(), skip3()); + } + + /** + * Split this tuple into two tuples of degree 4 and 8. + */ + public final Tuple2<Tuple4<T1, T2, T3, T4>, Tuple8<T5, T6, T7, T8, T9, T10, T11, T12>> split4() { + return new Tuple2<>(limit4(), skip4()); + } + + /** + * Split this tuple into two tuples of degree 5 and 7. + */ + public final Tuple2<Tuple5<T1, T2, T3, T4, T5>, Tuple7<T6, T7, T8, T9, T10, T11, T12>> split5() { + return new Tuple2<>(limit5(), skip5()); + } + + /** + * Split this tuple into two tuples of degree 6 and 6. + */ + public final Tuple2<Tuple6<T1, T2, T3, T4, T5, T6>, Tuple6<T7, T8, T9, T10, T11, T12>> split6() { + return new Tuple2<>(limit6(), skip6()); + } + + /** + * Split this tuple into two tuples of degree 7 and 5. + */ + public final Tuple2<Tuple7<T1, T2, T3, T4, T5, T6, T7>, Tuple5<T8, T9, T10, T11, T12>> split7() { + return new Tuple2<>(limit7(), skip7()); + } + + /** + * Split this tuple into two tuples of degree 8 and 4. + */ + public final Tuple2<Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>, Tuple4<T9, T10, T11, T12>> split8() { + return new Tuple2<>(limit8(), skip8()); + } + + /** + * Split this tuple into two tuples of degree 9 and 3. + */ + public final Tuple2<Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9>, Tuple3<T10, T11, T12>> split9() { + return new Tuple2<>(limit9(), skip9()); + } + + /** + * Split this tuple into two tuples of degree 10 and 2. + */ + public final Tuple2<Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, Tuple2<T11, T12>> split10() { + return new Tuple2<>(limit10(), skip10()); + } + + /** + * Split this tuple into two tuples of degree 11 and 1. + */ + public final Tuple2<Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, Tuple1<T12>> split11() { + return new Tuple2<>(limit11(), skip11()); + } + + /** + * Split this tuple into two tuples of degree 12 and 0. + */ + public final Tuple2<Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, Tuple0> split12() { + return new Tuple2<>(limit12(), skip12()); + } + + /** + * Limit this tuple to degree 0. + */ + public final Tuple0 limit0() { + return new Tuple0(); + } + + /** + * 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 this; + } + + /** + * Skip 0 degrees from this tuple. + */ + public final Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> skip0() { + return this; + } + + /** + * Skip 1 degrees from this tuple. + */ + public final Tuple11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> skip1() { + return new Tuple11<>(v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12); + } + + /** + * Skip 2 degrees from this tuple. + */ + public final Tuple10<T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> skip2() { + return new Tuple10<>(v3, v4, v5, v6, v7, v8, v9, v10, v11, v12); + } + + /** + * Skip 3 degrees from this tuple. + */ + public final Tuple9<T4, T5, T6, T7, T8, T9, T10, T11, T12> skip3() { + return new Tuple9<>(v4, v5, v6, v7, v8, v9, v10, v11, v12); + } + + /** + * Skip 4 degrees from this tuple. + */ + public final Tuple8<T5, T6, T7, T8, T9, T10, T11, T12> skip4() { + return new Tuple8<>(v5, v6, v7, v8, v9, v10, v11, v12); + } + + /** + * Skip 5 degrees from this tuple. + */ + public final Tuple7<T6, T7, T8, T9, T10, T11, T12> skip5() { + return new Tuple7<>(v6, v7, v8, v9, v10, v11, v12); + } + + /** + * Skip 6 degrees from this tuple. + */ + public final Tuple6<T7, T8, T9, T10, T11, T12> skip6() { + return new Tuple6<>(v7, v8, v9, v10, v11, v12); + } + + /** + * Skip 7 degrees from this tuple. + */ + public final Tuple5<T8, T9, T10, T11, T12> skip7() { + return new Tuple5<>(v8, v9, v10, v11, v12); + } + + /** + * Skip 8 degrees from this tuple. + */ + public final Tuple4<T9, T10, T11, T12> skip8() { + return new Tuple4<>(v9, v10, v11, v12); + } + + /** + * Skip 9 degrees from this tuple. + */ + public final Tuple3<T10, T11, T12> skip9() { + return new Tuple3<>(v10, v11, v12); + } + + /** + * Skip 10 degrees from this tuple. + */ + public final Tuple2<T11, T12> skip10() { + return new Tuple2<>(v11, v12); + } + + /** + * Skip 11 degrees from this tuple. + */ + public final Tuple1<T12> skip11() { + return new Tuple1<>(v12); + } + + /** + * Skip 12 degrees from this tuple. + */ + public final Tuple0 skip12() { + return new Tuple0(); + } + + /** + * Apply this tuple as arguments to a function. + */ + public final <R> R map(Function12<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? super T10, ? super T11, ? super T12, ? extends R> function) { + return function.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12); + } + + /** + * Apply attribute 1 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U1> Tuple12<U1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> map1(Function1<? super T1, ? extends U1> function) { + return new Tuple12<>(function.apply(v1), v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12); + } + + /** + * Apply attribute 2 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U2> Tuple12<T1, U2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> map2(Function1<? super T2, ? extends U2> function) { + return new Tuple12<>(v1, function.apply(v2), v3, v4, v5, v6, v7, v8, v9, v10, v11, v12); + } + + /** + * Apply attribute 3 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U3> Tuple12<T1, T2, U3, T4, T5, T6, T7, T8, T9, T10, T11, T12> map3(Function1<? super T3, ? extends U3> function) { + return new Tuple12<>(v1, v2, function.apply(v3), v4, v5, v6, v7, v8, v9, v10, v11, v12); + } + + /** + * Apply attribute 4 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U4> Tuple12<T1, T2, T3, U4, T5, T6, T7, T8, T9, T10, T11, T12> map4(Function1<? super T4, ? extends U4> function) { + return new Tuple12<>(v1, v2, v3, function.apply(v4), v5, v6, v7, v8, v9, v10, v11, v12); + } + + /** + * Apply attribute 5 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U5> Tuple12<T1, T2, T3, T4, U5, T6, T7, T8, T9, T10, T11, T12> map5(Function1<? super T5, ? extends U5> function) { + return new Tuple12<>(v1, v2, v3, v4, function.apply(v5), v6, v7, v8, v9, v10, v11, v12); + } + + /** + * Apply attribute 6 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U6> Tuple12<T1, T2, T3, T4, T5, U6, T7, T8, T9, T10, T11, T12> map6(Function1<? super T6, ? extends U6> function) { + return new Tuple12<>(v1, v2, v3, v4, v5, function.apply(v6), v7, v8, v9, v10, v11, v12); + } + + /** + * Apply attribute 7 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U7> Tuple12<T1, T2, T3, T4, T5, T6, U7, T8, T9, T10, T11, T12> map7(Function1<? super T7, ? extends U7> function) { + return new Tuple12<>(v1, v2, v3, v4, v5, v6, function.apply(v7), v8, v9, v10, v11, v12); + } + + /** + * Apply attribute 8 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U8> Tuple12<T1, T2, T3, T4, T5, T6, T7, U8, T9, T10, T11, T12> map8(Function1<? super T8, ? extends U8> function) { + return new Tuple12<>(v1, v2, v3, v4, v5, v6, v7, function.apply(v8), v9, v10, v11, v12); + } + + /** + * Apply attribute 9 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U9> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, U9, T10, T11, T12> map9(Function1<? super T9, ? extends U9> function) { + return new Tuple12<>(v1, v2, v3, v4, v5, v6, v7, v8, function.apply(v9), v10, v11, v12); + } + + /** + * Apply attribute 10 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U10> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, U10, T11, T12> map10(Function1<? super T10, ? extends U10> function) { + return new Tuple12<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, function.apply(v10), v11, v12); + } + + /** + * Apply attribute 11 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U11> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, U11, T12> map11(Function1<? super T11, ? extends U11> function) { + return new Tuple12<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, function.apply(v11), v12); + } + + /** + * Apply attribute 12 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U12> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, U12> map12(Function1<? super T12, ? extends U12> function) { + return new Tuple12<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, function.apply(v12)); + } + + @Override + public Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> clone() { + return new Tuple12<>(this); + } +} http://git-wip-us.apache.org/repos/asf/groovy/blob/3ac1abcd/src/main/groovy/groovy/lang/Tuple13.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple13.java b/src/main/groovy/groovy/lang/Tuple13.java new file mode 100644 index 0000000..e996a59 --- /dev/null +++ b/src/main/groovy/groovy/lang/Tuple13.java @@ -0,0 +1,592 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +package groovy.lang; + +import groovy.util.function.Function1; +import groovy.util.function.Function13; + +/** + * Represents a list of 13 typed Objects. + * + * @since 3.0.0 + */ +public class Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> extends Tuple { + private static final long serialVersionUID = -3709443502209750114L; + private final T1 v1; + private final T2 v2; + private final T3 v3; + private final T4 v4; + private final T5 v5; + private final T6 v6; + private final T7 v7; + private final T8 v8; + private final T9 v9; + private final T10 v10; + private final T11 v11; + private final T12 v12; + private final T13 v13; + + + public Tuple13(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13) { + super(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13); + + this.v1 = v1; + this.v2 = v2; + this.v3 = v3; + this.v4 = v4; + this.v5 = v5; + this.v6 = v6; + this.v7 = v7; + this.v8 = v8; + this.v9 = v9; + this.v10 = v10; + this.v11 = v11; + this.v12 = v12; + this.v13 = v13; + } + + public Tuple13(Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> tuple) { + this(tuple.v1, tuple.v2, tuple.v3, tuple.v4, tuple.v5, tuple.v6, tuple.v7, tuple.v8, tuple.v9, tuple.v10, tuple.v11, tuple.v12, tuple.v13); + } + + @Deprecated + public T1 getFirst() { + return v1; + } + + @Deprecated + public T2 getSecond() { + return v2; + } + + @Deprecated + public T3 getThird() { + return v3; + } + + @Deprecated + public T4 getFourth() { + return v4; + } + + @Deprecated + public T5 getFifth() { + return v5; + } + + @Deprecated + public T6 getSixth() { + return v6; + } + + @Deprecated + public T7 getSeventh() { + return v7; + } + + @Deprecated + public T8 getEighth() { + return v8; + } + + @Deprecated + public T9 getNinth() { + return v9; + } + + public T1 v1() { + return v1; + } + + public T2 v2() { + return v2; + } + + public T3 v3() { + return v3; + } + + public T4 v4() { + return v4; + } + + public T5 v5() { + return v5; + } + + public T6 v6() { + return v6; + } + + public T7 v7() { + return v7; + } + + public T8 v8() { + return v8; + } + + public T9 v9() { + return v9; + } + + public T10 v10() { + return v10; + } + + public T11 v11() { + return v11; + } + + public T12 v12() { + return v12; + } + + public T13 v13() { + return v13; + } + + /** + * Concatenate a value to this tuple. + */ + public final <T14> Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> concat(T14 value) { + return new Tuple14<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, value); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T14> Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> concat(Tuple1<T14> tuple) { + return new Tuple14<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, tuple.v1()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T14, T15> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> concat(Tuple2<T14, T15> tuple) { + return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, tuple.v1(), tuple.v2()); + } + + /** + * Concatenate a tuple to this tuple. + */ + public final <T14, T15, T16> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> concat(Tuple3<T14, T15, T16> tuple) { + return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, tuple.v1(), tuple.v2(), tuple.v3()); + } + + /** + * Split this tuple into two tuples of degree 0 and 13. + */ + public final Tuple2<Tuple0, Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>> split0() { + return new Tuple2<>(limit0(), skip0()); + } + + /** + * Split this tuple into two tuples of degree 1 and 12. + */ + public final Tuple2<Tuple1<T1>, Tuple12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>> split1() { + return new Tuple2<>(limit1(), skip1()); + } + + /** + * Split this tuple into two tuples of degree 2 and 11. + */ + public final Tuple2<Tuple2<T1, T2>, Tuple11<T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>> split2() { + return new Tuple2<>(limit2(), skip2()); + } + + /** + * Split this tuple into two tuples of degree 3 and 10. + */ + public final Tuple2<Tuple3<T1, T2, T3>, Tuple10<T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>> split3() { + return new Tuple2<>(limit3(), skip3()); + } + + /** + * Split this tuple into two tuples of degree 4 and 9. + */ + public final Tuple2<Tuple4<T1, T2, T3, T4>, Tuple9<T5, T6, T7, T8, T9, T10, T11, T12, T13>> split4() { + return new Tuple2<>(limit4(), skip4()); + } + + /** + * Split this tuple into two tuples of degree 5 and 8. + */ + public final Tuple2<Tuple5<T1, T2, T3, T4, T5>, Tuple8<T6, T7, T8, T9, T10, T11, T12, T13>> split5() { + return new Tuple2<>(limit5(), skip5()); + } + + /** + * Split this tuple into two tuples of degree 6 and 7. + */ + public final Tuple2<Tuple6<T1, T2, T3, T4, T5, T6>, Tuple7<T7, T8, T9, T10, T11, T12, T13>> split6() { + return new Tuple2<>(limit6(), skip6()); + } + + /** + * Split this tuple into two tuples of degree 7 and 6. + */ + public final Tuple2<Tuple7<T1, T2, T3, T4, T5, T6, T7>, Tuple6<T8, T9, T10, T11, T12, T13>> split7() { + return new Tuple2<>(limit7(), skip7()); + } + + /** + * Split this tuple into two tuples of degree 8 and 5. + */ + public final Tuple2<Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>, Tuple5<T9, T10, T11, T12, T13>> split8() { + return new Tuple2<>(limit8(), skip8()); + } + + /** + * Split this tuple into two tuples of degree 9 and 4. + */ + public final Tuple2<Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9>, Tuple4<T10, T11, T12, T13>> split9() { + return new Tuple2<>(limit9(), skip9()); + } + + /** + * Split this tuple into two tuples of degree 10 and 3. + */ + public final Tuple2<Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, Tuple3<T11, T12, T13>> split10() { + return new Tuple2<>(limit10(), skip10()); + } + + /** + * Split this tuple into two tuples of degree 11 and 2. + */ + public final Tuple2<Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, Tuple2<T12, T13>> split11() { + return new Tuple2<>(limit11(), skip11()); + } + + /** + * Split this tuple into two tuples of degree 12 and 1. + */ + public final Tuple2<Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, Tuple1<T13>> split12() { + return new Tuple2<>(limit12(), skip12()); + } + + /** + * Split this tuple into two tuples of degree 13 and 0. + */ + public final Tuple2<Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, Tuple0> split13() { + return new Tuple2<>(limit13(), skip13()); + } + + /** + * Limit this tuple to degree 0. + */ + public final Tuple0 limit0() { + return new Tuple0(); + } + + /** + * 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 this; + } + + /** + * Skip 0 degrees from this tuple. + */ + public final Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> skip0() { + return this; + } + + /** + * Skip 1 degrees from this tuple. + */ + public final Tuple12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> skip1() { + return new Tuple12<>(v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13); + } + + /** + * Skip 2 degrees from this tuple. + */ + public final Tuple11<T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> skip2() { + return new Tuple11<>(v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13); + } + + /** + * Skip 3 degrees from this tuple. + */ + public final Tuple10<T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> skip3() { + return new Tuple10<>(v4, v5, v6, v7, v8, v9, v10, v11, v12, v13); + } + + /** + * Skip 4 degrees from this tuple. + */ + public final Tuple9<T5, T6, T7, T8, T9, T10, T11, T12, T13> skip4() { + return new Tuple9<>(v5, v6, v7, v8, v9, v10, v11, v12, v13); + } + + /** + * Skip 5 degrees from this tuple. + */ + public final Tuple8<T6, T7, T8, T9, T10, T11, T12, T13> skip5() { + return new Tuple8<>(v6, v7, v8, v9, v10, v11, v12, v13); + } + + /** + * Skip 6 degrees from this tuple. + */ + public final Tuple7<T7, T8, T9, T10, T11, T12, T13> skip6() { + return new Tuple7<>(v7, v8, v9, v10, v11, v12, v13); + } + + /** + * Skip 7 degrees from this tuple. + */ + public final Tuple6<T8, T9, T10, T11, T12, T13> skip7() { + return new Tuple6<>(v8, v9, v10, v11, v12, v13); + } + + /** + * Skip 8 degrees from this tuple. + */ + public final Tuple5<T9, T10, T11, T12, T13> skip8() { + return new Tuple5<>(v9, v10, v11, v12, v13); + } + + /** + * Skip 9 degrees from this tuple. + */ + public final Tuple4<T10, T11, T12, T13> skip9() { + return new Tuple4<>(v10, v11, v12, v13); + } + + /** + * Skip 10 degrees from this tuple. + */ + public final Tuple3<T11, T12, T13> skip10() { + return new Tuple3<>(v11, v12, v13); + } + + /** + * Skip 11 degrees from this tuple. + */ + public final Tuple2<T12, T13> skip11() { + return new Tuple2<>(v12, v13); + } + + /** + * Skip 12 degrees from this tuple. + */ + public final Tuple1<T13> skip12() { + return new Tuple1<>(v13); + } + + /** + * Skip 13 degrees from this tuple. + */ + public final Tuple0 skip13() { + return new Tuple0(); + } + + /** + * Apply this tuple as arguments to a function. + */ + public final <R> R map(Function13<? 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, ? extends R> function) { + return function.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13); + } + + /** + * Apply attribute 1 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U1> Tuple13<U1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> map1(Function1<? super T1, ? extends U1> function) { + return new Tuple13<>(function.apply(v1), v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13); + } + + /** + * Apply attribute 2 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U2> Tuple13<T1, U2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> map2(Function1<? super T2, ? extends U2> function) { + return new Tuple13<>(v1, function.apply(v2), v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13); + } + + /** + * Apply attribute 3 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U3> Tuple13<T1, T2, U3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> map3(Function1<? super T3, ? extends U3> function) { + return new Tuple13<>(v1, v2, function.apply(v3), v4, v5, v6, v7, v8, v9, v10, v11, v12, v13); + } + + /** + * Apply attribute 4 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U4> Tuple13<T1, T2, T3, U4, T5, T6, T7, T8, T9, T10, T11, T12, T13> map4(Function1<? super T4, ? extends U4> function) { + return new Tuple13<>(v1, v2, v3, function.apply(v4), v5, v6, v7, v8, v9, v10, v11, v12, v13); + } + + /** + * Apply attribute 5 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U5> Tuple13<T1, T2, T3, T4, U5, T6, T7, T8, T9, T10, T11, T12, T13> map5(Function1<? super T5, ? extends U5> function) { + return new Tuple13<>(v1, v2, v3, v4, function.apply(v5), v6, v7, v8, v9, v10, v11, v12, v13); + } + + /** + * Apply attribute 6 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U6> Tuple13<T1, T2, T3, T4, T5, U6, T7, T8, T9, T10, T11, T12, T13> map6(Function1<? super T6, ? extends U6> function) { + return new Tuple13<>(v1, v2, v3, v4, v5, function.apply(v6), v7, v8, v9, v10, v11, v12, v13); + } + + /** + * Apply attribute 7 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U7> Tuple13<T1, T2, T3, T4, T5, T6, U7, T8, T9, T10, T11, T12, T13> map7(Function1<? super T7, ? extends U7> function) { + return new Tuple13<>(v1, v2, v3, v4, v5, v6, function.apply(v7), v8, v9, v10, v11, v12, v13); + } + + /** + * Apply attribute 8 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U8> Tuple13<T1, T2, T3, T4, T5, T6, T7, U8, T9, T10, T11, T12, T13> map8(Function1<? super T8, ? extends U8> function) { + return new Tuple13<>(v1, v2, v3, v4, v5, v6, v7, function.apply(v8), v9, v10, v11, v12, v13); + } + + /** + * Apply attribute 9 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U9> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, U9, T10, T11, T12, T13> map9(Function1<? super T9, ? extends U9> function) { + return new Tuple13<>(v1, v2, v3, v4, v5, v6, v7, v8, function.apply(v9), v10, v11, v12, v13); + } + + /** + * Apply attribute 10 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U10> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, U10, T11, T12, T13> map10(Function1<? super T10, ? extends U10> function) { + return new Tuple13<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, function.apply(v10), v11, v12, v13); + } + + /** + * Apply attribute 11 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U11> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, U11, T12, T13> map11(Function1<? super T11, ? extends U11> function) { + return new Tuple13<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, function.apply(v11), v12, v13); + } + + /** + * Apply attribute 12 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U12> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, U12, T13> map12(Function1<? super T12, ? extends U12> function) { + return new Tuple13<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, function.apply(v12), v13); + } + + /** + * Apply attribute 13 as argument to a function and return a new tuple with the substituted argument. + */ + public final <U13> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, U13> map13(Function1<? super T13, ? extends U13> function) { + return new Tuple13<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, function.apply(v13)); + } + + + @Override + public Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> clone() { + return new Tuple13<>(this); + } +}
