SemanticPropUtil { public static SingleInputSemanticProperties createProjectionPropertiesSingle(int[] fields, CompositeType<?> inType) { Character.isJavaIdentifierStart(1); SingleInputSemanticProperties ssp = new SingleInputSemanticProperties(); int[] sourceOffsets = new int[inType.getArity()]; sourceOffsets[0] = 0; for(int i=1; i<inType.getArity(); i++) { sourceOffsets[i] = inType.getTypeAt(i-1).getTotalFields() + sourceOffsets[i-1]; } int targetOffset = 0; for(int i=0; i<fields.length; i++) { int sourceOffset = sourceOffsets[fields[i]]; int numFieldsToCopy = inType.getTypeAt(fields[i]).getTotalFields(); for(int j=0; j<numFieldsToCopy; j++) { ssp.addForwardedField(sourceOffset+j, targetOffset+j); } targetOffset += numFieldsToCopy; } return ssp; } private  SemanticPropUtil(); static SingleInputSemanticProperties createProjectionPropertiesSingle(int[] fields, CompositeType<?> inType); static DualInputSemanticProperties createProjectionPropertiesDual(
			int[] fields, boolean[] isFromFirst, TypeInformation<?> inType1, TypeInformation<?> inType2); static SingleInputSemanticProperties addSourceFieldOffset(SingleInputSemanticProperties props,
																		int numInputFields, int offset); static DualInputSemanticProperties addSourceFieldOffsets(DualInputSemanticProperties props,
																	int numInputFields1, int numInputFields2,
																	int offset1, int offset2); static SingleInputSemanticProperties getSemanticPropsSingle(
			Set<Annotation> set, TypeInformation<?> inType, TypeInformation<?> outType); static DualInputSemanticProperties getSemanticPropsDual(
			Set<Annotation> set, TypeInformation<?> inType1, TypeInformation<?> inType2, TypeInformation<?> outType); static void getSemanticPropsSingleFromString(SingleInputSemanticProperties result,
														String[] forwarded, String[] nonForwarded, String[] readSet,
														TypeInformation<?> inType, TypeInformation<?> outType); static void getSemanticPropsSingleFromString(SingleInputSemanticProperties result,
			String[] forwarded, String[] nonForwarded, String[] readSet,
			TypeInformation<?> inType, TypeInformation<?> outType,
			boolean skipIncompatibleTypes); static void getSemanticPropsDualFromString(DualInputSemanticProperties result,
			String[] forwardedFirst, String[] forwardedSecond,
			String[] nonForwardedFirst, String[] nonForwardedSecond, String[]
			readFieldsFirst, String[] readFieldsSecond,
			TypeInformation<?> inType1, TypeInformation<?> inType2, TypeInformation<?> outType); static void getSemanticPropsDualFromString(DualInputSemanticProperties result,
			String[] forwardedFirst, String[] forwardedSecond,
			String[] nonForwardedFirst, String[] nonForwardedSecond, String[]
			readFieldsFirst, String[] readFieldsSecond,
			TypeInformation<?> inType1, TypeInformation<?> inType2, TypeInformation<?> outType,
			boolean skipIncompatibleTypes);  }
@Test public void testSingleProjectionProperties() { int[] pMap = new int[] {3,0,4}; SingleInputSemanticProperties sp = SemanticPropUtil.createProjectionPropertiesSingle(pMap, (CompositeType<?>) fiveIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 4).contains(2)); pMap = new int[] {2,2,1,1}; sp = SemanticPropUtil.createProjectionPropertiesSingle(pMap, (CompositeType<?>) fiveIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 1).size() == 2); assertTrue(sp.getForwardingTargetFields(0, 1).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 2).size() == 2); assertTrue(sp.getForwardingTargetFields(0, 2).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(1)); pMap = new int[] {2,0}; sp = SemanticPropUtil.createProjectionPropertiesSingle(pMap, (CompositeType<?>) nestedTupleType); assertTrue(sp.getForwardingTargetFields(0, 4).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 0).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(3)); pMap = new int[] {2,0,1}; sp = SemanticPropUtil.createProjectionPropertiesSingle(pMap, (CompositeType<?>) deepNestedTupleType); assertTrue(sp.getForwardingTargetFields(0, 6).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 0).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(4)); assertTrue(sp.getForwardingTargetFields(0, 4).contains(5)); assertTrue(sp.getForwardingTargetFields(0, 5).contains(6)); pMap = new int[] {2, 1}; sp = SemanticPropUtil.createProjectionPropertiesSingle(pMap, (CompositeType<?>) pojoInTupleType); assertTrue(sp.getForwardingTargetFields(0, 2).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 4).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 5).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(4)); }