BitsetsNET.RLEBitset.TryCreateIntersection C# (CSharp) Method

TryCreateIntersection() private method

private TryCreateIntersection ( Run runA, Run runB, Run &output ) : bool
runA Run
runB Run
output Run
return bool
        private bool TryCreateIntersection(Run runA, Run runB, ref Run output)
        {
            int startIdx = (runA.StartIndex >= runB.StartIndex ? runA.StartIndex : runB.StartIndex); // take the higher START index
            int endIdx = (runA.EndIndex <= runB.EndIndex ? runA.EndIndex : runB.EndIndex);           // take the lower END index

            // determine if there is an intersection overlap and set return values accordingly
            bool rtnVal = false;
            if (endIdx >= startIdx)
            {
                rtnVal = true;
                output.StartIndex = startIdx;
                output.EndIndex = endIdx;
            }

            return rtnVal;
        }