SemanticPropUtil { public static SingleInputSemanticProperties addSourceFieldOffset(SingleInputSemanticProperties props, int numInputFields, int offset) { SingleInputSemanticProperties offsetProps = new SingleInputSemanticProperties(); if (props.getReadFields(0) != null) { FieldSet offsetReadFields = new FieldSet(); for (int r : props.getReadFields(0)) { offsetReadFields = offsetReadFields.addField(r + offset); } offsetProps.addReadFields(offsetReadFields); } for (int s = 0; s < numInputFields; s++) { FieldSet targetFields = props.getForwardingTargetFields(0, s); for (int t : targetFields) { offsetProps.addForwardedField(s + offset, t); } } return offsetProps; } 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 testAddSourceFieldOffset() { SingleInputSemanticProperties semProps = new SingleInputSemanticProperties(); semProps.addForwardedField(0, 1); semProps.addForwardedField(0, 4); semProps.addForwardedField(2, 0); semProps.addForwardedField(4, 3); semProps.addReadFields(new FieldSet(0,3)); SemanticProperties offsetProps = SemanticPropUtil.addSourceFieldOffset(semProps, 5, 0); assertTrue(offsetProps.getForwardingTargetFields(0, 0).size() == 2); assertTrue(offsetProps.getForwardingTargetFields(0, 0).contains(1)); assertTrue(offsetProps.getForwardingTargetFields(0, 0).contains(4)); assertTrue(offsetProps.getForwardingTargetFields(0, 1).size() == 0); assertTrue(offsetProps.getForwardingTargetFields(0, 2).size() == 1); assertTrue(offsetProps.getForwardingTargetFields(0, 2).contains(0)); assertTrue(offsetProps.getForwardingTargetFields(0, 3).size() == 0); assertTrue(offsetProps.getForwardingTargetFields(0, 4).size() == 1); assertTrue(offsetProps.getForwardingTargetFields(0, 4).contains(3)); assertTrue(offsetProps.getReadFields(0).size() == 2); assertTrue(offsetProps.getReadFields(0).contains(0)); assertTrue(offsetProps.getReadFields(0).contains(3)); offsetProps = SemanticPropUtil.addSourceFieldOffset(semProps, 5, 3); assertTrue(offsetProps.getForwardingTargetFields(0, 0).size() == 0); assertTrue(offsetProps.getForwardingTargetFields(0, 1).size() == 0); assertTrue(offsetProps.getForwardingTargetFields(0, 2).size() == 0); assertTrue(offsetProps.getForwardingTargetFields(0, 3).size() == 2); assertTrue(offsetProps.getForwardingTargetFields(0, 3).contains(1)); assertTrue(offsetProps.getForwardingTargetFields(0, 3).contains(4)); assertTrue(offsetProps.getForwardingTargetFields(0, 4).size() == 0); assertTrue(offsetProps.getForwardingTargetFields(0, 5).size() == 1); assertTrue(offsetProps.getForwardingTargetFields(0, 5).contains(0)); assertTrue(offsetProps.getForwardingTargetFields(0, 6).size() == 0); assertTrue(offsetProps.getForwardingTargetFields(0, 7).size() == 1); assertTrue(offsetProps.getForwardingTargetFields(0, 7).contains(3)); assertTrue(offsetProps.getReadFields(0).size() == 2); assertTrue(offsetProps.getReadFields(0).contains(3)); assertTrue(offsetProps.getReadFields(0).contains(6)); semProps = new SingleInputSemanticProperties(); SemanticPropUtil.addSourceFieldOffset(semProps, 1, 0); semProps = new SingleInputSemanticProperties(); semProps.addForwardedField(0, 0); semProps.addForwardedField(1, 2); semProps.addForwardedField(2, 4); offsetProps = SemanticPropUtil.addSourceFieldOffset(semProps, 3, 2); assertTrue(offsetProps.getForwardingTargetFields(0, 0).size() == 0); assertTrue(offsetProps.getForwardingTargetFields(0, 1).size() == 0); assertTrue(offsetProps.getForwardingTargetFields(0, 2).size() == 1); assertTrue(offsetProps.getForwardingTargetFields(0, 2).contains(0)); assertTrue(offsetProps.getForwardingTargetFields(0, 3).size() == 1); assertTrue(offsetProps.getForwardingTargetFields(0, 3).contains(2)); assertTrue(offsetProps.getForwardingTargetFields(0, 4).size() == 1); assertTrue(offsetProps.getForwardingTargetFields(0, 4).contains(4)); }