/// <summary>
 /// Call to start the processing of each OuterProductIndexGenerator-element.
 /// </summary>
 /// <param name="outerProductProcessor">An OuterProductIndexGenerator-processor which needs to implement the IOuterProductProcessor interface.</param>
 public void ProcessOuterProduct(IOuterProductProcessor outerProductProcessor)
 {
     //Init (_numberElementsPerDimension);
     //TODO: NO reset in type, builders are one way
     InitProcessing();
     ProcessOuterProductRecursive(0, outerProductProcessor);
 }
        /// <summary>
        /// The recursive method which implements the variable number of for-loops together with processing callbacks to the outerProductProcessor.
        /// </summary>
        /// <param name="dimensionIndex"></param>
        /// <param name="outerProductProcessor"></param>
        private void ProcessOuterProductRecursive(int dimensionIndex, IOuterProductProcessor outerProductProcessor)
        {
            if (dimensionIndex >= _numberElementsPerDimension.Length)
            {
                return;
            }

            var processingState = new OuterProductProcessingState(this, dimensionIndex);


            for (int currentDimensionIndex = 0; currentDimensionIndex < _numberElementsPerDimension[dimensionIndex]; ++currentDimensionIndex)
            {
                DimensionIndices[dimensionIndex] = currentDimensionIndex;

                outerProductProcessor.SetProcessingState(processingState);
                bool continueProcessingBeforeLoop = outerProductProcessor.DoBeforeLoop();
                if (!continueProcessingBeforeLoop)
                {
                    break;
                }

                ProcessOuterProductRecursive(dimensionIndex + 1, outerProductProcessor);

                outerProductProcessor.SetProcessingState(processingState);
                bool continueProcessingAfterLoop = outerProductProcessor.DoAfterLoop();
                if (!continueProcessingAfterLoop)
                {
                    break;
                }

                ++_numberElementsProcessed;
            }
        }