Ejemplo n.º 1
0
        private void ShuffleMDUnitsAfterMDBKInDescendingOrder(
            List <Text> textsAfterBkByBeforeVbVbaPastPres,
            BKBySentenceDecorator bKBySentenceDecorator)
        {
            int MDBKPosition =
                bKBySentenceDecorator
                .GetMDBKPosition(textsAfterBkByBeforeVbVbaPastPres);

            var afterMDBK =
                textsAfterBkByBeforeVbVbaPastPres
                .Skip(MDBKPosition + 1)
                .ToList();

            MoveableUnit[] MDPositions =
                ModifierPositionHelper.GetMDUnitPositions(afterMDBK);

            Array.Reverse(MDPositions);

            List <Text> reversedMDUnit =
                MoveableUnitHelper.GetTextsFromMoveablePositionsList(
                    afterMDBK, MDPositions);

            ReplaceMDUnitAfterMDBKWithReversedMDUnit(
                bKBySentenceDecorator, reversedMDUnit);
        }
Ejemplo n.º 2
0
        private void ShuffleMDUnitsBeforeMDBKInDescendingOrder(
            List <Text> textsAfterBkByBeforeVbVbaPastPres,
            BKBySentenceDecorator bkBySentenceDecorator)
        {
            int MDBKPosition =
                bkBySentenceDecorator
                .GetMDBKPosition(textsAfterBkByBeforeVbVbaPastPres);

            var beforeMDBK =
                textsAfterBkByBeforeVbVbaPastPres.Take(MDBKPosition).ToList();

            MoveableUnit[] MDPositions =
                ModifierPositionHelper.GetMDUnitPositions(beforeMDBK);

            if (MDPositions.Any())
            {
                Array.Reverse(MDPositions);

                List <Text> reversedMDUnit =
                    MoveableUnitHelper.GetTextsFromMoveablePositionsList(
                        beforeMDBK, MDPositions);

                ReplaceMDUnitBeforeMDBKWithReversedMDUnit(
                    bkBySentenceDecorator, MDPositions, reversedMDUnit);
            }
        }
Ejemplo n.º 3
0
        private void SortModifiersInDescendingNumericOrder(
            List <Text> modifiers,
            int firstModifierPosition,
            MoveableUnit[] mdPositions)
        {
            ModifierPositionHelper.RemoveCurrentMDUnit(
                _mdSentenceDecorator,
                mdPositions,
                firstModifierPosition);

            Array.Reverse(mdPositions);

            List <Text> reversedMdUnit =
                MoveableUnitHelper.GetTextsFromMoveablePositionsList(
                    modifiers, mdPositions);

            ModifierPositionHelper.InsertReversedMDUnitBeforePosition(
                _mdSentenceDecorator,
                reversedMdUnit,
                firstModifierPosition);
        }
Ejemplo n.º 4
0
        private static List <Text> GetTimerUnitsInReverse(
            TimerSentenceDecorator timerSentenceDecorator)
        {
            MoveableUnit[] timerPositions =
                GetTimerUnitPositions(timerSentenceDecorator);

            timerPositions[timerPositions.Length - 1].EndPosition =
                timerSentenceDecorator
                .Texts
                .Skip(timerSentenceDecorator.FirstTimerPosition)
                .ToList()
                .FindIndex(text => text.IsType(UnitTypes.BKP_BreakerPunctuation))
                + timerSentenceDecorator.FirstTimerPosition - 1;

            Array.Reverse(timerPositions);

            List <Text> reversedTimerUnit =
                MoveableUnitHelper.GetTextsFromMoveablePositionsList(
                    timerSentenceDecorator.Texts, timerPositions);

            return(reversedTimerUnit);
        }
Ejemplo n.º 5
0
        private void SortReversableUnitInDescendingNumericOrderAndMoveBeforeNN(
            List <Text> modifiersUpToVBorBK,
            int firstModifierPosition,
            int newPosition,
            MoveableUnit[] mdPositions)
        {
            ModifierPositionHelper.RemoveCurrentMDUnit(
                _prenNNPastSentenceDecorator,
                mdPositions,
                firstModifierPosition);

            Array.Reverse(mdPositions);

            List <Text> reversedMDUnit =
                MoveableUnitHelper.GetTextsFromMoveablePositionsList(
                    modifiersUpToVBorBK, mdPositions);

            ModifierPositionHelper.InsertReversedMDUnitBeforePosition(
                _prenNNPastSentenceDecorator,
                reversedMDUnit,
                newPosition);
        }