Esempio n. 1
0
        protected void InvokeRootSequence()
        {
            switch (SequenceInvokationList.Count)
            {
            case 0:
                Debug.Assert(FieldList.Count == 0, "FieldList.Count > 0 when no sequence invokations");
                rootSequenceInvokation = SequenceInvokationList.New(rootSequence, 0);
                for (int i = 0; i < rootSequenceInvokation.FieldCount; i++)
                {
                    FieldList.Add(rootSequenceInvokation.GetField(i));
                }
                break;

            case 1:
                // if 1, then root is only invoked sequence
                ResetAllFieldValues();
                break;

            default:
                FtSequenceInvokation secondInvokation = SequenceInvokationList[1];
                fieldList.Trim(secondInvokation.StartFieldIndex);
                bool fieldsWereSidelined = secondInvokation.StartFieldIndex != RootFieldCount;

                SequenceInvokationList.PredictTrim(1);
                ResetAllFieldValues();
                if (fieldsWereSidelined)
                {
                    // Root sequence was redirected before its end. Some fields will be sidelined and field indexes may not be correct
                    for (int i = rootSequenceInvokation.FieldsSidelinedFromIndex; i < rootSequenceInvokation.FieldCount; i++)
                    {
                        fieldList.Add(rootSequenceInvokation.GetField(i));
                    }
                    rootSequenceInvokation.UnsidelineFields();
                }
                break;
            }
        }
Esempio n. 2
0
        // remove all sequences after that which contains unRedirecting Field
        protected void Unredirect(FtField unredirectingField, out int fieldsAffectedFromIndex)
        {
            FtSequenceInvokation unredirectingInvokation = unredirectingField.SequenceInvokation;
            int unredirectingInvokationIndex             = unredirectingInvokation.Index;

            if (unredirectingInvokationIndex >= SequenceInvokationList.Count - 1)
            {
                // unRedirectingInvokationIndex is last.  Nothing to do. (should never happen)
                fieldsAffectedFromIndex = FtField.NoFieldsAffectedIndex;
            }
            else
            {
                int nextInvokationIndex = unredirectingInvokationIndex + 1;
                SequenceInvokationList.PredictTrim(nextInvokationIndex);

                fieldsAffectedFromIndex = unredirectingInvokation.StartFieldIndex + unredirectingInvokation.FieldsSidelinedFromIndex;
                fieldList.Trim(fieldsAffectedFromIndex);
                for (int i = unredirectingInvokation.FieldsSidelinedFromIndex; i < unredirectingInvokation.FieldCount; i++)
                {
                    fieldList.Add(unredirectingInvokation.GetField(i));
                }
                unredirectingInvokation.UnsidelineFields();
            }
        }