/// <summary> /// Gets the node indexes (in order). /// </summary> /// <param name="nodes">The nodes.</param> /// <returns>An enumerable for all nodes.</returns> /// <exception cref="ArgumentNullException">nodes</exception> public IEnumerable <int> GetNodeIndexes(VariableSet nodes) { if (nodes == null) { throw new ArgumentNullException(nameof(nodes)); } // Map connected nodes foreach (var node in _connections) { var index = nodes.MapNode(node).Index; yield return(index); } }
/// <summary> /// Update the indices for the component /// </summary> /// <param name="nodes">Nodes</param> /// <returns></returns> protected int[] ApplyConnections(VariableSet nodes) { if (nodes == null) { throw new ArgumentNullException(nameof(nodes)); } // Map connected nodes int[] indexes = new int[_connections.Length]; for (int i = 0; i < _connections.Length; i++) { indexes[i] = nodes.MapNode(_connections[i]).Index; } return(indexes); }
/// <summary> /// Update the indices for the component. /// </summary> /// <param name="nodes">The variable set.</param> /// <returns>The node indices.</returns> protected int[] ApplyConnections(VariableSet nodes) { nodes.ThrowIfNull(nameof(nodes)); if (_connections == null) { return(new int[0]); } // Map connected nodes var indexes = new int[_connections.Length]; for (var i = 0; i < _connections.Length; i++) { indexes[i] = nodes.MapNode(_connections[i]).Index; } return(indexes); }