BitsetsNET.RLEBitset.TryCreateUnion C# (CSharp) Method

TryCreateUnion() private method

private TryCreateUnion ( Run runA, Run runB, Run &output ) : bool
runA Run
runB Run
output Run
return bool
        private bool TryCreateUnion(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

            // if intersection exists, expand find the union
            bool rtnVal = false;
            if (endIdx >= startIdx - 1)
            {
                rtnVal = true;
                output.StartIndex = (runA.StartIndex >= runB.StartIndex ? runB.StartIndex : runA.StartIndex); // take the lower START index
                output.EndIndex = (runA.EndIndex >= runB.EndIndex ? runA.EndIndex : runB.EndIndex);           // take the higher END index
            }

            return rtnVal;
        }