Skip to content

Commit

Permalink
[FLINK-2359] [java api] Add factory methods to the Java TupleX types
Browse files Browse the repository at this point in the history
This closes #911
  • Loading branch information
ggevay authored and fhueske committed Jul 17, 2015
1 parent 08ca9ff commit 2d191ab
Show file tree
Hide file tree
Showing 31 changed files with 369 additions and 52 deletions.
Expand Up @@ -1064,4 +1064,4 @@ public <T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T1
}

// END_OF_TUPLE_DEPENDENT_CODE
}
}
Expand Up @@ -1323,7 +1323,7 @@ protected JoinProjection<I1, I2> projectSecond(int... secondFieldIndexes) {

/**
* Chooses a projectTupleX according to the length of
* {@link org.apache.flink.api.java.operators.JoinOperator.JoinProjection#fieldIndexes}
* {@link org.apache.flink.api.java.operators.JoinOperator.JoinProjection#fieldIndexes}
*
* @return The projected DataSet.
*
Expand Down
Expand Up @@ -108,7 +108,5 @@ public static Class<? extends Tuple> getTupleClass(int arity) {
private static final Class<?>[] CLASSES = new Class<?>[] {
Tuple1.class, Tuple2.class, Tuple3.class, Tuple4.class, Tuple5.class, Tuple6.class, Tuple7.class, Tuple8.class, Tuple9.class, Tuple10.class, Tuple11.class, Tuple12.class, Tuple13.class, Tuple14.class, Tuple15.class, Tuple16.class, Tuple17.class, Tuple18.class, Tuple19.class, Tuple20.class, Tuple21.class, Tuple22.class, Tuple23.class, Tuple24.class, Tuple25.class
};


// END_OF_TUPLE_DEPENDENT_CODE
}
Expand Up @@ -133,8 +133,20 @@ public int hashCode() {
/**
* Shallow tuple copy.
* @return A new Tuple with the same fields as this.
*/
*/
public Tuple1<T0> copy(){
return new Tuple1<T0>(this.f0);
}

/**
* Creates a new tuple and assigns the given values to the tuple's fields.
* This is more convenient than using the constructor, because the compiler can
* infer the generic type arguments implicitly. For example:
* {@code Tuple3.of(n, x, s)}
* instead of
* {@code new Tuple3<Integer, Double, String>(n, x, s)}
*/
public static <T0> Tuple1<T0> of(T0 value0) {
return new Tuple1<T0>(value0);
}
}
Expand Up @@ -259,7 +259,7 @@ public int hashCode() {
/**
* Shallow tuple copy.
* @return A new Tuple with the same fields as this.
*/
*/
public Tuple10<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> copy(){
return new Tuple10<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9>(this.f0,
this.f1,
Expand All @@ -272,4 +272,16 @@ public Tuple10<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> copy(){
this.f8,
this.f9);
}

/**
* Creates a new tuple and assigns the given values to the tuple's fields.
* This is more convenient than using the constructor, because the compiler can
* infer the generic type arguments implicitly. For example:
* {@code Tuple3.of(n, x, s)}
* instead of
* {@code new Tuple3<Integer, Double, String>(n, x, s)}
*/
public static <T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> Tuple10<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> of(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9) {
return new Tuple10<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9>(value0, value1, value2, value3, value4, value5, value6, value7, value8, value9);
}
}
Expand Up @@ -273,7 +273,7 @@ public int hashCode() {
/**
* Shallow tuple copy.
* @return A new Tuple with the same fields as this.
*/
*/
public Tuple11<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> copy(){
return new Tuple11<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>(this.f0,
this.f1,
Expand All @@ -287,4 +287,16 @@ public Tuple11<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> copy(){
this.f9,
this.f10);
}

/**
* Creates a new tuple and assigns the given values to the tuple's fields.
* This is more convenient than using the constructor, because the compiler can
* infer the generic type arguments implicitly. For example:
* {@code Tuple3.of(n, x, s)}
* instead of
* {@code new Tuple3<Integer, Double, String>(n, x, s)}
*/
public static <T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> Tuple11<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> of(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10) {
return new Tuple11<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>(value0, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10);
}
}
Expand Up @@ -287,7 +287,7 @@ public int hashCode() {
/**
* Shallow tuple copy.
* @return A new Tuple with the same fields as this.
*/
*/
public Tuple12<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> copy(){
return new Tuple12<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>(this.f0,
this.f1,
Expand All @@ -302,4 +302,16 @@ public Tuple12<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> copy(){
this.f10,
this.f11);
}

/**
* Creates a new tuple and assigns the given values to the tuple's fields.
* This is more convenient than using the constructor, because the compiler can
* infer the generic type arguments implicitly. For example:
* {@code Tuple3.of(n, x, s)}
* instead of
* {@code new Tuple3<Integer, Double, String>(n, x, s)}
*/
public static <T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> Tuple12<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> of(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10, T11 value11) {
return new Tuple12<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>(value0, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11);
}
}
Expand Up @@ -301,7 +301,7 @@ public int hashCode() {
/**
* Shallow tuple copy.
* @return A new Tuple with the same fields as this.
*/
*/
public Tuple13<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> copy(){
return new Tuple13<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>(this.f0,
this.f1,
Expand All @@ -317,4 +317,16 @@ public Tuple13<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> copy(){
this.f11,
this.f12);
}

/**
* Creates a new tuple and assigns the given values to the tuple's fields.
* This is more convenient than using the constructor, because the compiler can
* infer the generic type arguments implicitly. For example:
* {@code Tuple3.of(n, x, s)}
* instead of
* {@code new Tuple3<Integer, Double, String>(n, x, s)}
*/
public static <T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> Tuple13<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> of(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10, T11 value11, T12 value12) {
return new Tuple13<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>(value0, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12);
}
}
Expand Up @@ -315,7 +315,7 @@ public int hashCode() {
/**
* Shallow tuple copy.
* @return A new Tuple with the same fields as this.
*/
*/
public Tuple14<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> copy(){
return new Tuple14<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>(this.f0,
this.f1,
Expand All @@ -332,4 +332,16 @@ public Tuple14<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> copy(){
this.f12,
this.f13);
}

/**
* Creates a new tuple and assigns the given values to the tuple's fields.
* This is more convenient than using the constructor, because the compiler can
* infer the generic type arguments implicitly. For example:
* {@code Tuple3.of(n, x, s)}
* instead of
* {@code new Tuple3<Integer, Double, String>(n, x, s)}
*/
public static <T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> Tuple14<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> of(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10, T11 value11, T12 value12, T13 value13) {
return new Tuple14<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>(value0, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13);
}
}
Expand Up @@ -329,7 +329,7 @@ public int hashCode() {
/**
* Shallow tuple copy.
* @return A new Tuple with the same fields as this.
*/
*/
public Tuple15<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> copy(){
return new Tuple15<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>(this.f0,
this.f1,
Expand All @@ -347,4 +347,16 @@ public Tuple15<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> copy(){
this.f13,
this.f14);
}

/**
* Creates a new tuple and assigns the given values to the tuple's fields.
* This is more convenient than using the constructor, because the compiler can
* infer the generic type arguments implicitly. For example:
* {@code Tuple3.of(n, x, s)}
* instead of
* {@code new Tuple3<Integer, Double, String>(n, x, s)}
*/
public static <T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> Tuple15<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> of(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10, T11 value11, T12 value12, T13 value13, T14 value14) {
return new Tuple15<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>(value0, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13, value14);
}
}
Expand Up @@ -343,7 +343,7 @@ public int hashCode() {
/**
* Shallow tuple copy.
* @return A new Tuple with the same fields as this.
*/
*/
public Tuple16<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> copy(){
return new Tuple16<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>(this.f0,
this.f1,
Expand All @@ -362,4 +362,16 @@ public Tuple16<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> copy(){
this.f14,
this.f15);
}

/**
* Creates a new tuple and assigns the given values to the tuple's fields.
* This is more convenient than using the constructor, because the compiler can
* infer the generic type arguments implicitly. For example:
* {@code Tuple3.of(n, x, s)}
* instead of
* {@code new Tuple3<Integer, Double, String>(n, x, s)}
*/
public static <T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> Tuple16<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> of(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10, T11 value11, T12 value12, T13 value13, T14 value14, T15 value15) {
return new Tuple16<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>(value0, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13, value14, value15);
}
}
Expand Up @@ -357,7 +357,7 @@ public int hashCode() {
/**
* Shallow tuple copy.
* @return A new Tuple with the same fields as this.
*/
*/
public Tuple17<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> copy(){
return new Tuple17<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>(this.f0,
this.f1,
Expand All @@ -377,4 +377,16 @@ public Tuple17<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> copy()
this.f15,
this.f16);
}

/**
* Creates a new tuple and assigns the given values to the tuple's fields.
* This is more convenient than using the constructor, because the compiler can
* infer the generic type arguments implicitly. For example:
* {@code Tuple3.of(n, x, s)}
* instead of
* {@code new Tuple3<Integer, Double, String>(n, x, s)}
*/
public static <T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> Tuple17<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> of(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10, T11 value11, T12 value12, T13 value13, T14 value14, T15 value15, T16 value16) {
return new Tuple17<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>(value0, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13, value14, value15, value16);
}
}
Expand Up @@ -371,7 +371,7 @@ public int hashCode() {
/**
* Shallow tuple copy.
* @return A new Tuple with the same fields as this.
*/
*/
public Tuple18<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17> copy(){
return new Tuple18<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17>(this.f0,
this.f1,
Expand All @@ -392,4 +392,16 @@ public Tuple18<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17> co
this.f16,
this.f17);
}

/**
* Creates a new tuple and assigns the given values to the tuple's fields.
* This is more convenient than using the constructor, because the compiler can
* infer the generic type arguments implicitly. For example:
* {@code Tuple3.of(n, x, s)}
* instead of
* {@code new Tuple3<Integer, Double, String>(n, x, s)}
*/
public static <T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17> Tuple18<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17> of(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10, T11 value11, T12 value12, T13 value13, T14 value14, T15 value15, T16 value16, T17 value17) {
return new Tuple18<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17>(value0, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13, value14, value15, value16, value17);
}
}
Expand Up @@ -385,7 +385,7 @@ public int hashCode() {
/**
* Shallow tuple copy.
* @return A new Tuple with the same fields as this.
*/
*/
public Tuple19<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18> copy(){
return new Tuple19<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18>(this.f0,
this.f1,
Expand All @@ -407,4 +407,16 @@ public Tuple19<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18
this.f17,
this.f18);
}

/**
* Creates a new tuple and assigns the given values to the tuple's fields.
* This is more convenient than using the constructor, because the compiler can
* infer the generic type arguments implicitly. For example:
* {@code Tuple3.of(n, x, s)}
* instead of
* {@code new Tuple3<Integer, Double, String>(n, x, s)}
*/
public static <T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18> Tuple19<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18> of(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10, T11 value11, T12 value12, T13 value13, T14 value14, T15 value15, T16 value16, T17 value17, T18 value18) {
return new Tuple19<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18>(value0, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13, value14, value15, value16, value17, value18);
}
}
Expand Up @@ -155,9 +155,21 @@ public int hashCode() {
/**
* Shallow tuple copy.
* @return A new Tuple with the same fields as this.
*/
*/
public Tuple2<T0,T1> copy(){
return new Tuple2<T0,T1>(this.f0,
this.f1);
}

/**
* Creates a new tuple and assigns the given values to the tuple's fields.
* This is more convenient than using the constructor, because the compiler can
* infer the generic type arguments implicitly. For example:
* {@code Tuple3.of(n, x, s)}
* instead of
* {@code new Tuple3<Integer, Double, String>(n, x, s)}
*/
public static <T0,T1> Tuple2<T0,T1> of(T0 value0, T1 value1) {
return new Tuple2<T0,T1>(value0, value1);
}
}
Expand Up @@ -399,7 +399,7 @@ public int hashCode() {
/**
* Shallow tuple copy.
* @return A new Tuple with the same fields as this.
*/
*/
public Tuple20<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19> copy(){
return new Tuple20<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19>(this.f0,
this.f1,
Expand All @@ -422,4 +422,16 @@ public Tuple20<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18
this.f18,
this.f19);
}

/**
* Creates a new tuple and assigns the given values to the tuple's fields.
* This is more convenient than using the constructor, because the compiler can
* infer the generic type arguments implicitly. For example:
* {@code Tuple3.of(n, x, s)}
* instead of
* {@code new Tuple3<Integer, Double, String>(n, x, s)}
*/
public static <T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19> Tuple20<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19> of(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10, T11 value11, T12 value12, T13 value13, T14 value14, T15 value15, T16 value16, T17 value17, T18 value18, T19 value19) {
return new Tuple20<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19>(value0, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13, value14, value15, value16, value17, value18, value19);
}
}
Expand Up @@ -413,7 +413,7 @@ public int hashCode() {
/**
* Shallow tuple copy.
* @return A new Tuple with the same fields as this.
*/
*/
public Tuple21<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20> copy(){
return new Tuple21<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20>(this.f0,
this.f1,
Expand All @@ -437,4 +437,16 @@ public Tuple21<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18
this.f19,
this.f20);
}

/**
* Creates a new tuple and assigns the given values to the tuple's fields.
* This is more convenient than using the constructor, because the compiler can
* infer the generic type arguments implicitly. For example:
* {@code Tuple3.of(n, x, s)}
* instead of
* {@code new Tuple3<Integer, Double, String>(n, x, s)}
*/
public static <T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20> Tuple21<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20> of(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10, T11 value11, T12 value12, T13 value13, T14 value14, T15 value15, T16 value16, T17 value17, T18 value18, T19 value19, T20 value20) {
return new Tuple21<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20>(value0, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13, value14, value15, value16, value17, value18, value19, value20);
}
}

0 comments on commit 2d191ab

Please sign in to comment.