Exemple #1
0
 public DerivationContext(DerivationContext c) : base(c.Grammar)
 {
     Generator           = c.Generator;
     RuleDerivNode       = c.RuleDerivNode;
     ExpandingRuleSymbol = c.ExpandingRuleSymbol;
     //LevelCount = c.LevelCount;
     RuleSeqProtocol  = c.RuleSeqProtocol;
     ParentDerivation = c.ParentDerivation;
     Visitor          = c.Visitor;
     DerivationXml    = c.DerivationXml;
     currentNode      = c.currentNode;
 }
Exemple #2
0
        public IDerivation GetAllDeque()
        {
            List <IDerivation> lList = new List <IDerivation>(TargetList.mList);

            if (null != TargetList.ParentDerivation)
            {
                DerivationBase lParent = TargetList.ParentDerivation.ParentDerivation;
                while (null != lParent)
                {
                    IDerivation d = lParent.FindDerivation(TargetListName);
                    if (d != null)
                    {
                        //string s = d.ToString();
                        ListDerivation ld = d as ListDerivation;
                        if (null != ld)
                        {
                            lList.AddRange(ld.mList);

                            lParent = ld.ParentDerivation;
                            if (null != lParent)
                            {
                                lParent = lParent.ParentDerivation;
                            }
                        }
                    }
                    else
                    {
                        lParent = null;
                    }
                }
            }

            int randIndex         = lList.Count + 1;
            NormalDistribution nd = new NormalDistribution(0, 1000);

            while (randIndex >= lList.Count)
            {
                randIndex = Math.Abs(nd.intND());
            }
            return(lList[randIndex]);
        }