Exemple #1
0
        private void DoStep1(byte itemIndex)
        {
            StateSymbolPair from = tmInstance.CurrentStateSymbolPair;
            IList <StateSymbolDirectionTriple> to = delta[from];

            TMInstance.MoveToNextConfiguration(to[itemIndex], tmInstance);
        }
Exemple #2
0
        private void DoStep1()
        {
            StateSymbolPair from = tmInstance.CurrentStateSymbolPair;
            IList <StateSymbolDirectionTriple> to = delta[from];

            Ensure.That(to).SizeIs(1);

            TMInstance.MoveToNextConfiguration(to[0], tmInstance);
        }
        public void ExtractTConsistSeq()
        {
            log.Info("MExistsAcceptingPath.Compute: path");

            tapeSegContext.TapeSegTConsistPath.Remove(tapeSegContext.TapeSegTConsistPath.Last());
            tapeSegContext.TapeSegTConsistPath.ForEach(s =>
            {
                log.InfoFormat("node = {0}", s.ToString());
            });

            List <KeyValuePair <long, ComputationStep> > pathCompSteps =
                tapeSegContext.TapeSegTConsistPath.ConvertAll(uId =>
                                                              new KeyValuePair <long, ComputationStep>(uId, meapContext.TArbSeqCFG.IdToNodeInfoMap[uId].CompStep));

            pathCompSteps.ForEach(s =>
            {
                log.InfoFormat(
                    "id = {0}, comp.step = {1}",
                    s.Key.ToString(), s.Value);
            });

            TMInstance tmInstance = new
                                    (
                meapContext.MEAPSharedContext.MNP,
                meapContext.MEAPSharedContext.Input
                                    );

            meapContext.MEAPSharedContext.MNP.PrepareTapeFwd(
                meapContext.MEAPSharedContext.Input,
                tmInstance);

            foreach (KeyValuePair <long, ComputationStep> compStepPair in pathCompSteps)
            {
                ComputationStep compStep = compStepPair.Value;

                TMInstance.MoveToNextConfiguration(
                    new StateSymbolDirectionTriple
                    (
                        state: compStep.qNext,
                        symbol: compStep.sNext,
                        direction: compStep.m,
                        shift: compStep.Shift
                    ),
                    tmInstance);

                if (tmInstance.IsInFinalState())
                {
                    break;
                }
            }

            tapeSegContext.TapeSegOutput = meapContext.MEAPSharedContext.MNP.GetOutput(
                tmInstance,
                meapContext.mu,
                (uint)meapContext.MEAPSharedContext.Input.Length);
        }