// Adds an input adapter to the dependency chain. private void AddInputAdapter(IInputAdapter adapter, ISet <IAdapter> dependencyChain, IInputAdapter[] inputAdapterCollection, IActionAdapter[] actionAdapterCollection, IOutputAdapter[] outputAdapterCollection) { HashSet <MeasurementKey> outputMeasurementKeys = new HashSet <MeasurementKey>(adapter.OutputMeasurementKeys()); // Adds the adapter to the chain dependencyChain.Add(adapter); if ((object)actionAdapterCollection != null) { // Checks all action adapters to determine whether they also need to be // added to the chain as a result of this adapter being added to the chain foreach (IActionAdapter actionAdapter in actionAdapterCollection) { if (actionAdapter.RespectInputDemands && !dependencyChain.Contains(actionAdapter) && outputMeasurementKeys.Overlaps(actionAdapter.InputMeasurementKeys())) { AddActionAdapter(actionAdapter, dependencyChain, inputAdapterCollection, actionAdapterCollection, outputAdapterCollection); } } } if ((object)outputAdapterCollection != null) { // Checks all output adapters to determine whether they also need to be // added to the chain as a result of this adapter being added to the chain foreach (IOutputAdapter outputAdapter in outputAdapterCollection) { if (!dependencyChain.Contains(outputAdapter) && outputMeasurementKeys.Overlaps(outputAdapter.InputMeasurementKeys())) { AddOutputAdapter(outputAdapter, dependencyChain, inputAdapterCollection, actionAdapterCollection, outputAdapterCollection); } } } }
// Adds an input adapter to the dependency chain. private void AddInputAdapter(IInputAdapter adapter, ISet<IAdapter> dependencyChain, IInputAdapter[] inputAdapterCollection, IActionAdapter[] actionAdapterCollection, IOutputAdapter[] outputAdapterCollection) { HashSet<MeasurementKey> outputMeasurementKeys = new HashSet<MeasurementKey>(adapter.OutputMeasurementKeys()); // Adds the adapter to the chain dependencyChain.Add(adapter); if ((object)actionAdapterCollection != null) { // Checks all action adapters to determine whether they also need to be // added to the chain as a result of this adapter being added to the chain foreach (IActionAdapter actionAdapter in actionAdapterCollection) { if (actionAdapter.RespectInputDemands && !dependencyChain.Contains(actionAdapter) && outputMeasurementKeys.Overlaps(actionAdapter.InputMeasurementKeys())) AddActionAdapter(actionAdapter, dependencyChain, inputAdapterCollection, actionAdapterCollection, outputAdapterCollection); } } if ((object)outputAdapterCollection != null) { // Checks all output adapters to determine whether they also need to be // added to the chain as a result of this adapter being added to the chain foreach (IOutputAdapter outputAdapter in outputAdapterCollection) { if (!dependencyChain.Contains(outputAdapter) && outputMeasurementKeys.Overlaps(outputAdapter.InputMeasurementKeys())) AddOutputAdapter(outputAdapter, dependencyChain, inputAdapterCollection, actionAdapterCollection, outputAdapterCollection); } } }