[FLINK-3303] [core] Move Tuple classes to flink-core
Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/7081836e Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/7081836e Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/7081836e Branch: refs/heads/master Commit: 7081836e0d640ee640687606bd73b6673d3f2a07 Parents: 5474386 Author: Stephan Ewen <se...@apache.org> Authored: Sun Jan 31 23:08:18 2016 +0100 Committer: Stephan Ewen <se...@apache.org> Committed: Tue Feb 2 16:55:44 2016 +0100 ---------------------------------------------------------------------- .../org/apache/flink/api/java/tuple/Tuple.java | 118 +++ .../org/apache/flink/api/java/tuple/Tuple0.java | 98 +++ .../org/apache/flink/api/java/tuple/Tuple1.java | 154 ++++ .../apache/flink/api/java/tuple/Tuple10.java | 289 ++++++ .../apache/flink/api/java/tuple/Tuple11.java | 304 +++++++ .../apache/flink/api/java/tuple/Tuple12.java | 319 +++++++ .../apache/flink/api/java/tuple/Tuple13.java | 334 +++++++ .../apache/flink/api/java/tuple/Tuple14.java | 349 ++++++++ .../apache/flink/api/java/tuple/Tuple15.java | 364 ++++++++ .../apache/flink/api/java/tuple/Tuple16.java | 379 ++++++++ .../apache/flink/api/java/tuple/Tuple17.java | 394 +++++++++ .../apache/flink/api/java/tuple/Tuple18.java | 409 +++++++++ .../apache/flink/api/java/tuple/Tuple19.java | 424 +++++++++ .../org/apache/flink/api/java/tuple/Tuple2.java | 177 ++++ .../apache/flink/api/java/tuple/Tuple20.java | 439 +++++++++ .../apache/flink/api/java/tuple/Tuple21.java | 454 ++++++++++ .../apache/flink/api/java/tuple/Tuple22.java | 469 ++++++++++ .../apache/flink/api/java/tuple/Tuple23.java | 484 ++++++++++ .../apache/flink/api/java/tuple/Tuple24.java | 499 +++++++++++ .../apache/flink/api/java/tuple/Tuple25.java | 514 +++++++++++ .../org/apache/flink/api/java/tuple/Tuple3.java | 184 ++++ .../org/apache/flink/api/java/tuple/Tuple4.java | 199 +++++ .../org/apache/flink/api/java/tuple/Tuple5.java | 214 +++++ .../org/apache/flink/api/java/tuple/Tuple6.java | 229 +++++ .../org/apache/flink/api/java/tuple/Tuple7.java | 244 +++++ .../org/apache/flink/api/java/tuple/Tuple8.java | 259 ++++++ .../org/apache/flink/api/java/tuple/Tuple9.java | 274 ++++++ .../api/java/tuple/builder/Tuple0Builder.java | 46 + .../api/java/tuple/builder/Tuple10Builder.java | 46 + .../api/java/tuple/builder/Tuple11Builder.java | 46 + .../api/java/tuple/builder/Tuple12Builder.java | 46 + .../api/java/tuple/builder/Tuple13Builder.java | 46 + .../api/java/tuple/builder/Tuple14Builder.java | 46 + .../api/java/tuple/builder/Tuple15Builder.java | 46 + .../api/java/tuple/builder/Tuple16Builder.java | 46 + .../api/java/tuple/builder/Tuple17Builder.java | 46 + .../api/java/tuple/builder/Tuple18Builder.java | 46 + .../api/java/tuple/builder/Tuple19Builder.java | 46 + .../api/java/tuple/builder/Tuple1Builder.java | 46 + .../api/java/tuple/builder/Tuple20Builder.java | 46 + .../api/java/tuple/builder/Tuple21Builder.java | 46 + .../api/java/tuple/builder/Tuple22Builder.java | 46 + .../api/java/tuple/builder/Tuple23Builder.java | 46 + .../api/java/tuple/builder/Tuple24Builder.java | 46 + .../api/java/tuple/builder/Tuple25Builder.java | 46 + .../api/java/tuple/builder/Tuple2Builder.java | 46 + .../api/java/tuple/builder/Tuple3Builder.java | 46 + .../api/java/tuple/builder/Tuple4Builder.java | 46 + .../api/java/tuple/builder/Tuple5Builder.java | 46 + .../api/java/tuple/builder/Tuple6Builder.java | 46 + .../api/java/tuple/builder/Tuple7Builder.java | 46 + .../api/java/tuple/builder/Tuple8Builder.java | 46 + .../api/java/tuple/builder/Tuple9Builder.java | 46 + .../flink/api/java/tuple/TupleGenerator.java | 521 +++++++++++ .../org/apache/flink/api/java/tuple/Tuple.java | 118 --- .../org/apache/flink/api/java/tuple/Tuple0.java | 98 --- .../org/apache/flink/api/java/tuple/Tuple1.java | 154 ---- .../apache/flink/api/java/tuple/Tuple10.java | 289 ------ .../apache/flink/api/java/tuple/Tuple11.java | 304 ------- .../apache/flink/api/java/tuple/Tuple12.java | 319 ------- .../apache/flink/api/java/tuple/Tuple13.java | 334 ------- .../apache/flink/api/java/tuple/Tuple14.java | 349 -------- .../apache/flink/api/java/tuple/Tuple15.java | 364 -------- .../apache/flink/api/java/tuple/Tuple16.java | 379 -------- .../apache/flink/api/java/tuple/Tuple17.java | 394 --------- .../apache/flink/api/java/tuple/Tuple18.java | 409 --------- .../apache/flink/api/java/tuple/Tuple19.java | 424 --------- .../org/apache/flink/api/java/tuple/Tuple2.java | 177 ---- .../apache/flink/api/java/tuple/Tuple20.java | 439 --------- .../apache/flink/api/java/tuple/Tuple21.java | 454 ---------- .../apache/flink/api/java/tuple/Tuple22.java | 469 ---------- .../apache/flink/api/java/tuple/Tuple23.java | 484 ---------- .../apache/flink/api/java/tuple/Tuple24.java | 499 ----------- .../apache/flink/api/java/tuple/Tuple25.java | 514 ----------- .../org/apache/flink/api/java/tuple/Tuple3.java | 184 ---- .../org/apache/flink/api/java/tuple/Tuple4.java | 199 ----- .../org/apache/flink/api/java/tuple/Tuple5.java | 214 ----- .../org/apache/flink/api/java/tuple/Tuple6.java | 229 ----- .../org/apache/flink/api/java/tuple/Tuple7.java | 244 ----- .../org/apache/flink/api/java/tuple/Tuple8.java | 259 ------ .../org/apache/flink/api/java/tuple/Tuple9.java | 274 ------ .../flink/api/java/tuple/TupleGenerator.java | 879 ------------------- .../api/java/tuple/builder/Tuple0Builder.java | 46 - .../api/java/tuple/builder/Tuple10Builder.java | 46 - .../api/java/tuple/builder/Tuple11Builder.java | 46 - .../api/java/tuple/builder/Tuple12Builder.java | 46 - .../api/java/tuple/builder/Tuple13Builder.java | 46 - .../api/java/tuple/builder/Tuple14Builder.java | 46 - .../api/java/tuple/builder/Tuple15Builder.java | 46 - .../api/java/tuple/builder/Tuple16Builder.java | 46 - .../api/java/tuple/builder/Tuple17Builder.java | 46 - .../api/java/tuple/builder/Tuple18Builder.java | 46 - .../api/java/tuple/builder/Tuple19Builder.java | 46 - .../api/java/tuple/builder/Tuple1Builder.java | 46 - .../api/java/tuple/builder/Tuple20Builder.java | 46 - .../api/java/tuple/builder/Tuple21Builder.java | 46 - .../api/java/tuple/builder/Tuple22Builder.java | 46 - .../api/java/tuple/builder/Tuple23Builder.java | 46 - .../api/java/tuple/builder/Tuple24Builder.java | 46 - .../api/java/tuple/builder/Tuple25Builder.java | 46 - .../api/java/tuple/builder/Tuple2Builder.java | 46 - .../api/java/tuple/builder/Tuple3Builder.java | 46 - .../api/java/tuple/builder/Tuple4Builder.java | 46 - .../api/java/tuple/builder/Tuple5Builder.java | 46 - .../api/java/tuple/builder/Tuple6Builder.java | 46 - .../api/java/tuple/builder/Tuple7Builder.java | 46 - .../api/java/tuple/builder/Tuple8Builder.java | 46 - .../api/java/tuple/builder/Tuple9Builder.java | 46 - .../apache/flink/api/java/tuple/Tuple2Test.java | 4 +- .../flink/api/java/tuple/TupleGenerator.java | 498 +++++++++++ 110 files changed, 10791 insertions(+), 10651 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/7081836e/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple.java ---------------------------------------------------------------------- diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple.java new file mode 100644 index 0000000..71b1f61 --- /dev/null +++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple.java @@ -0,0 +1,118 @@ +/* + * 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 org.apache.flink.api.java.tuple; + +import org.apache.flink.types.NullFieldException; + + +/** + * The base class of all tuples. Tuples have a fix length and contain a set of fields, + * which may all be of different types. Because Tuples are strongly typed, each distinct + * tuple length is represented by its own class. Tuples exists with up to 25 fields and + * are described in the classes {@link Tuple1} to {@link Tuple25}. + * <p> + * The fields in the tuples may be accessed directly a public fields, or via position (zero indexed) + * {@link #getField(int)}. + * <p> + * Tuples are in principle serializable. However, they may contain non-serializable fields, + * in which case serialization will fail. + */ +public abstract class Tuple implements java.io.Serializable { + + private static final long serialVersionUID = 1L; + + public static final int MAX_ARITY = 25; + + + /** + * Gets the field at the specified position. + * + * @param pos The position of the field, zero indexed. + * @return The field at the specified position. + * @throws IndexOutOfBoundsException Thrown, if the position is negative, or equal to, or larger than the number of fields. + */ + public abstract <T> T getField(int pos); + + /** + * Gets the field at the specified position, throws NullFieldException if the field is null. Used for comparing key fields. + * + * @param pos The position of the field, zero indexed. + * @return The field at the specified position. + * @throws IndexOutOfBoundsException Thrown, if the position is negative, or equal to, or larger than the number of fields. + * @throws NullFieldException Thrown, if the field at pos is null. + */ + public <T> T getFieldNotNull(int pos){ + T field = getField(pos); + if (field != null) { + return field; + } else { + throw new NullFieldException(pos); + } + } + + /** + * Sets the field at the specified position. + * + * @param value The value to be assigned to the field at the specified position. + * @param pos The position of the field, zero indexed. + * @throws IndexOutOfBoundsException Thrown, if the position is negative, or equal to, or larger than the number of fields. + */ + public abstract <T> void setField(T value, int pos); + + /** + * Gets the number of field in the tuple (the tuple arity). + * + * @return The number of fields in the tuple. + */ + public abstract int getArity(); + + /** + * Shallow tuple copy. + * @return A new Tuple with the same fields as this. + */ + public abstract <T extends Tuple> T copy(); + + // -------------------------------------------------------------------------------------------- + + /** + * Gets the class corresponding to the tuple of the given arity (dimensions). For + * example, {@code getTupleClass(3)} will return the {@code Tuple3.class}. + * + * @param arity The arity of the tuple class to get. + * @return The tuple class with the given arity. + */ + @SuppressWarnings("unchecked") + public static Class<? extends Tuple> getTupleClass(int arity) { + if (arity < 0 || arity > MAX_ARITY) { + throw new IllegalArgumentException("The tuple arity must be in [0, " + MAX_ARITY + "]."); + } + return (Class<? extends Tuple>) CLASSES[arity]; + } + + // -------------------------------------------------------------------------------------------- + // The following lines are generated. + // -------------------------------------------------------------------------------------------- + + // BEGIN_OF_TUPLE_DEPENDENT_CODE + // GENERATED FROM org.apache.flink.api.java.tuple.TupleGenerator. + private static final Class<?>[] CLASSES = new Class<?>[] { + Tuple0.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 +} http://git-wip-us.apache.org/repos/asf/flink/blob/7081836e/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple0.java ---------------------------------------------------------------------- diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple0.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple0.java new file mode 100644 index 0000000..c3386dc --- /dev/null +++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple0.java @@ -0,0 +1,98 @@ +/** + * 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 org.apache.flink.api.java.tuple; + +import java.io.ObjectStreamException; + +/** + * A tuple with 0 fields. + * + * <p>The Tuple0 is a soft singleton, i.e., there is a "singleton" instance, but it does + * not prevent creation of additional instances.</p> + * + * @see Tuple + */ +public class Tuple0 extends Tuple { + private static final long serialVersionUID = 1L; + + /** An immutable reusable Tuple0 instance */ + public static final Tuple0 INSTANCE = new Tuple0(); + + // ------------------------------------------------------------------------ + + @Override + public int getArity() { + return 0; + } + + @Override + public <T> T getField(int pos) { + throw new IndexOutOfBoundsException(String.valueOf(pos)); + } + + @Override + public <T> void setField(T value, int pos) { + throw new IndexOutOfBoundsException(String.valueOf(pos)); + } + + /** + * Shallow tuple copy. + * @return A new Tuple with the same fields as this. + */ + @Override + @SuppressWarnings("unchecked") + public Tuple0 copy(){ + return new Tuple0(); + } + + // ------------------------------------------------------------------------------------------------- + // standard utilities + // ------------------------------------------------------------------------------------------------- + + /** + * Creates a string representation of the tuple in the form "()" + * + * @return The string representation of the tuple. + */ + @Override + public String toString() { + return "()"; + } + + /** + * Deep equality for tuples by calling equals() on the tuple members + * + * @param o + * the object checked for equality + * @return true if this is equal to o. + */ + @Override + public boolean equals(Object o) { + return this == o || o instanceof Tuple0; + } + + @Override + public int hashCode() { + return 0; + } + + // singleton deserialization + private Object readResolve() throws ObjectStreamException { + return INSTANCE; + } +} http://git-wip-us.apache.org/repos/asf/flink/blob/7081836e/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple1.java ---------------------------------------------------------------------- diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple1.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple1.java new file mode 100644 index 0000000..01c5501 --- /dev/null +++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple1.java @@ -0,0 +1,154 @@ +/* + * 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. + */ + + +// -------------------------------------------------------------- +// THIS IS A GENERATED SOURCE FILE. DO NOT EDIT! +// GENERATED FROM org.apache.flink.api.java.tuple.TupleGenerator. +// -------------------------------------------------------------- + + +package org.apache.flink.api.java.tuple; + +import org.apache.flink.util.StringUtils; + +/** + * A tuple with 1 fields. Tuples are strongly typed; each field may be of a separate type. + * The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position + * through the {@link #getField(int)} method. The tuple field positions start at zero. + * <p> + * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work + * with Tuples to reuse objects in order to reduce pressure on the garbage collector. + * + * @see Tuple + * + * @param <T0> The type of field 0 + */ +public class Tuple1<T0> extends Tuple { + + private static final long serialVersionUID = 1L; + + /** Field 0 of the tuple. */ + public T0 f0; + + /** + * Creates a new tuple where all fields are null. + */ + public Tuple1() {} + + /** + * Creates a new tuple and assigns the given values to the tuple's fields. + * + * @param value0 The value for field 0 + */ + public Tuple1(T0 value0) { + this.f0 = value0; + } + + @Override + public int getArity() { return 1; } + + @Override + @SuppressWarnings("unchecked") + public <T> T getField(int pos) { + switch(pos) { + case 0: return (T) this.f0; + default: throw new IndexOutOfBoundsException(String.valueOf(pos)); + } + } + + @Override + @SuppressWarnings("unchecked") + public <T> void setField(T value, int pos) { + switch(pos) { + case 0: + this.f0 = (T0) value; + break; + default: throw new IndexOutOfBoundsException(String.valueOf(pos)); + } + } + + /** + * Sets new values to all fields of the tuple. + * + * @param value0 The value for field 0 + */ + public void setFields(T0 value0) { + this.f0 = value0; + } + + + // ------------------------------------------------------------------------------------------------- + // standard utilities + // ------------------------------------------------------------------------------------------------- + + /** + * Creates a string representation of the tuple in the form + * (f0), + * where the individual fields are the value returned by calling {@link Object#toString} on that field. + * @return The string representation of the tuple. + */ + @Override + public String toString() { + return "(" + StringUtils.arrayAwareToString(this.f0) + + ")"; + } + + /** + * Deep equality for tuples by calling equals() on the tuple members + * @param o the object checked for equality + * @return true if this is equal to o. + */ + @Override + public boolean equals(Object o) { + if(this == o) { return true; } + if (!(o instanceof Tuple1)) { return false; } + @SuppressWarnings("rawtypes") + Tuple1 tuple = (Tuple1) o; + if (f0 != null ? !f0.equals(tuple.f0) : tuple.f0 != null) { return false; } + return true; + } + + @Override + public int hashCode() { + int result = f0 != null ? f0.hashCode() : 0; + return result; + } + + /** + * Shallow tuple copy. + * @return A new Tuple with the same fields as this. + */ + @Override + @SuppressWarnings("unchecked") + 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); + } +} http://git-wip-us.apache.org/repos/asf/flink/blob/7081836e/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple10.java ---------------------------------------------------------------------- diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple10.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple10.java new file mode 100644 index 0000000..ea24f40 --- /dev/null +++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple10.java @@ -0,0 +1,289 @@ +/* + * 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. + */ + + +// -------------------------------------------------------------- +// THIS IS A GENERATED SOURCE FILE. DO NOT EDIT! +// GENERATED FROM org.apache.flink.api.java.tuple.TupleGenerator. +// -------------------------------------------------------------- + + +package org.apache.flink.api.java.tuple; + +import org.apache.flink.util.StringUtils; + +/** + * A tuple with 10 fields. Tuples are strongly typed; each field may be of a separate type. + * The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position + * through the {@link #getField(int)} method. The tuple field positions start at zero. + * <p> + * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work + * with Tuples to reuse objects in order to reduce pressure on the garbage collector. + * + * @see Tuple + * + * @param <T0> The type of field 0 + * @param <T1> The type of field 1 + * @param <T2> The type of field 2 + * @param <T3> The type of field 3 + * @param <T4> The type of field 4 + * @param <T5> The type of field 5 + * @param <T6> The type of field 6 + * @param <T7> The type of field 7 + * @param <T8> The type of field 8 + * @param <T9> The type of field 9 + */ +public class Tuple10<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> extends Tuple { + + private static final long serialVersionUID = 1L; + + /** Field 0 of the tuple. */ + public T0 f0; + /** Field 1 of the tuple. */ + public T1 f1; + /** Field 2 of the tuple. */ + public T2 f2; + /** Field 3 of the tuple. */ + public T3 f3; + /** Field 4 of the tuple. */ + public T4 f4; + /** Field 5 of the tuple. */ + public T5 f5; + /** Field 6 of the tuple. */ + public T6 f6; + /** Field 7 of the tuple. */ + public T7 f7; + /** Field 8 of the tuple. */ + public T8 f8; + /** Field 9 of the tuple. */ + public T9 f9; + + /** + * Creates a new tuple where all fields are null. + */ + public Tuple10() {} + + /** + * Creates a new tuple and assigns the given values to the tuple's fields. + * + * @param value0 The value for field 0 + * @param value1 The value for field 1 + * @param value2 The value for field 2 + * @param value3 The value for field 3 + * @param value4 The value for field 4 + * @param value5 The value for field 5 + * @param value6 The value for field 6 + * @param value7 The value for field 7 + * @param value8 The value for field 8 + * @param value9 The value for field 9 + */ + public Tuple10(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9) { + this.f0 = value0; + this.f1 = value1; + this.f2 = value2; + this.f3 = value3; + this.f4 = value4; + this.f5 = value5; + this.f6 = value6; + this.f7 = value7; + this.f8 = value8; + this.f9 = value9; + } + + @Override + public int getArity() { return 10; } + + @Override + @SuppressWarnings("unchecked") + public <T> T getField(int pos) { + switch(pos) { + case 0: return (T) this.f0; + case 1: return (T) this.f1; + case 2: return (T) this.f2; + case 3: return (T) this.f3; + case 4: return (T) this.f4; + case 5: return (T) this.f5; + case 6: return (T) this.f6; + case 7: return (T) this.f7; + case 8: return (T) this.f8; + case 9: return (T) this.f9; + default: throw new IndexOutOfBoundsException(String.valueOf(pos)); + } + } + + @Override + @SuppressWarnings("unchecked") + public <T> void setField(T value, int pos) { + switch(pos) { + case 0: + this.f0 = (T0) value; + break; + case 1: + this.f1 = (T1) value; + break; + case 2: + this.f2 = (T2) value; + break; + case 3: + this.f3 = (T3) value; + break; + case 4: + this.f4 = (T4) value; + break; + case 5: + this.f5 = (T5) value; + break; + case 6: + this.f6 = (T6) value; + break; + case 7: + this.f7 = (T7) value; + break; + case 8: + this.f8 = (T8) value; + break; + case 9: + this.f9 = (T9) value; + break; + default: throw new IndexOutOfBoundsException(String.valueOf(pos)); + } + } + + /** + * Sets new values to all fields of the tuple. + * + * @param value0 The value for field 0 + * @param value1 The value for field 1 + * @param value2 The value for field 2 + * @param value3 The value for field 3 + * @param value4 The value for field 4 + * @param value5 The value for field 5 + * @param value6 The value for field 6 + * @param value7 The value for field 7 + * @param value8 The value for field 8 + * @param value9 The value for field 9 + */ + public void setFields(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9) { + this.f0 = value0; + this.f1 = value1; + this.f2 = value2; + this.f3 = value3; + this.f4 = value4; + this.f5 = value5; + this.f6 = value6; + this.f7 = value7; + this.f8 = value8; + this.f9 = value9; + } + + + // ------------------------------------------------------------------------------------------------- + // standard utilities + // ------------------------------------------------------------------------------------------------- + + /** + * Creates a string representation of the tuple in the form + * (f0, f1, f2, f3, f4, f5, f6, f7, f8, f9), + * where the individual fields are the value returned by calling {@link Object#toString} on that field. + * @return The string representation of the tuple. + */ + @Override + public String toString() { + return "(" + StringUtils.arrayAwareToString(this.f0) + + "," + StringUtils.arrayAwareToString(this.f1) + + "," + StringUtils.arrayAwareToString(this.f2) + + "," + StringUtils.arrayAwareToString(this.f3) + + "," + StringUtils.arrayAwareToString(this.f4) + + "," + StringUtils.arrayAwareToString(this.f5) + + "," + StringUtils.arrayAwareToString(this.f6) + + "," + StringUtils.arrayAwareToString(this.f7) + + "," + StringUtils.arrayAwareToString(this.f8) + + "," + StringUtils.arrayAwareToString(this.f9) + + ")"; + } + + /** + * Deep equality for tuples by calling equals() on the tuple members + * @param o the object checked for equality + * @return true if this is equal to o. + */ + @Override + public boolean equals(Object o) { + if(this == o) { return true; } + if (!(o instanceof Tuple10)) { return false; } + @SuppressWarnings("rawtypes") + Tuple10 tuple = (Tuple10) o; + if (f0 != null ? !f0.equals(tuple.f0) : tuple.f0 != null) { return false; } + if (f1 != null ? !f1.equals(tuple.f1) : tuple.f1 != null) { return false; } + if (f2 != null ? !f2.equals(tuple.f2) : tuple.f2 != null) { return false; } + if (f3 != null ? !f3.equals(tuple.f3) : tuple.f3 != null) { return false; } + if (f4 != null ? !f4.equals(tuple.f4) : tuple.f4 != null) { return false; } + if (f5 != null ? !f5.equals(tuple.f5) : tuple.f5 != null) { return false; } + if (f6 != null ? !f6.equals(tuple.f6) : tuple.f6 != null) { return false; } + if (f7 != null ? !f7.equals(tuple.f7) : tuple.f7 != null) { return false; } + if (f8 != null ? !f8.equals(tuple.f8) : tuple.f8 != null) { return false; } + if (f9 != null ? !f9.equals(tuple.f9) : tuple.f9 != null) { return false; } + return true; + } + + @Override + public int hashCode() { + int result = f0 != null ? f0.hashCode() : 0; + result = 31 * result + (f1 != null ? f1.hashCode() : 0); + result = 31 * result + (f2 != null ? f2.hashCode() : 0); + result = 31 * result + (f3 != null ? f3.hashCode() : 0); + result = 31 * result + (f4 != null ? f4.hashCode() : 0); + result = 31 * result + (f5 != null ? f5.hashCode() : 0); + result = 31 * result + (f6 != null ? f6.hashCode() : 0); + result = 31 * result + (f7 != null ? f7.hashCode() : 0); + result = 31 * result + (f8 != null ? f8.hashCode() : 0); + result = 31 * result + (f9 != null ? f9.hashCode() : 0); + return result; + } + + /** + * Shallow tuple copy. + * @return A new Tuple with the same fields as this. + */ + @Override + @SuppressWarnings("unchecked") + 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, + this.f2, + this.f3, + this.f4, + this.f5, + this.f6, + this.f7, + 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); + } +} http://git-wip-us.apache.org/repos/asf/flink/blob/7081836e/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple11.java ---------------------------------------------------------------------- diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple11.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple11.java new file mode 100644 index 0000000..b58ae6c --- /dev/null +++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple11.java @@ -0,0 +1,304 @@ +/* + * 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. + */ + + +// -------------------------------------------------------------- +// THIS IS A GENERATED SOURCE FILE. DO NOT EDIT! +// GENERATED FROM org.apache.flink.api.java.tuple.TupleGenerator. +// -------------------------------------------------------------- + + +package org.apache.flink.api.java.tuple; + +import org.apache.flink.util.StringUtils; + +/** + * A tuple with 11 fields. Tuples are strongly typed; each field may be of a separate type. + * The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position + * through the {@link #getField(int)} method. The tuple field positions start at zero. + * <p> + * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work + * with Tuples to reuse objects in order to reduce pressure on the garbage collector. + * + * @see Tuple + * + * @param <T0> The type of field 0 + * @param <T1> The type of field 1 + * @param <T2> The type of field 2 + * @param <T3> The type of field 3 + * @param <T4> The type of field 4 + * @param <T5> The type of field 5 + * @param <T6> The type of field 6 + * @param <T7> The type of field 7 + * @param <T8> The type of field 8 + * @param <T9> The type of field 9 + * @param <T10> The type of field 10 + */ +public class Tuple11<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> extends Tuple { + + private static final long serialVersionUID = 1L; + + /** Field 0 of the tuple. */ + public T0 f0; + /** Field 1 of the tuple. */ + public T1 f1; + /** Field 2 of the tuple. */ + public T2 f2; + /** Field 3 of the tuple. */ + public T3 f3; + /** Field 4 of the tuple. */ + public T4 f4; + /** Field 5 of the tuple. */ + public T5 f5; + /** Field 6 of the tuple. */ + public T6 f6; + /** Field 7 of the tuple. */ + public T7 f7; + /** Field 8 of the tuple. */ + public T8 f8; + /** Field 9 of the tuple. */ + public T9 f9; + /** Field 10 of the tuple. */ + public T10 f10; + + /** + * Creates a new tuple where all fields are null. + */ + public Tuple11() {} + + /** + * Creates a new tuple and assigns the given values to the tuple's fields. + * + * @param value0 The value for field 0 + * @param value1 The value for field 1 + * @param value2 The value for field 2 + * @param value3 The value for field 3 + * @param value4 The value for field 4 + * @param value5 The value for field 5 + * @param value6 The value for field 6 + * @param value7 The value for field 7 + * @param value8 The value for field 8 + * @param value9 The value for field 9 + * @param value10 The value for field 10 + */ + public Tuple11(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10) { + this.f0 = value0; + this.f1 = value1; + this.f2 = value2; + this.f3 = value3; + this.f4 = value4; + this.f5 = value5; + this.f6 = value6; + this.f7 = value7; + this.f8 = value8; + this.f9 = value9; + this.f10 = value10; + } + + @Override + public int getArity() { return 11; } + + @Override + @SuppressWarnings("unchecked") + public <T> T getField(int pos) { + switch(pos) { + case 0: return (T) this.f0; + case 1: return (T) this.f1; + case 2: return (T) this.f2; + case 3: return (T) this.f3; + case 4: return (T) this.f4; + case 5: return (T) this.f5; + case 6: return (T) this.f6; + case 7: return (T) this.f7; + case 8: return (T) this.f8; + case 9: return (T) this.f9; + case 10: return (T) this.f10; + default: throw new IndexOutOfBoundsException(String.valueOf(pos)); + } + } + + @Override + @SuppressWarnings("unchecked") + public <T> void setField(T value, int pos) { + switch(pos) { + case 0: + this.f0 = (T0) value; + break; + case 1: + this.f1 = (T1) value; + break; + case 2: + this.f2 = (T2) value; + break; + case 3: + this.f3 = (T3) value; + break; + case 4: + this.f4 = (T4) value; + break; + case 5: + this.f5 = (T5) value; + break; + case 6: + this.f6 = (T6) value; + break; + case 7: + this.f7 = (T7) value; + break; + case 8: + this.f8 = (T8) value; + break; + case 9: + this.f9 = (T9) value; + break; + case 10: + this.f10 = (T10) value; + break; + default: throw new IndexOutOfBoundsException(String.valueOf(pos)); + } + } + + /** + * Sets new values to all fields of the tuple. + * + * @param value0 The value for field 0 + * @param value1 The value for field 1 + * @param value2 The value for field 2 + * @param value3 The value for field 3 + * @param value4 The value for field 4 + * @param value5 The value for field 5 + * @param value6 The value for field 6 + * @param value7 The value for field 7 + * @param value8 The value for field 8 + * @param value9 The value for field 9 + * @param value10 The value for field 10 + */ + public void setFields(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10) { + this.f0 = value0; + this.f1 = value1; + this.f2 = value2; + this.f3 = value3; + this.f4 = value4; + this.f5 = value5; + this.f6 = value6; + this.f7 = value7; + this.f8 = value8; + this.f9 = value9; + this.f10 = value10; + } + + + // ------------------------------------------------------------------------------------------------- + // standard utilities + // ------------------------------------------------------------------------------------------------- + + /** + * Creates a string representation of the tuple in the form + * (f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10), + * where the individual fields are the value returned by calling {@link Object#toString} on that field. + * @return The string representation of the tuple. + */ + @Override + public String toString() { + return "(" + StringUtils.arrayAwareToString(this.f0) + + "," + StringUtils.arrayAwareToString(this.f1) + + "," + StringUtils.arrayAwareToString(this.f2) + + "," + StringUtils.arrayAwareToString(this.f3) + + "," + StringUtils.arrayAwareToString(this.f4) + + "," + StringUtils.arrayAwareToString(this.f5) + + "," + StringUtils.arrayAwareToString(this.f6) + + "," + StringUtils.arrayAwareToString(this.f7) + + "," + StringUtils.arrayAwareToString(this.f8) + + "," + StringUtils.arrayAwareToString(this.f9) + + "," + StringUtils.arrayAwareToString(this.f10) + + ")"; + } + + /** + * Deep equality for tuples by calling equals() on the tuple members + * @param o the object checked for equality + * @return true if this is equal to o. + */ + @Override + public boolean equals(Object o) { + if(this == o) { return true; } + if (!(o instanceof Tuple11)) { return false; } + @SuppressWarnings("rawtypes") + Tuple11 tuple = (Tuple11) o; + if (f0 != null ? !f0.equals(tuple.f0) : tuple.f0 != null) { return false; } + if (f1 != null ? !f1.equals(tuple.f1) : tuple.f1 != null) { return false; } + if (f2 != null ? !f2.equals(tuple.f2) : tuple.f2 != null) { return false; } + if (f3 != null ? !f3.equals(tuple.f3) : tuple.f3 != null) { return false; } + if (f4 != null ? !f4.equals(tuple.f4) : tuple.f4 != null) { return false; } + if (f5 != null ? !f5.equals(tuple.f5) : tuple.f5 != null) { return false; } + if (f6 != null ? !f6.equals(tuple.f6) : tuple.f6 != null) { return false; } + if (f7 != null ? !f7.equals(tuple.f7) : tuple.f7 != null) { return false; } + if (f8 != null ? !f8.equals(tuple.f8) : tuple.f8 != null) { return false; } + if (f9 != null ? !f9.equals(tuple.f9) : tuple.f9 != null) { return false; } + if (f10 != null ? !f10.equals(tuple.f10) : tuple.f10 != null) { return false; } + return true; + } + + @Override + public int hashCode() { + int result = f0 != null ? f0.hashCode() : 0; + result = 31 * result + (f1 != null ? f1.hashCode() : 0); + result = 31 * result + (f2 != null ? f2.hashCode() : 0); + result = 31 * result + (f3 != null ? f3.hashCode() : 0); + result = 31 * result + (f4 != null ? f4.hashCode() : 0); + result = 31 * result + (f5 != null ? f5.hashCode() : 0); + result = 31 * result + (f6 != null ? f6.hashCode() : 0); + result = 31 * result + (f7 != null ? f7.hashCode() : 0); + result = 31 * result + (f8 != null ? f8.hashCode() : 0); + result = 31 * result + (f9 != null ? f9.hashCode() : 0); + result = 31 * result + (f10 != null ? f10.hashCode() : 0); + return result; + } + + /** + * Shallow tuple copy. + * @return A new Tuple with the same fields as this. + */ + @Override + @SuppressWarnings("unchecked") + 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, + this.f2, + this.f3, + this.f4, + this.f5, + this.f6, + this.f7, + this.f8, + 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); + } +} http://git-wip-us.apache.org/repos/asf/flink/blob/7081836e/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple12.java ---------------------------------------------------------------------- diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple12.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple12.java new file mode 100644 index 0000000..4e7defb --- /dev/null +++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple12.java @@ -0,0 +1,319 @@ +/* + * 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. + */ + + +// -------------------------------------------------------------- +// THIS IS A GENERATED SOURCE FILE. DO NOT EDIT! +// GENERATED FROM org.apache.flink.api.java.tuple.TupleGenerator. +// -------------------------------------------------------------- + + +package org.apache.flink.api.java.tuple; + +import org.apache.flink.util.StringUtils; + +/** + * A tuple with 12 fields. Tuples are strongly typed; each field may be of a separate type. + * The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position + * through the {@link #getField(int)} method. The tuple field positions start at zero. + * <p> + * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work + * with Tuples to reuse objects in order to reduce pressure on the garbage collector. + * + * @see Tuple + * + * @param <T0> The type of field 0 + * @param <T1> The type of field 1 + * @param <T2> The type of field 2 + * @param <T3> The type of field 3 + * @param <T4> The type of field 4 + * @param <T5> The type of field 5 + * @param <T6> The type of field 6 + * @param <T7> The type of field 7 + * @param <T8> The type of field 8 + * @param <T9> The type of field 9 + * @param <T10> The type of field 10 + * @param <T11> The type of field 11 + */ +public class Tuple12<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> extends Tuple { + + private static final long serialVersionUID = 1L; + + /** Field 0 of the tuple. */ + public T0 f0; + /** Field 1 of the tuple. */ + public T1 f1; + /** Field 2 of the tuple. */ + public T2 f2; + /** Field 3 of the tuple. */ + public T3 f3; + /** Field 4 of the tuple. */ + public T4 f4; + /** Field 5 of the tuple. */ + public T5 f5; + /** Field 6 of the tuple. */ + public T6 f6; + /** Field 7 of the tuple. */ + public T7 f7; + /** Field 8 of the tuple. */ + public T8 f8; + /** Field 9 of the tuple. */ + public T9 f9; + /** Field 10 of the tuple. */ + public T10 f10; + /** Field 11 of the tuple. */ + public T11 f11; + + /** + * Creates a new tuple where all fields are null. + */ + public Tuple12() {} + + /** + * Creates a new tuple and assigns the given values to the tuple's fields. + * + * @param value0 The value for field 0 + * @param value1 The value for field 1 + * @param value2 The value for field 2 + * @param value3 The value for field 3 + * @param value4 The value for field 4 + * @param value5 The value for field 5 + * @param value6 The value for field 6 + * @param value7 The value for field 7 + * @param value8 The value for field 8 + * @param value9 The value for field 9 + * @param value10 The value for field 10 + * @param value11 The value for field 11 + */ + public Tuple12(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10, T11 value11) { + this.f0 = value0; + this.f1 = value1; + this.f2 = value2; + this.f3 = value3; + this.f4 = value4; + this.f5 = value5; + this.f6 = value6; + this.f7 = value7; + this.f8 = value8; + this.f9 = value9; + this.f10 = value10; + this.f11 = value11; + } + + @Override + public int getArity() { return 12; } + + @Override + @SuppressWarnings("unchecked") + public <T> T getField(int pos) { + switch(pos) { + case 0: return (T) this.f0; + case 1: return (T) this.f1; + case 2: return (T) this.f2; + case 3: return (T) this.f3; + case 4: return (T) this.f4; + case 5: return (T) this.f5; + case 6: return (T) this.f6; + case 7: return (T) this.f7; + case 8: return (T) this.f8; + case 9: return (T) this.f9; + case 10: return (T) this.f10; + case 11: return (T) this.f11; + default: throw new IndexOutOfBoundsException(String.valueOf(pos)); + } + } + + @Override + @SuppressWarnings("unchecked") + public <T> void setField(T value, int pos) { + switch(pos) { + case 0: + this.f0 = (T0) value; + break; + case 1: + this.f1 = (T1) value; + break; + case 2: + this.f2 = (T2) value; + break; + case 3: + this.f3 = (T3) value; + break; + case 4: + this.f4 = (T4) value; + break; + case 5: + this.f5 = (T5) value; + break; + case 6: + this.f6 = (T6) value; + break; + case 7: + this.f7 = (T7) value; + break; + case 8: + this.f8 = (T8) value; + break; + case 9: + this.f9 = (T9) value; + break; + case 10: + this.f10 = (T10) value; + break; + case 11: + this.f11 = (T11) value; + break; + default: throw new IndexOutOfBoundsException(String.valueOf(pos)); + } + } + + /** + * Sets new values to all fields of the tuple. + * + * @param value0 The value for field 0 + * @param value1 The value for field 1 + * @param value2 The value for field 2 + * @param value3 The value for field 3 + * @param value4 The value for field 4 + * @param value5 The value for field 5 + * @param value6 The value for field 6 + * @param value7 The value for field 7 + * @param value8 The value for field 8 + * @param value9 The value for field 9 + * @param value10 The value for field 10 + * @param value11 The value for field 11 + */ + public void setFields(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10, T11 value11) { + this.f0 = value0; + this.f1 = value1; + this.f2 = value2; + this.f3 = value3; + this.f4 = value4; + this.f5 = value5; + this.f6 = value6; + this.f7 = value7; + this.f8 = value8; + this.f9 = value9; + this.f10 = value10; + this.f11 = value11; + } + + + // ------------------------------------------------------------------------------------------------- + // standard utilities + // ------------------------------------------------------------------------------------------------- + + /** + * Creates a string representation of the tuple in the form + * (f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11), + * where the individual fields are the value returned by calling {@link Object#toString} on that field. + * @return The string representation of the tuple. + */ + @Override + public String toString() { + return "(" + StringUtils.arrayAwareToString(this.f0) + + "," + StringUtils.arrayAwareToString(this.f1) + + "," + StringUtils.arrayAwareToString(this.f2) + + "," + StringUtils.arrayAwareToString(this.f3) + + "," + StringUtils.arrayAwareToString(this.f4) + + "," + StringUtils.arrayAwareToString(this.f5) + + "," + StringUtils.arrayAwareToString(this.f6) + + "," + StringUtils.arrayAwareToString(this.f7) + + "," + StringUtils.arrayAwareToString(this.f8) + + "," + StringUtils.arrayAwareToString(this.f9) + + "," + StringUtils.arrayAwareToString(this.f10) + + "," + StringUtils.arrayAwareToString(this.f11) + + ")"; + } + + /** + * Deep equality for tuples by calling equals() on the tuple members + * @param o the object checked for equality + * @return true if this is equal to o. + */ + @Override + public boolean equals(Object o) { + if(this == o) { return true; } + if (!(o instanceof Tuple12)) { return false; } + @SuppressWarnings("rawtypes") + Tuple12 tuple = (Tuple12) o; + if (f0 != null ? !f0.equals(tuple.f0) : tuple.f0 != null) { return false; } + if (f1 != null ? !f1.equals(tuple.f1) : tuple.f1 != null) { return false; } + if (f2 != null ? !f2.equals(tuple.f2) : tuple.f2 != null) { return false; } + if (f3 != null ? !f3.equals(tuple.f3) : tuple.f3 != null) { return false; } + if (f4 != null ? !f4.equals(tuple.f4) : tuple.f4 != null) { return false; } + if (f5 != null ? !f5.equals(tuple.f5) : tuple.f5 != null) { return false; } + if (f6 != null ? !f6.equals(tuple.f6) : tuple.f6 != null) { return false; } + if (f7 != null ? !f7.equals(tuple.f7) : tuple.f7 != null) { return false; } + if (f8 != null ? !f8.equals(tuple.f8) : tuple.f8 != null) { return false; } + if (f9 != null ? !f9.equals(tuple.f9) : tuple.f9 != null) { return false; } + if (f10 != null ? !f10.equals(tuple.f10) : tuple.f10 != null) { return false; } + if (f11 != null ? !f11.equals(tuple.f11) : tuple.f11 != null) { return false; } + return true; + } + + @Override + public int hashCode() { + int result = f0 != null ? f0.hashCode() : 0; + result = 31 * result + (f1 != null ? f1.hashCode() : 0); + result = 31 * result + (f2 != null ? f2.hashCode() : 0); + result = 31 * result + (f3 != null ? f3.hashCode() : 0); + result = 31 * result + (f4 != null ? f4.hashCode() : 0); + result = 31 * result + (f5 != null ? f5.hashCode() : 0); + result = 31 * result + (f6 != null ? f6.hashCode() : 0); + result = 31 * result + (f7 != null ? f7.hashCode() : 0); + result = 31 * result + (f8 != null ? f8.hashCode() : 0); + result = 31 * result + (f9 != null ? f9.hashCode() : 0); + result = 31 * result + (f10 != null ? f10.hashCode() : 0); + result = 31 * result + (f11 != null ? f11.hashCode() : 0); + return result; + } + + /** + * Shallow tuple copy. + * @return A new Tuple with the same fields as this. + */ + @Override + @SuppressWarnings("unchecked") + 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, + this.f2, + this.f3, + this.f4, + this.f5, + this.f6, + this.f7, + this.f8, + this.f9, + 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); + } +} http://git-wip-us.apache.org/repos/asf/flink/blob/7081836e/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple13.java ---------------------------------------------------------------------- diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple13.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple13.java new file mode 100644 index 0000000..9543912 --- /dev/null +++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple13.java @@ -0,0 +1,334 @@ +/* + * 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. + */ + + +// -------------------------------------------------------------- +// THIS IS A GENERATED SOURCE FILE. DO NOT EDIT! +// GENERATED FROM org.apache.flink.api.java.tuple.TupleGenerator. +// -------------------------------------------------------------- + + +package org.apache.flink.api.java.tuple; + +import org.apache.flink.util.StringUtils; + +/** + * A tuple with 13 fields. Tuples are strongly typed; each field may be of a separate type. + * The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position + * through the {@link #getField(int)} method. The tuple field positions start at zero. + * <p> + * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work + * with Tuples to reuse objects in order to reduce pressure on the garbage collector. + * + * @see Tuple + * + * @param <T0> The type of field 0 + * @param <T1> The type of field 1 + * @param <T2> The type of field 2 + * @param <T3> The type of field 3 + * @param <T4> The type of field 4 + * @param <T5> The type of field 5 + * @param <T6> The type of field 6 + * @param <T7> The type of field 7 + * @param <T8> The type of field 8 + * @param <T9> The type of field 9 + * @param <T10> The type of field 10 + * @param <T11> The type of field 11 + * @param <T12> The type of field 12 + */ +public class Tuple13<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> extends Tuple { + + private static final long serialVersionUID = 1L; + + /** Field 0 of the tuple. */ + public T0 f0; + /** Field 1 of the tuple. */ + public T1 f1; + /** Field 2 of the tuple. */ + public T2 f2; + /** Field 3 of the tuple. */ + public T3 f3; + /** Field 4 of the tuple. */ + public T4 f4; + /** Field 5 of the tuple. */ + public T5 f5; + /** Field 6 of the tuple. */ + public T6 f6; + /** Field 7 of the tuple. */ + public T7 f7; + /** Field 8 of the tuple. */ + public T8 f8; + /** Field 9 of the tuple. */ + public T9 f9; + /** Field 10 of the tuple. */ + public T10 f10; + /** Field 11 of the tuple. */ + public T11 f11; + /** Field 12 of the tuple. */ + public T12 f12; + + /** + * Creates a new tuple where all fields are null. + */ + public Tuple13() {} + + /** + * Creates a new tuple and assigns the given values to the tuple's fields. + * + * @param value0 The value for field 0 + * @param value1 The value for field 1 + * @param value2 The value for field 2 + * @param value3 The value for field 3 + * @param value4 The value for field 4 + * @param value5 The value for field 5 + * @param value6 The value for field 6 + * @param value7 The value for field 7 + * @param value8 The value for field 8 + * @param value9 The value for field 9 + * @param value10 The value for field 10 + * @param value11 The value for field 11 + * @param value12 The value for field 12 + */ + public Tuple13(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) { + this.f0 = value0; + this.f1 = value1; + this.f2 = value2; + this.f3 = value3; + this.f4 = value4; + this.f5 = value5; + this.f6 = value6; + this.f7 = value7; + this.f8 = value8; + this.f9 = value9; + this.f10 = value10; + this.f11 = value11; + this.f12 = value12; + } + + @Override + public int getArity() { return 13; } + + @Override + @SuppressWarnings("unchecked") + public <T> T getField(int pos) { + switch(pos) { + case 0: return (T) this.f0; + case 1: return (T) this.f1; + case 2: return (T) this.f2; + case 3: return (T) this.f3; + case 4: return (T) this.f4; + case 5: return (T) this.f5; + case 6: return (T) this.f6; + case 7: return (T) this.f7; + case 8: return (T) this.f8; + case 9: return (T) this.f9; + case 10: return (T) this.f10; + case 11: return (T) this.f11; + case 12: return (T) this.f12; + default: throw new IndexOutOfBoundsException(String.valueOf(pos)); + } + } + + @Override + @SuppressWarnings("unchecked") + public <T> void setField(T value, int pos) { + switch(pos) { + case 0: + this.f0 = (T0) value; + break; + case 1: + this.f1 = (T1) value; + break; + case 2: + this.f2 = (T2) value; + break; + case 3: + this.f3 = (T3) value; + break; + case 4: + this.f4 = (T4) value; + break; + case 5: + this.f5 = (T5) value; + break; + case 6: + this.f6 = (T6) value; + break; + case 7: + this.f7 = (T7) value; + break; + case 8: + this.f8 = (T8) value; + break; + case 9: + this.f9 = (T9) value; + break; + case 10: + this.f10 = (T10) value; + break; + case 11: + this.f11 = (T11) value; + break; + case 12: + this.f12 = (T12) value; + break; + default: throw new IndexOutOfBoundsException(String.valueOf(pos)); + } + } + + /** + * Sets new values to all fields of the tuple. + * + * @param value0 The value for field 0 + * @param value1 The value for field 1 + * @param value2 The value for field 2 + * @param value3 The value for field 3 + * @param value4 The value for field 4 + * @param value5 The value for field 5 + * @param value6 The value for field 6 + * @param value7 The value for field 7 + * @param value8 The value for field 8 + * @param value9 The value for field 9 + * @param value10 The value for field 10 + * @param value11 The value for field 11 + * @param value12 The value for field 12 + */ + public void setFields(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) { + this.f0 = value0; + this.f1 = value1; + this.f2 = value2; + this.f3 = value3; + this.f4 = value4; + this.f5 = value5; + this.f6 = value6; + this.f7 = value7; + this.f8 = value8; + this.f9 = value9; + this.f10 = value10; + this.f11 = value11; + this.f12 = value12; + } + + + // ------------------------------------------------------------------------------------------------- + // standard utilities + // ------------------------------------------------------------------------------------------------- + + /** + * Creates a string representation of the tuple in the form + * (f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12), + * where the individual fields are the value returned by calling {@link Object#toString} on that field. + * @return The string representation of the tuple. + */ + @Override + public String toString() { + return "(" + StringUtils.arrayAwareToString(this.f0) + + "," + StringUtils.arrayAwareToString(this.f1) + + "," + StringUtils.arrayAwareToString(this.f2) + + "," + StringUtils.arrayAwareToString(this.f3) + + "," + StringUtils.arrayAwareToString(this.f4) + + "," + StringUtils.arrayAwareToString(this.f5) + + "," + StringUtils.arrayAwareToString(this.f6) + + "," + StringUtils.arrayAwareToString(this.f7) + + "," + StringUtils.arrayAwareToString(this.f8) + + "," + StringUtils.arrayAwareToString(this.f9) + + "," + StringUtils.arrayAwareToString(this.f10) + + "," + StringUtils.arrayAwareToString(this.f11) + + "," + StringUtils.arrayAwareToString(this.f12) + + ")"; + } + + /** + * Deep equality for tuples by calling equals() on the tuple members + * @param o the object checked for equality + * @return true if this is equal to o. + */ + @Override + public boolean equals(Object o) { + if(this == o) { return true; } + if (!(o instanceof Tuple13)) { return false; } + @SuppressWarnings("rawtypes") + Tuple13 tuple = (Tuple13) o; + if (f0 != null ? !f0.equals(tuple.f0) : tuple.f0 != null) { return false; } + if (f1 != null ? !f1.equals(tuple.f1) : tuple.f1 != null) { return false; } + if (f2 != null ? !f2.equals(tuple.f2) : tuple.f2 != null) { return false; } + if (f3 != null ? !f3.equals(tuple.f3) : tuple.f3 != null) { return false; } + if (f4 != null ? !f4.equals(tuple.f4) : tuple.f4 != null) { return false; } + if (f5 != null ? !f5.equals(tuple.f5) : tuple.f5 != null) { return false; } + if (f6 != null ? !f6.equals(tuple.f6) : tuple.f6 != null) { return false; } + if (f7 != null ? !f7.equals(tuple.f7) : tuple.f7 != null) { return false; } + if (f8 != null ? !f8.equals(tuple.f8) : tuple.f8 != null) { return false; } + if (f9 != null ? !f9.equals(tuple.f9) : tuple.f9 != null) { return false; } + if (f10 != null ? !f10.equals(tuple.f10) : tuple.f10 != null) { return false; } + if (f11 != null ? !f11.equals(tuple.f11) : tuple.f11 != null) { return false; } + if (f12 != null ? !f12.equals(tuple.f12) : tuple.f12 != null) { return false; } + return true; + } + + @Override + public int hashCode() { + int result = f0 != null ? f0.hashCode() : 0; + result = 31 * result + (f1 != null ? f1.hashCode() : 0); + result = 31 * result + (f2 != null ? f2.hashCode() : 0); + result = 31 * result + (f3 != null ? f3.hashCode() : 0); + result = 31 * result + (f4 != null ? f4.hashCode() : 0); + result = 31 * result + (f5 != null ? f5.hashCode() : 0); + result = 31 * result + (f6 != null ? f6.hashCode() : 0); + result = 31 * result + (f7 != null ? f7.hashCode() : 0); + result = 31 * result + (f8 != null ? f8.hashCode() : 0); + result = 31 * result + (f9 != null ? f9.hashCode() : 0); + result = 31 * result + (f10 != null ? f10.hashCode() : 0); + result = 31 * result + (f11 != null ? f11.hashCode() : 0); + result = 31 * result + (f12 != null ? f12.hashCode() : 0); + return result; + } + + /** + * Shallow tuple copy. + * @return A new Tuple with the same fields as this. + */ + @Override + @SuppressWarnings("unchecked") + 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, + this.f2, + this.f3, + this.f4, + this.f5, + this.f6, + this.f7, + this.f8, + this.f9, + this.f10, + 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); + } +} http://git-wip-us.apache.org/repos/asf/flink/blob/7081836e/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple14.java ---------------------------------------------------------------------- diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple14.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple14.java new file mode 100644 index 0000000..36d508e --- /dev/null +++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple14.java @@ -0,0 +1,349 @@ +/* + * 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. + */ + + +// -------------------------------------------------------------- +// THIS IS A GENERATED SOURCE FILE. DO NOT EDIT! +// GENERATED FROM org.apache.flink.api.java.tuple.TupleGenerator. +// -------------------------------------------------------------- + + +package org.apache.flink.api.java.tuple; + +import org.apache.flink.util.StringUtils; + +/** + * A tuple with 14 fields. Tuples are strongly typed; each field may be of a separate type. + * The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position + * through the {@link #getField(int)} method. The tuple field positions start at zero. + * <p> + * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work + * with Tuples to reuse objects in order to reduce pressure on the garbage collector. + * + * @see Tuple + * + * @param <T0> The type of field 0 + * @param <T1> The type of field 1 + * @param <T2> The type of field 2 + * @param <T3> The type of field 3 + * @param <T4> The type of field 4 + * @param <T5> The type of field 5 + * @param <T6> The type of field 6 + * @param <T7> The type of field 7 + * @param <T8> The type of field 8 + * @param <T9> The type of field 9 + * @param <T10> The type of field 10 + * @param <T11> The type of field 11 + * @param <T12> The type of field 12 + * @param <T13> The type of field 13 + */ +public class Tuple14<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> extends Tuple { + + private static final long serialVersionUID = 1L; + + /** Field 0 of the tuple. */ + public T0 f0; + /** Field 1 of the tuple. */ + public T1 f1; + /** Field 2 of the tuple. */ + public T2 f2; + /** Field 3 of the tuple. */ + public T3 f3; + /** Field 4 of the tuple. */ + public T4 f4; + /** Field 5 of the tuple. */ + public T5 f5; + /** Field 6 of the tuple. */ + public T6 f6; + /** Field 7 of the tuple. */ + public T7 f7; + /** Field 8 of the tuple. */ + public T8 f8; + /** Field 9 of the tuple. */ + public T9 f9; + /** Field 10 of the tuple. */ + public T10 f10; + /** Field 11 of the tuple. */ + public T11 f11; + /** Field 12 of the tuple. */ + public T12 f12; + /** Field 13 of the tuple. */ + public T13 f13; + + /** + * Creates a new tuple where all fields are null. + */ + public Tuple14() {} + + /** + * Creates a new tuple and assigns the given values to the tuple's fields. + * + * @param value0 The value for field 0 + * @param value1 The value for field 1 + * @param value2 The value for field 2 + * @param value3 The value for field 3 + * @param value4 The value for field 4 + * @param value5 The value for field 5 + * @param value6 The value for field 6 + * @param value7 The value for field 7 + * @param value8 The value for field 8 + * @param value9 The value for field 9 + * @param value10 The value for field 10 + * @param value11 The value for field 11 + * @param value12 The value for field 12 + * @param value13 The value for field 13 + */ + public Tuple14(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) { + this.f0 = value0; + this.f1 = value1; + this.f2 = value2; + this.f3 = value3; + this.f4 = value4; + this.f5 = value5; + this.f6 = value6; + this.f7 = value7; + this.f8 = value8; + this.f9 = value9; + this.f10 = value10; + this.f11 = value11; + this.f12 = value12; + this.f13 = value13; + } + + @Override + public int getArity() { return 14; } + + @Override + @SuppressWarnings("unchecked") + public <T> T getField(int pos) { + switch(pos) { + case 0: return (T) this.f0; + case 1: return (T) this.f1; + case 2: return (T) this.f2; + case 3: return (T) this.f3; + case 4: return (T) this.f4; + case 5: return (T) this.f5; + case 6: return (T) this.f6; + case 7: return (T) this.f7; + case 8: return (T) this.f8; + case 9: return (T) this.f9; + case 10: return (T) this.f10; + case 11: return (T) this.f11; + case 12: return (T) this.f12; + case 13: return (T) this.f13; + default: throw new IndexOutOfBoundsException(String.valueOf(pos)); + } + } + + @Override + @SuppressWarnings("unchecked") + public <T> void setField(T value, int pos) { + switch(pos) { + case 0: + this.f0 = (T0) value; + break; + case 1: + this.f1 = (T1) value; + break; + case 2: + this.f2 = (T2) value; + break; + case 3: + this.f3 = (T3) value; + break; + case 4: + this.f4 = (T4) value; + break; + case 5: + this.f5 = (T5) value; + break; + case 6: + this.f6 = (T6) value; + break; + case 7: + this.f7 = (T7) value; + break; + case 8: + this.f8 = (T8) value; + break; + case 9: + this.f9 = (T9) value; + break; + case 10: + this.f10 = (T10) value; + break; + case 11: + this.f11 = (T11) value; + break; + case 12: + this.f12 = (T12) value; + break; + case 13: + this.f13 = (T13) value; + break; + default: throw new IndexOutOfBoundsException(String.valueOf(pos)); + } + } + + /** + * Sets new values to all fields of the tuple. + * + * @param value0 The value for field 0 + * @param value1 The value for field 1 + * @param value2 The value for field 2 + * @param value3 The value for field 3 + * @param value4 The value for field 4 + * @param value5 The value for field 5 + * @param value6 The value for field 6 + * @param value7 The value for field 7 + * @param value8 The value for field 8 + * @param value9 The value for field 9 + * @param value10 The value for field 10 + * @param value11 The value for field 11 + * @param value12 The value for field 12 + * @param value13 The value for field 13 + */ + public void setFields(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) { + this.f0 = value0; + this.f1 = value1; + this.f2 = value2; + this.f3 = value3; + this.f4 = value4; + this.f5 = value5; + this.f6 = value6; + this.f7 = value7; + this.f8 = value8; + this.f9 = value9; + this.f10 = value10; + this.f11 = value11; + this.f12 = value12; + this.f13 = value13; + } + + + // ------------------------------------------------------------------------------------------------- + // standard utilities + // ------------------------------------------------------------------------------------------------- + + /** + * Creates a string representation of the tuple in the form + * (f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13), + * where the individual fields are the value returned by calling {@link Object#toString} on that field. + * @return The string representation of the tuple. + */ + @Override + public String toString() { + return "(" + StringUtils.arrayAwareToString(this.f0) + + "," + StringUtils.arrayAwareToString(this.f1) + + "," + StringUtils.arrayAwareToString(this.f2) + + "," + StringUtils.arrayAwareToString(this.f3) + + "," + StringUtils.arrayAwareToString(this.f4) + + "," + StringUtils.arrayAwareToString(this.f5) + + "," + StringUtils.arrayAwareToString(this.f6) + + "," + StringUtils.arrayAwareToString(this.f7) + + "," + StringUtils.arrayAwareToString(this.f8) + + "," + StringUtils.arrayAwareToString(this.f9) + + "," + StringUtils.arrayAwareToString(this.f10) + + "," + StringUtils.arrayAwareToString(this.f11) + + "," + StringUtils.arrayAwareToString(this.f12) + + "," + StringUtils.arrayAwareToString(this.f13) + + ")"; + } + + /** + * Deep equality for tuples by calling equals() on the tuple members + * @param o the object checked for equality + * @return true if this is equal to o. + */ + @Override + public boolean equals(Object o) { + if(this == o) { return true; } + if (!(o instanceof Tuple14)) { return false; } + @SuppressWarnings("rawtypes") + Tuple14 tuple = (Tuple14) o; + if (f0 != null ? !f0.equals(tuple.f0) : tuple.f0 != null) { return false; } + if (f1 != null ? !f1.equals(tuple.f1) : tuple.f1 != null) { return false; } + if (f2 != null ? !f2.equals(tuple.f2) : tuple.f2 != null) { return false; } + if (f3 != null ? !f3.equals(tuple.f3) : tuple.f3 != null) { return false; } + if (f4 != null ? !f4.equals(tuple.f4) : tuple.f4 != null) { return false; } + if (f5 != null ? !f5.equals(tuple.f5) : tuple.f5 != null) { return false; } + if (f6 != null ? !f6.equals(tuple.f6) : tuple.f6 != null) { return false; } + if (f7 != null ? !f7.equals(tuple.f7) : tuple.f7 != null) { return false; } + if (f8 != null ? !f8.equals(tuple.f8) : tuple.f8 != null) { return false; } + if (f9 != null ? !f9.equals(tuple.f9) : tuple.f9 != null) { return false; } + if (f10 != null ? !f10.equals(tuple.f10) : tuple.f10 != null) { return false; } + if (f11 != null ? !f11.equals(tuple.f11) : tuple.f11 != null) { return false; } + if (f12 != null ? !f12.equals(tuple.f12) : tuple.f12 != null) { return false; } + if (f13 != null ? !f13.equals(tuple.f13) : tuple.f13 != null) { return false; } + return true; + } + + @Override + public int hashCode() { + int result = f0 != null ? f0.hashCode() : 0; + result = 31 * result + (f1 != null ? f1.hashCode() : 0); + result = 31 * result + (f2 != null ? f2.hashCode() : 0); + result = 31 * result + (f3 != null ? f3.hashCode() : 0); + result = 31 * result + (f4 != null ? f4.hashCode() : 0); + result = 31 * result + (f5 != null ? f5.hashCode() : 0); + result = 31 * result + (f6 != null ? f6.hashCode() : 0); + result = 31 * result + (f7 != null ? f7.hashCode() : 0); + result = 31 * result + (f8 != null ? f8.hashCode() : 0); + result = 31 * result + (f9 != null ? f9.hashCode() : 0); + result = 31 * result + (f10 != null ? f10.hashCode() : 0); + result = 31 * result + (f11 != null ? f11.hashCode() : 0); + result = 31 * result + (f12 != null ? f12.hashCode() : 0); + result = 31 * result + (f13 != null ? f13.hashCode() : 0); + return result; + } + + /** + * Shallow tuple copy. + * @return A new Tuple with the same fields as this. + */ + @Override + @SuppressWarnings("unchecked") + 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, + this.f2, + this.f3, + this.f4, + this.f5, + this.f6, + this.f7, + this.f8, + this.f9, + this.f10, + this.f11, + 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); + } +}