Newer
Older
AlgebraicDataflowArchitectureModel / AlgebraicDataflowArchitectureModel / src / models / dataFlowModel / DataflowChannelGenerator.java
package models.dataFlowModel;

import java.util.HashSet;
import java.util.Set;

import models.dataConstraintModel.*;

public class DataflowChannelGenerator extends ChannelGenerator {
	protected Set<ChannelMember> inputChannelMembers = null;
	protected Set<ChannelMember> outputChannelMembers = null;
	
	public DataflowChannelGenerator() {
		inputChannelMembers = new HashSet<>();
		outputChannelMembers = new HashSet<>();
	}
	
	public Set<ChannelMember> getInputChannelMembers() {
		return inputChannelMembers;
	}
	
	public void setInputChannelMembers(Set<ChannelMember> inputChannelMembers) {
		this.inputChannelMembers = inputChannelMembers;
	}
	
	public void addInputChannelMember(ChannelMember inputChannelMember) {
		inputChannelMembers.add(inputChannelMember);
	}
	
	public Set<ChannelMember> getOutputChannelMembers() {
		return outputChannelMembers;
	}
	
	public void setOutputChannelMembers(Set<ChannelMember> outputChannelMembers) {
		this.outputChannelMembers = outputChannelMembers;
	}
	
	public void addOutputChannelMember(ChannelMember outputChannelMember) {
		outputChannelMembers.add(outputChannelMember);
	}
		
	public void addChannelMemberAsInput(ChannelMember groupDependentResource) {
		addChannelMember(groupDependentResource);
		addInputChannelMember(groupDependentResource);
	}
	
	public void addChannelMemberAsOutput(ChannelMember groupDependentResource) {
		addChannelMember(groupDependentResource);
		addOutputChannelMember(groupDependentResource);
	}
	
	public Set<IdentifierTemplate> getInputIdentifierTemplates() {
		Set<IdentifierTemplate> inputIdentifierTemplates = new HashSet<>();
		for (ChannelMember member: inputChannelMembers) {
			inputIdentifierTemplates.add(member.getIdentifierTemplate());
		}
		return inputIdentifierTemplates;
	}
	
	public Set<IdentifierTemplate> getOutputIdentifierTemplates() {
		Set<IdentifierTemplate> outputIdentifierTemplates = new HashSet<>();
		for (ChannelMember member: outputChannelMembers) {
			outputIdentifierTemplates.add(member.getIdentifierTemplate());
		}
		return outputIdentifierTemplates;
	}
}