private IEnumerable<SubstrateConnection> GetConnectionSequence()
{
// If the connections are in a list then return the list.
if(null != _connectionList) {
return _connectionList;
}
// Generate the connections from the nodeset mappings.
int count = _nodeSetMappingList.Count;
if(0 == count)
{ // No mappings.
return null;
}
// Concatenate the IEnumerables from each mapping to produce one all-encompassing IEnumerable.
IEnumerable<SubstrateConnection> enumerable = _nodeSetMappingList[0].GenerateConnections(_nodeSetList);
for(int i=1; i<count; i++) {
enumerable = Enumerable.Concat(enumerable, _nodeSetMappingList[i].GenerateConnections(_nodeSetList));
}
return enumerable;
}