Ejemplo n.º 1
0
        /// <summary>
        /// move outwards from check succeeded operation until check partial match by independent is found
        /// appending restore isomorphy for isomorphy written on the way
        /// and final jump to operation right after the independent failed operation of the check partial match by independent
        /// </summary>
        private static void MoveRightAfterCorrespondingIndependentFailedAppendingRemoveIsomorphyAndJump(
            CheckContinueMatchingOfIndependentSucceeded checkSucceeded,
            CheckPartialMatchByIndependent enclosingIndependent,
            SearchProgram topLevelSearchProgram)
        {
            // insertion point for candidate failed operations
            SearchProgramOperation insertionPoint =
                checkSucceeded.CheckFailedOperations;

            while (insertionPoint.Next != null) // needed?
            {
                insertionPoint = insertionPoint.Next;
            }

            // move outwards, append remove isomorphy
            string[] neededElements = new string[0];
            SearchProgramOperation continuationPoint = MoveOutwardsAppendingRemoveIsomorphy(
                checkSucceeded, ref insertionPoint, neededElements, enclosingIndependent, topLevelSearchProgram);

            // move to check failed operation of check independent operation
            while (!(continuationPoint is CheckContinueMatchingOfIndependentFailed))
            {
                continuationPoint = continuationPoint.Next;
            }
            CheckContinueMatchingOfIndependentFailed checkFailed =
                (CheckContinueMatchingOfIndependentFailed)continuationPoint;

            // insert label right thereafter, append jump there at insertion point
            GotoLabel gotoLabel = new GotoLabel();

            checkFailed.Insert(gotoLabel);

            ContinueOperation continueByGoto =
                new ContinueOperation(
                    ContinueOperationType.ByGoto,
                    gotoLabel.LabelName);

            insertionPoint.Append(continueByGoto);
        }