Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/***********************************************************************************************************************
*
* Copyright (C) 2010-2013 by the Stratosphere project (http://stratosphere.eu)
*
* Licensed 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 eu.stratosphere.api.java.operators;
import java.util.Arrays;
import eu.stratosphere.api.common.functions.GenericCrosser;
import eu.stratosphere.api.common.operators.BinaryOperatorInformation;
import eu.stratosphere.api.common.operators.Operator;
import eu.stratosphere.api.common.operators.base.CrossOperatorBase;
import eu.stratosphere.api.java.DataSet;
import eu.stratosphere.api.java.functions.CrossFunction;
import eu.stratosphere.api.java.typeutils.TupleTypeInfo;
import eu.stratosphere.api.java.typeutils.TypeExtractor;
//CHECKSTYLE.OFF: AvoidStarImport - Needed for TupleGenerator
import eu.stratosphere.api.java.tuple.*;
import eu.stratosphere.types.TypeInformation;
//CHECKSTYLE.ON: AvoidStarImport
/**
* A {@link DataSet} that is the result of a Cross transformation.
*
* @param The type of the first input DataSet of the Cross transformation.
* @param The type of the second input DataSet of the Cross transformation.
* @param The type of the result of the Cross transformation.
*
* @see DataSet
*/
public class CrossOperator extends TwoInputUdfOperator> {
private final CrossFunction function;
protected CrossOperator(DataSet input1, DataSet input2,
CrossFunction function,
TypeInformation returnType)
{
super(input1, input2, returnType);
this.function = function;
extractSemanticAnnotationsFromUdf(function.getClass());
}
@Override
protected eu.stratosphere.api.common.operators.base.CrossOperatorBase> translateToDataFlow(Operator input1, Operator input2) {
String name = getName() != null ? getName() : function.getClass().getName();
// create operator
CrossOperatorBase> po =
new CrossOperatorBase>(function, new BinaryOperatorInformation(getInput1Type(), getInput2Type(), getResultType()), name);
// set inputs
po.setFirstInput(input1);
po.setSecondInput(input2);
// set dop
po.setDegreeOfParallelism(this.getParallelism());
return po;
}
// --------------------------------------------------------------------------------------------
// Builder classes for incremental construction
// --------------------------------------------------------------------------------------------
/**
* A Cross transformation that wraps pairs of crossed elements into {@link Tuple2}.
* It also represents the {@link DataSet} that is the result of a Cross transformation.
*
* @param The type of the first input DataSet of the Cross transformation.
* @param The type of the second input DataSet of the Cross transformation.
* @param The type of the result of the Cross transformation.
*
* @see Tuple2
* @see DataSet
*/
public static final class DefaultCross extends CrossOperator> {
private final DataSet input1;
private final DataSet input2;
public DefaultCross(DataSet input1, DataSet input2) {
super(input1, input2, (CrossFunction>) new DefaultCrossFunction(),
new TupleTypeInfo>(input1.getType(), input2.getType()));
if (input1 == null || input2 == null) {
throw new NullPointerException();
}
this.input1 = input1;
this.input2 = input2;
}
/**
* Finalizes a Cross transformation by applying a {@link CrossFunction} to each pair of crossed elements.
* Each CrossFunction call returns exactly one element.
*
* @param function The CrossFunction that is called for each pair of crossed elements.
* @return An CrossOperator that represents the crossed result DataSet
*
* @see CrossFunction
* @see DataSet
*/
public CrossOperator with(CrossFunction function) {
TypeInformation returnType = TypeExtractor.getCrossReturnTypes(function, input1.getType(), input2.getType());
return new CrossOperator(input1, input2, function, returnType);
}
/**
* Initiates a ProjectCross transformation and projects the first cross input
* If the first cross input is a {@link Tuple} {@link DataSet}, fields can be selected by their index.
* If the first cross input is not a Tuple DataSet, no parameters should be passed.
*
* Fields of the first and second input can be added by chaining the method calls of
* {@link CrossProjection#projectFirst(int...)} and {@link CrossProjection#projectSecond(int...)}.
*
* @param fieldIndexes If the first input is a Tuple DataSet, the indexes of the selected fields.
* For a non-Tuple DataSet, do not provide parameters.
* The order of fields in the output tuple is defined by to the order of field indexes.
* @return A CrossProjection that needs to be converted into a {@link ProjectCross} to complete the
* Cross transformation by calling {@link CrossProjection#types()}.
*
* @see Tuple
* @see DataSet
* @see CrossProjection
* @see ProjectCross
*/
public CrossProjection projectFirst(int... firstFieldIndexes) {
return new CrossProjection(input1, input2, firstFieldIndexes, null);
}
/**
* Initiates a ProjectCross transformation and projects the second cross input
* If the second cross input is a {@link Tuple} {@link DataSet}, fields can be selected by their index.
* If the second cross input is not a Tuple DataSet, no parameters should be passed.
*
* Fields of the first and second input can be added by chaining the method calls of
* {@link CrossProjection#projectFirst(int...)} and {@link CrossProjection#projectSecond(int...)}.
*
* @param fieldIndexes If the second input is a Tuple DataSet, the indexes of the selected fields.
* For a non-Tuple DataSet, do not provide parameters.
* The order of fields in the output tuple is defined by to the order of field indexes.
* @return A CrossProjection that needs to be converted into a {@link ProjectCross} to complete the
* Cross transformation by calling {@link CrossProjection#types()}.
*
* @see Tuple
* @see DataSet
* @see CrossProjection
* @see ProjectCross
*/
public CrossProjection projectSecond(int... secondFieldIndexes) {
return new CrossProjection(input1, input2, null, secondFieldIndexes);
}
}
/**
* A Cross transformation that projects crossing elements or fields of crossing {@link Tuple Tuples}
* into result {@link Tuple Tuples}.
* It also represents the {@link DataSet} that is the result of a Cross transformation.
*
* @param The type of the first input DataSet of the Cross transformation.
* @param The type of the second input DataSet of the Cross transformation.
* @param The type of the result of the Cross transformation.
*
* @see Tuple
* @see DataSet
*/
private static final class ProjectCross extends CrossOperator {
protected ProjectCross(DataSet input1, DataSet input2, int[] fields, boolean[] isFromFirst, TupleTypeInfo returnType) {
super(input1, input2,
new ProjectCrossFunction(fields, isFromFirst, returnType.createSerializer().createInstance()), returnType);
}
}
public static final class ProjectCrossFunction extends CrossFunction {
private static final long serialVersionUID = 1L;
private final int[] fields;
private final boolean[] isFromFirst;
private final R outTuple;
/**
* Instantiates and configures a ProjectCrossFunction.
* Creates output tuples by copying fields of crossed input tuples (or a full input object) into an output tuple.
*
* @param fields List of indexes fields that should be copied to the output tuple.
* If the full input object should be copied (for example in case of a non-tuple input) the index should be -1.
* @param isFromFirst List of flags indicating whether the field should be copied from the first (true) or the second (false) input.
* @param outTupleInstance An instance of an output tuple.
*/
private ProjectCrossFunction(int[] fields, boolean[] isFromFirst, R outTupleInstance) {
if(fields.length != isFromFirst.length) {
throw new IllegalArgumentException("Fields and isFromFirst arrays must have same length!");
}
this.fields = fields;
this.isFromFirst = isFromFirst;
this.outTuple = outTupleInstance;
}
public R cross(T1 in1, T2 in2) {
for(int i=0; i= 0) {
outTuple.setField(((Tuple)in1).getField(fields[i]), i);
} else {
outTuple.setField(in1, i);
}
} else {
if(fields[i] >= 0) {
outTuple.setField(((Tuple)in2).getField(fields[i]), i);
} else {
outTuple.setField(in2, i);
}
}
}
return outTuple;
}
}
public static final class CrossProjection {
private final DataSet ds1;
private final DataSet ds2;
private int[] fieldIndexes;
private boolean[] isFieldInFirst;
private final int numFieldsDs1;
private final int numFieldsDs2;
public CrossProjection(DataSet ds1, DataSet ds2, int[] firstFieldIndexes, int[] secondFieldIndexes) {
this.ds1 = ds1;
this.ds2 = ds2;
boolean isFirstTuple;
boolean isSecondTuple;
if(ds1.getType() instanceof TupleTypeInfo) {
numFieldsDs1 = ((TupleTypeInfo>)ds1.getType()).getArity();
isFirstTuple = true;
} else {
numFieldsDs1 = 1;
isFirstTuple = false;
}
if(ds2.getType() instanceof TupleTypeInfo) {
numFieldsDs2 = ((TupleTypeInfo>)ds2.getType()).getArity();
isSecondTuple = true;
} else {
numFieldsDs2 = 1;
isSecondTuple = false;
}
boolean isTuple;
boolean firstInput;
if(firstFieldIndexes != null && secondFieldIndexes == null) {
// index array for first input is provided
firstInput = true;
isTuple = isFirstTuple;
this.fieldIndexes = firstFieldIndexes;
if(this.fieldIndexes.length == 0) {
// no indexes provided, treat tuple as regular object
isTuple = false;
}
} else if (firstFieldIndexes == null && secondFieldIndexes != null) {
// index array for second input is provided
firstInput = false;
isTuple = isSecondTuple;
this.fieldIndexes = secondFieldIndexes;
if(this.fieldIndexes.length == 0) {
// no indexes provided, treat tuple as regular object
isTuple = false;
}
} else if (firstFieldIndexes == null && secondFieldIndexes == null) {
throw new IllegalArgumentException("You must provide at least one field index array.");
} else {
throw new IllegalArgumentException("You must provide at most one field index array.");
}
if(!isTuple && this.fieldIndexes.length != 0) {
// field index provided for non-Tuple input
throw new IllegalArgumentException("Input is not a Tuple. Call projectFirst() (or projectSecond()) without arguments to include it.");
} else if(this.fieldIndexes.length > 22) {
throw new IllegalArgumentException("You may select only up to twenty-two (22) fields.");
}
if(isTuple) {
this.isFieldInFirst = new boolean[this.fieldIndexes.length];
// check field indexes and adapt to position in tuple
int maxFieldIndex = firstInput ? numFieldsDs1 : numFieldsDs2;
for(int i=0; i maxFieldIndex - 1) {
throw new IndexOutOfBoundsException("Provided field index is out of bounds of input tuple.");
}
if(firstInput) {
this.isFieldInFirst[i] = true;
} else {
this.isFieldInFirst[i] = false;
}
}
} else {
this.isFieldInFirst = new boolean[]{firstInput};
this.fieldIndexes = new int[]{-1};
}
}
/**
* Continues a ProjectCross transformation and adds fields of the first cross input.
* If the first cross input is a {@link Tuple} {@link DataSet}, fields can be selected by their index.
* If the first cross input is not a Tuple DataSet, no parameters should be passed.
*
* Fields of the first and second input can be added by chaining the method calls of
* {@link CrossProjection#projectFirst(int...)} and {@link CrossProjection#projectSecond(int...)}.
*
* @param fieldIndexes If the first input is a Tuple DataSet, the indexes of the selected fields.
* For a non-Tuple DataSet, do not provide parameters.
* The order of fields in the output tuple is defined by to the order of field indexes.
* @return A CrossProjection that needs to be converted into a {@link ProjectOperator} to complete the
* ProjectCross transformation by calling {@link CrossProjection#types()}.
*
* @see Tuple
* @see DataSet
* @see CrossProjection
* @see ProjectCross
*/
public CrossProjection projectFirst(int... firstFieldIndexes) {
boolean isFirstTuple;
if(ds1.getType() instanceof TupleTypeInfo && firstFieldIndexes.length > 0) {
isFirstTuple = true;
} else {
isFirstTuple = false;
}
if(!isFirstTuple && firstFieldIndexes.length != 0) {
// field index provided for non-Tuple input
throw new IllegalArgumentException("Input is not a Tuple. Call projectFirst() without arguments to include it.");
} else if(firstFieldIndexes.length > (22 - this.fieldIndexes.length)) {
// to many field indexes provided
throw new IllegalArgumentException("You may select only up to twenty-two (22) fields in total.");
}
int offset = this.fieldIndexes.length;
if(isFirstTuple) {
// extend index and flag arrays
this.fieldIndexes = Arrays.copyOf(this.fieldIndexes, this.fieldIndexes.length + firstFieldIndexes.length);
this.isFieldInFirst = Arrays.copyOf(this.isFieldInFirst, this.isFieldInFirst.length + firstFieldIndexes.length);
// copy field indexes
int maxFieldIndex = numFieldsDs1;
for(int i = 0; i < firstFieldIndexes.length; i++) {
// check if indexes in range
if(firstFieldIndexes[i] > maxFieldIndex - 1) {
throw new IndexOutOfBoundsException("Provided field index is out of bounds of input tuple.");
}
this.isFieldInFirst[offset + i] = true;
this.fieldIndexes[offset + i] = firstFieldIndexes[i];
}
} else {
// extend index and flag arrays
this.fieldIndexes = Arrays.copyOf(this.fieldIndexes, this.fieldIndexes.length + 1);
this.isFieldInFirst = Arrays.copyOf(this.isFieldInFirst, this.isFieldInFirst.length + 1);
// add input object to output tuple
this.isFieldInFirst[offset] = true;
this.fieldIndexes[offset] = -1;
}
return this;
}
/**
* Continues a ProjectCross transformation and adds fields of the second cross input.
* If the second cross input is a {@link Tuple} {@link DataSet}, fields can be selected by their index.
* If the second cross input is not a Tuple DataSet, no parameters should be passed.
*
* Fields of the first and second input can be added by chaining the method calls of
* {@link CrossProjection#projectFirst(int...)} and {@link CrossProjection#projectSecond(int...)}.
*
* @param fieldIndexes If the second input is a Tuple DataSet, the indexes of the selected fields.
* For a non-Tuple DataSet, do not provide parameters.
* The order of fields in the output tuple is defined by to the order of field indexes.
* @return A CrossProjection that needs to be converted into a {@link ProjectOperator} to complete the
* ProjectCross transformation by calling {@link CrossProjection#types()}.
*
* @see Tuple
* @see DataSet
* @see CrossProjection
* @see ProjectCross
*/
public CrossProjection projectSecond(int... secondFieldIndexes) {
boolean isSecondTuple;
if(ds2.getType() instanceof TupleTypeInfo && secondFieldIndexes.length > 0) {
isSecondTuple = true;
} else {
isSecondTuple = false;
}
if(!isSecondTuple && secondFieldIndexes.length != 0) {
// field index provided for non-Tuple input
throw new IllegalArgumentException("Input is not a Tuple. Call projectSecond() without arguments to include it.");
} else if(secondFieldIndexes.length > (22 - this.fieldIndexes.length)) {
// to many field indexes provided
throw new IllegalArgumentException("You may select only up to twenty-two (22) fields in total.");
}
int offset = this.fieldIndexes.length;
if(isSecondTuple) {
// extend index and flag arrays
this.fieldIndexes = Arrays.copyOf(this.fieldIndexes, this.fieldIndexes.length + secondFieldIndexes.length);
this.isFieldInFirst = Arrays.copyOf(this.isFieldInFirst, this.isFieldInFirst.length + secondFieldIndexes.length);
// copy field indexes
int maxFieldIndex = numFieldsDs2;
for(int i = 0; i < secondFieldIndexes.length; i++) {
// check if indexes in range
if(secondFieldIndexes[i] > maxFieldIndex - 1) {
throw new IndexOutOfBoundsException("Provided field index is out of bounds of input tuple.");
}
this.isFieldInFirst[offset + i] = false;
this.fieldIndexes[offset + i] = secondFieldIndexes[i];
}
} else {
// extend index and flag arrays
this.fieldIndexes = Arrays.copyOf(this.fieldIndexes, this.fieldIndexes.length + 1);
this.isFieldInFirst = Arrays.copyOf(this.isFieldInFirst, this.isFieldInFirst.length + 1);
// add input object to output tuple
this.isFieldInFirst[offset] = false;
this.fieldIndexes[offset] = -1;
}
return this;
}
// --------------------------------------------------------------------------------------------
// The following lines are generated.
// --------------------------------------------------------------------------------------------
// BEGIN_OF_TUPLE_DEPENDENT_CODE
// GENERATED FROM eu.stratosphere.api.java.tuple.TupleGenerator.
/**
* Projects a pair of crossed elements to a {@link Tuple} with the previously selected fields.
* Requires the classes of the fields of the resulting tuples.
*
* @param type0 The class of field '0' of the result tuples.
* @return The projected data set.
*
* @see Tuple
* @see DataSet
*/
public ProjectCross> types(Class type0) {
Class>[] types = {type0};
if(types.length != this.fieldIndexes.length) {
throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
}
TypeInformation>[] fTypes = extractFieldTypes(fieldIndexes, types);
TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);
return new ProjectCross>(this.ds1, this.ds2, this.fieldIndexes, this.isFieldInFirst, tType);
}
/**
* Projects a pair of crossed elements to a {@link Tuple} with the previously selected fields.
* Requires the classes of the fields of the resulting tuples.
*
* @param type0 The class of field '0' of the result tuples.
* @param type1 The class of field '1' of the result tuples.
* @return The projected data set.
*
* @see Tuple
* @see DataSet
*/
public ProjectCross> types(Class type0, Class type1) {
Class>[] types = {type0, type1};
if(types.length != this.fieldIndexes.length) {
throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
}
TypeInformation>[] fTypes = extractFieldTypes(fieldIndexes, types);
TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);
return new ProjectCross>(this.ds1, this.ds2, this.fieldIndexes, this.isFieldInFirst, tType);
}
/**
* Projects a pair of crossed elements to a {@link Tuple} with the previously selected fields.
* Requires the classes of the fields of the resulting tuples.
*
* @param type0 The class of field '0' of the result tuples.
* @param type1 The class of field '1' of the result tuples.
* @param type2 The class of field '2' of the result tuples.
* @return The projected data set.
*
* @see Tuple
* @see DataSet
*/
public ProjectCross> types(Class type0, Class type1, Class type2) {
Class>[] types = {type0, type1, type2};
if(types.length != this.fieldIndexes.length) {
throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
}
TypeInformation>[] fTypes = extractFieldTypes(fieldIndexes, types);
TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);
return new ProjectCross>(this.ds1, this.ds2, this.fieldIndexes, this.isFieldInFirst, tType);
}
/**
* Projects a pair of crossed elements to a {@link Tuple} with the previously selected fields.
* Requires the classes of the fields of the resulting tuples.
*
* @param type0 The class of field '0' of the result tuples.
* @param type1 The class of field '1' of the result tuples.
* @param type2 The class of field '2' of the result tuples.
* @param type3 The class of field '3' of the result tuples.
* @return The projected data set.
*
* @see Tuple
* @see DataSet
*/
public ProjectCross> types(Class type0, Class type1, Class type2, Class type3) {
Class>[] types = {type0, type1, type2, type3};
if(types.length != this.fieldIndexes.length) {
throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
}
TypeInformation>[] fTypes = extractFieldTypes(fieldIndexes, types);
TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);
return new ProjectCross>(this.ds1, this.ds2, this.fieldIndexes, this.isFieldInFirst, tType);
}
/**
* Projects a pair of crossed elements to a {@link Tuple} with the previously selected fields.
* Requires the classes of the fields of the resulting tuples.
*
* @param type0 The class of field '0' of the result tuples.
* @param type1 The class of field '1' of the result tuples.
* @param type2 The class of field '2' of the result tuples.
* @param type3 The class of field '3' of the result tuples.
* @param type4 The class of field '4' of the result tuples.
* @return The projected data set.
*
* @see Tuple
* @see DataSet
*/
public ProjectCross> types(Class type0, Class type1, Class type2, Class type3, Class type4) {
Class>[] types = {type0, type1, type2, type3, type4};
if(types.length != this.fieldIndexes.length) {
throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
}
TypeInformation>[] fTypes = extractFieldTypes(fieldIndexes, types);
TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);
return new ProjectCross>(this.ds1, this.ds2, this.fieldIndexes, this.isFieldInFirst, tType);
}
/**
* Projects a pair of crossed elements to a {@link Tuple} with the previously selected fields.
* Requires the classes of the fields of the resulting tuples.
*
* @param type0 The class of field '0' of the result tuples.
* @param type1 The class of field '1' of the result tuples.
* @param type2 The class of field '2' of the result tuples.
* @param type3 The class of field '3' of the result tuples.
* @param type4 The class of field '4' of the result tuples.
* @param type5 The class of field '5' of the result tuples.
* @return The projected data set.
*
* @see Tuple
* @see DataSet
*/
public ProjectCross> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5) {
Class>[] types = {type0, type1, type2, type3, type4, type5};
if(types.length != this.fieldIndexes.length) {
throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
}
TypeInformation>[] fTypes = extractFieldTypes(fieldIndexes, types);
TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);
return new ProjectCross>(this.ds1, this.ds2, this.fieldIndexes, this.isFieldInFirst, tType);
}
/**
* Projects a pair of crossed elements to a {@link Tuple} with the previously selected fields.
* Requires the classes of the fields of the resulting tuples.
*
* @param type0 The class of field '0' of the result tuples.
* @param type1 The class of field '1' of the result tuples.
* @param type2 The class of field '2' of the result tuples.
* @param type3 The class of field '3' of the result tuples.
* @param type4 The class of field '4' of the result tuples.
* @param type5 The class of field '5' of the result tuples.
* @param type6 The class of field '6' of the result tuples.
* @return The projected data set.
*
* @see Tuple
* @see DataSet
*/
public ProjectCross> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6) {
Class>[] types = {type0, type1, type2, type3, type4, type5, type6};
if(types.length != this.fieldIndexes.length) {
throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
}
TypeInformation>[] fTypes = extractFieldTypes(fieldIndexes, types);
TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);
return new ProjectCross>(this.ds1, this.ds2, this.fieldIndexes, this.isFieldInFirst, tType);
}
/**
* Projects a pair of crossed elements to a {@link Tuple} with the previously selected fields.
* Requires the classes of the fields of the resulting tuples.
*
* @param type0 The class of field '0' of the result tuples.
* @param type1 The class of field '1' of the result tuples.
* @param type2 The class of field '2' of the result tuples.
* @param type3 The class of field '3' of the result tuples.
* @param type4 The class of field '4' of the result tuples.
* @param type5 The class of field '5' of the result tuples.
* @param type6 The class of field '6' of the result tuples.
* @param type7 The class of field '7' of the result tuples.
* @return The projected data set.
*
* @see Tuple
* @see DataSet
*/
public ProjectCross> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7) {
Class>[] types = {type0, type1, type2, type3, type4, type5, type6, type7};
if(types.length != this.fieldIndexes.length) {
throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
}
TypeInformation>[] fTypes = extractFieldTypes(fieldIndexes, types);
TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);
return new ProjectCross>(this.ds1, this.ds2, this.fieldIndexes, this.isFieldInFirst, tType);
}
/**
* Projects a pair of crossed elements to a {@link Tuple} with the previously selected fields.
* Requires the classes of the fields of the resulting tuples.
*
* @param type0 The class of field '0' of the result tuples.
* @param type1 The class of field '1' of the result tuples.
* @param type2 The class of field '2' of the result tuples.
* @param type3 The class of field '3' of the result tuples.
* @param type4 The class of field '4' of the result tuples.
* @param type5 The class of field '5' of the result tuples.
* @param type6 The class of field '6' of the result tuples.
* @param type7 The class of field '7' of the result tuples.
* @param type8 The class of field '8' of the result tuples.
* @return The projected data set.
*
* @see Tuple
* @see DataSet
*/
public ProjectCross> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8) {
Class>[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8};
if(types.length != this.fieldIndexes.length) {
throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
}
TypeInformation>[] fTypes = extractFieldTypes(fieldIndexes, types);
TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);
return new ProjectCross>(this.ds1, this.ds2, this.fieldIndexes, this.isFieldInFirst, tType);
}
/**
* Projects a pair of crossed elements to a {@link Tuple} with the previously selected fields.
* Requires the classes of the fields of the resulting tuples.
*
* @param type0 The class of field '0' of the result tuples.
* @param type1 The class of field '1' of the result tuples.
* @param type2 The class of field '2' of the result tuples.
* @param type3 The class of field '3' of the result tuples.
* @param type4 The class of field '4' of the result tuples.
* @param type5 The class of field '5' of the result tuples.
* @param type6 The class of field '6' of the result tuples.
* @param type7 The class of field '7' of the result tuples.
* @param type8 The class of field '8' of the result tuples.
* @param type9 The class of field '9' of the result tuples.
* @return The projected data set.
*
* @see Tuple
* @see DataSet
*/
public ProjectCross> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9) {
Class>[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9};
if(types.length != this.fieldIndexes.length) {
throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
}
TypeInformation>[] fTypes = extractFieldTypes(fieldIndexes, types);
TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);
return new ProjectCross>(this.ds1, this.ds2, this.fieldIndexes, this.isFieldInFirst, tType);
}
/**
* Projects a pair of crossed elements to a {@link Tuple} with the previously selected fields.
* Requires the classes of the fields of the resulting tuples.
*
* @param type0 The class of field '0' of the result tuples.
* @param type1 The class of field '1' of the result tuples.
* @param type2 The class of field '2' of the result tuples.
* @param type3 The class of field '3' of the result tuples.
* @param type4 The class of field '4' of the result tuples.
* @param type5 The class of field '5' of the result tuples.
* @param type6 The class of field '6' of the result tuples.
* @param type7 The class of field '7' of the result tuples.
* @param type8 The class of field '8' of the result tuples.
* @param type9 The class of field '9' of the result tuples.
* @param type10 The class of field '10' of the result tuples.
* @return The projected data set.
*
* @see Tuple
* @see DataSet
*/
public ProjectCross> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10) {
Class>[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10};
if(types.length != this.fieldIndexes.length) {
throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
}
TypeInformation>[] fTypes = extractFieldTypes(fieldIndexes, types);
TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);
return new ProjectCross>(this.ds1, this.ds2, this.fieldIndexes, this.isFieldInFirst, tType);
}
/**
* Projects a pair of crossed elements to a {@link Tuple} with the previously selected fields.
* Requires the classes of the fields of the resulting tuples.
*
* @param type0 The class of field '0' of the result tuples.
* @param type1 The class of field '1' of the result tuples.
* @param type2 The class of field '2' of the result tuples.
* @param type3 The class of field '3' of the result tuples.
* @param type4 The class of field '4' of the result tuples.
* @param type5 The class of field '5' of the result tuples.
* @param type6 The class of field '6' of the result tuples.
* @param type7 The class of field '7' of the result tuples.
* @param type8 The class of field '8' of the result tuples.
* @param type9 The class of field '9' of the result tuples.
* @param type10 The class of field '10' of the result tuples.
* @param type11 The class of field '11' of the result tuples.
* @return The projected data set.
*
* @see Tuple
* @see DataSet
*/
public ProjectCross> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11) {
Class>[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11};
if(types.length != this.fieldIndexes.length) {
throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
}
TypeInformation>[] fTypes = extractFieldTypes(fieldIndexes, types);
TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);
return new ProjectCross>(this.ds1, this.ds2, this.fieldIndexes, this.isFieldInFirst, tType);
}
/**
* Projects a pair of crossed elements to a {@link Tuple} with the previously selected fields.
* Requires the classes of the fields of the resulting tuples.
*
* @param type0 The class of field '0' of the result tuples.
* @param type1 The class of field '1' of the result tuples.
* @param type2 The class of field '2' of the result tuples.
* @param type3 The class of field '3' of the result tuples.
* @param type4 The class of field '4' of the result tuples.
* @param type5 The class of field '5' of the result tuples.
* @param type6 The class of field '6' of the result tuples.
* @param type7 The class of field '7' of the result tuples.
* @param type8 The class of field '8' of the result tuples.
* @param type9 The class of field '9' of the result tuples.
* @param type10 The class of field '10' of the result tuples.
* @param type11 The class of field '11' of the result tuples.
* @param type12 The class of field '12' of the result tuples.
* @return The projected data set.
*
* @see Tuple
* @see DataSet
*/
public ProjectCross> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11, Class type12) {
Class>[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12};
if(types.length != this.fieldIndexes.length) {
throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
}
TypeInformation>[] fTypes = extractFieldTypes(fieldIndexes, types);
TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);
return new ProjectCross>(this.ds1, this.ds2, this.fieldIndexes, this.isFieldInFirst, tType);
}
/**
* Projects a pair of crossed elements to a {@link Tuple} with the previously selected fields.
* Requires the classes of the fields of the resulting tuples.
*
* @param type0 The class of field '0' of the result tuples.
* @param type1 The class of field '1' of the result tuples.
* @param type2 The class of field '2' of the result tuples.
* @param type3 The class of field '3' of the result tuples.
* @param type4 The class of field '4' of the result tuples.
* @param type5 The class of field '5' of the result tuples.
* @param type6 The class of field '6' of the result tuples.
* @param type7 The class of field '7' of the result tuples.
* @param type8 The class of field '8' of the result tuples.
* @param type9 The class of field '9' of the result tuples.
* @param type10 The class of field '10' of the result tuples.
* @param type11 The class of field '11' of the result tuples.
* @param type12 The class of field '12' of the result tuples.
* @param type13 The class of field '13' of the result tuples.
* @return The projected data set.
*
* @see Tuple
* @see DataSet
*/
public ProjectCross> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11, Class type12, Class type13) {
Class>[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13};
if(types.length != this.fieldIndexes.length) {
throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
}
TypeInformation>[] fTypes = extractFieldTypes(fieldIndexes, types);
TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);
return new ProjectCross>(this.ds1, this.ds2, this.fieldIndexes, this.isFieldInFirst, tType);
}
/**
* Projects a pair of crossed elements to a {@link Tuple} with the previously selected fields.
* Requires the classes of the fields of the resulting tuples.
*
* @param type0 The class of field '0' of the result tuples.
* @param type1 The class of field '1' of the result tuples.
* @param type2 The class of field '2' of the result tuples.
* @param type3 The class of field '3' of the result tuples.
* @param type4 The class of field '4' of the result tuples.
* @param type5 The class of field '5' of the result tuples.
* @param type6 The class of field '6' of the result tuples.
* @param type7 The class of field '7' of the result tuples.
* @param type8 The class of field '8' of the result tuples.
* @param type9 The class of field '9' of the result tuples.
* @param type10 The class of field '10' of the result tuples.
* @param type11 The class of field '11' of the result tuples.
* @param type12 The class of field '12' of the result tuples.
* @param type13 The class of field '13' of the result tuples.
* @param type14 The class of field '14' of the result tuples.
* @return The projected data set.
*
* @see Tuple
* @see DataSet
*/
public ProjectCross> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11, Class type12, Class type13, Class type14) {
Class>[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14};
if(types.length != this.fieldIndexes.length) {
throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
}
TypeInformation>[] fTypes = extractFieldTypes(fieldIndexes, types);
TupleTypeInfo> tType = new TupleTypeInfo