Java Code Examples for org.apache.flink.streaming.api.graph.StreamEdge#getSelectedNames()

The following examples show how to use org.apache.flink.streaming.api.graph.StreamEdge#getSelectedNames() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DirectedOutput.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings({"unchecked", "rawtypes"})
public DirectedOutput(
		List<OutputSelector<OUT>> outputSelectors,
		List<? extends Tuple2<? extends Output<StreamRecord<OUT>>, StreamEdge>> outputs) {
	this.outputSelectors = outputSelectors.toArray(new OutputSelector[outputSelectors.size()]);

	this.allOutputs = new Output[outputs.size()];
	for (int i = 0; i < outputs.size(); i++) {
		allOutputs[i] = outputs.get(i).f0;
	}

	HashSet<Output<StreamRecord<OUT>>> selectAllOutputs = new HashSet<Output<StreamRecord<OUT>>>();
	HashMap<String, ArrayList<Output<StreamRecord<OUT>>>> outputMap = new HashMap<String, ArrayList<Output<StreamRecord<OUT>>>>();

	for (Tuple2<? extends Output<StreamRecord<OUT>>, StreamEdge> outputPair : outputs) {
		final Output<StreamRecord<OUT>> output = outputPair.f0;
		final StreamEdge edge = outputPair.f1;

		List<String> selectedNames = edge.getSelectedNames();

		if (selectedNames.isEmpty()) {
			selectAllOutputs.add(output);
		}
		else {
			for (String selectedName : selectedNames) {
				if (!outputMap.containsKey(selectedName)) {
					outputMap.put(selectedName, new ArrayList<Output<StreamRecord<OUT>>>());
					outputMap.get(selectedName).add(output);
				}
				else {
					if (!outputMap.get(selectedName).contains(output)) {
						outputMap.get(selectedName).add(output);
					}
				}
			}
		}
	}

	this.selectAllOutputs = selectAllOutputs.toArray(new Output[selectAllOutputs.size()]);

	this.outputMap = new HashMap<>();
	for (Map.Entry<String, ArrayList<Output<StreamRecord<OUT>>>> entry : outputMap.entrySet()) {
		Output<StreamRecord<OUT>>[] arr = entry.getValue().toArray(new Output[entry.getValue().size()]);
		this.outputMap.put(entry.getKey(), arr);
	}
}
 
Example 2
Source File: DirectedOutput.java    From flink with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings({"unchecked", "rawtypes"})
public DirectedOutput(
		List<OutputSelector<OUT>> outputSelectors,
		List<? extends Tuple2<? extends Output<StreamRecord<OUT>>, StreamEdge>> outputs) {
	this.outputSelectors = outputSelectors.toArray(new OutputSelector[outputSelectors.size()]);

	this.allOutputs = new Output[outputs.size()];
	for (int i = 0; i < outputs.size(); i++) {
		allOutputs[i] = outputs.get(i).f0;
	}

	HashSet<Output<StreamRecord<OUT>>> selectAllOutputs = new HashSet<Output<StreamRecord<OUT>>>();
	HashMap<String, ArrayList<Output<StreamRecord<OUT>>>> outputMap = new HashMap<String, ArrayList<Output<StreamRecord<OUT>>>>();

	for (Tuple2<? extends Output<StreamRecord<OUT>>, StreamEdge> outputPair : outputs) {
		final Output<StreamRecord<OUT>> output = outputPair.f0;
		final StreamEdge edge = outputPair.f1;

		List<String> selectedNames = edge.getSelectedNames();

		if (selectedNames.isEmpty()) {
			selectAllOutputs.add(output);
		}
		else {
			for (String selectedName : selectedNames) {
				if (!outputMap.containsKey(selectedName)) {
					outputMap.put(selectedName, new ArrayList<Output<StreamRecord<OUT>>>());
					outputMap.get(selectedName).add(output);
				}
				else {
					if (!outputMap.get(selectedName).contains(output)) {
						outputMap.get(selectedName).add(output);
					}
				}
			}
		}
	}

	this.selectAllOutputs = selectAllOutputs.toArray(new Output[selectAllOutputs.size()]);

	this.outputMap = new HashMap<>();
	for (Map.Entry<String, ArrayList<Output<StreamRecord<OUT>>>> entry : outputMap.entrySet()) {
		Output<StreamRecord<OUT>>[] arr = entry.getValue().toArray(new Output[entry.getValue().size()]);
		this.outputMap.put(entry.getKey(), arr);
	}
}
 
Example 3
Source File: DirectedOutput.java    From flink with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings({"unchecked", "rawtypes"})
public DirectedOutput(
		List<OutputSelector<OUT>> outputSelectors,
		List<? extends Tuple2<? extends Output<StreamRecord<OUT>>, StreamEdge>> outputs) {
	this.outputSelectors = outputSelectors.toArray(new OutputSelector[outputSelectors.size()]);

	this.allOutputs = new Output[outputs.size()];
	for (int i = 0; i < outputs.size(); i++) {
		allOutputs[i] = outputs.get(i).f0;
	}

	HashSet<Output<StreamRecord<OUT>>> selectAllOutputs = new HashSet<Output<StreamRecord<OUT>>>();
	HashMap<String, ArrayList<Output<StreamRecord<OUT>>>> outputMap = new HashMap<String, ArrayList<Output<StreamRecord<OUT>>>>();

	for (Tuple2<? extends Output<StreamRecord<OUT>>, StreamEdge> outputPair : outputs) {
		final Output<StreamRecord<OUT>> output = outputPair.f0;
		final StreamEdge edge = outputPair.f1;

		List<String> selectedNames = edge.getSelectedNames();

		if (selectedNames.isEmpty()) {
			selectAllOutputs.add(output);
		}
		else {
			for (String selectedName : selectedNames) {
				if (!outputMap.containsKey(selectedName)) {
					outputMap.put(selectedName, new ArrayList<Output<StreamRecord<OUT>>>());
					outputMap.get(selectedName).add(output);
				}
				else {
					if (!outputMap.get(selectedName).contains(output)) {
						outputMap.get(selectedName).add(output);
					}
				}
			}
		}
	}

	this.selectAllOutputs = selectAllOutputs.toArray(new Output[selectAllOutputs.size()]);

	this.outputMap = new HashMap<>();
	for (Map.Entry<String, ArrayList<Output<StreamRecord<OUT>>>> entry : outputMap.entrySet()) {
		Output<StreamRecord<OUT>>[] arr = entry.getValue().toArray(new Output[entry.getValue().size()]);
		this.outputMap.put(entry.getKey(), arr);
	}
}