/* * 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. // --------------------------------------------------------------
/** * A tuple with 4 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. * * <p>Warning: If you subclass Tuple4, then be sure to either * * <ul> * <li>not add any new fields, or * <li>make it a POJO, and always declare the element type of your DataStreams/DataSets to your * descendant type. (That is, if you have a "class Foo extends Tuple4", then don't use * instances of Foo in a DataStream<Tuple4> / DataSet<Tuple4>, but declare it as * DataStream<Foo> / DataSet<Foo>.) * </ul> * * @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 */ @Public publicclassTuple4<T0, T1, T2, T3> extendsTuple {
privatestaticfinallongserialVersionUID=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;
/** Creates a new tuple where all fields are null. */ publicTuple4() {}
/** * Creates a new tuple and assigns the given values to the tuple's fields. * * @param f0 The value for field 0 * @param f1 The value for field 1 * @param f2 The value for field 2 * @param f3 The value for field 3 */ publicTuple4(T0 f0, T1 f1, T2 f2, T3 f3) { this.f0 = f0; this.f1 = f1; this.f2 = f2; this.f3 = f3; }
/** * Sets new values to all fields of the tuple. * * @param f0 The value for field 0 * @param f1 The value for field 1 * @param f2 The value for field 2 * @param f3 The value for field 3 */ publicvoidsetFields(T0 f0, T1 f1, T2 f2, T3 f3) { this.f0 = f0; this.f1 = f1; this.f2 = f2; this.f3 = f3; }
// ------------------------------------------------------------------------------------------------- // standard utilities // -------------------------------------------------------------------------------------------------
/** * Creates a string representation of the tuple in the form (f0, f1, f2, f3), 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) + ")"; }
/** * 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 publicbooleanequals(Object o) { if (this == o) { returntrue; } if (!(o instanceof Tuple4)) { returnfalse; } @SuppressWarnings("rawtypes") Tuple4tuple= (Tuple4) o; if (f0 != null ? !f0.equals(tuple.f0) : tuple.f0 != null) { returnfalse; } if (f1 != null ? !f1.equals(tuple.f1) : tuple.f1 != null) { returnfalse; } if (f2 != null ? !f2.equals(tuple.f2) : tuple.f2 != null) { returnfalse; } if (f3 != null ? !f3.equals(tuple.f3) : tuple.f3 != null) { returnfalse; } returntrue; }
@Override publicinthashCode() { intresult= 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); return result; }
/** * Shallow tuple copy. * * @return A new Tuple with the same fields as this. */ @Override @SuppressWarnings("unchecked") public Tuple4<T0, T1, T2, T3> copy() { returnnewTuple4<>(this.f0, this.f1, this.f2, this.f3); }
/** * 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)} */ publicstatic <T0, T1, T2, T3> Tuple4<T0, T1, T2, T3> of(T0 f0, T1 f1, T2 f2, T3 f3) { returnnewTuple4<>(f0, f1, f2, f3); } }