コード例 #1
0
 internal void ReferenceBucketFromTarget(PredictionTreeDFAContext context, ProductionRuleLookAheadBucket bucket)
 {
     if (this.referencedBuckets == null)
     {
         this.referencedBuckets = new Dictionary <ProductionRuleLookAheadBucket, PredictionTreeDFAContext>();
     }
     if (!this.referencedBuckets.ContainsKey(bucket))
     {
         this.referencedBuckets.Add(bucket, context);
     }
 }
コード例 #2
0
        internal void DefineBucketOnTarget(PredictionTreeDFAContext bucketReferencer)
        {
            if (this.locallyDefinedBuckets == null)
            {
                this.locallyDefinedBuckets = new Dictionary <ProductionRuleLookAheadBucket, List <PredictionTreeDFAContext> >();
            }
            var bucket = this.RootAdapter.AssociatedContext.CreateBucket(this);
            List <PredictionTreeDFAContext> sourcesWhichUseBucket;

            if (!this.locallyDefinedBuckets.TryGetValue(bucket, out sourcesWhichUseBucket))
            {
                this.locallyDefinedBuckets.Add(bucket, sourcesWhichUseBucket = new List <PredictionTreeDFAContext>());
            }
            if (!sourcesWhichUseBucket.Contains(bucketReferencer))
            {
                sourcesWhichUseBucket.Add(bucketReferencer);
            }
            bucketReferencer.ReferenceBucketFromTarget(this, bucket);
        }
コード例 #3
0
        internal ProductionRuleLookAheadBucket CreateBucket(PredictionTreeDFAContext bucketOwner)
        {
            if (this.automationBuckets == null)
            {
                this.automationBuckets = new Dictionary <PredictionTreeDFAContext, ProductionRuleLookAheadBucket>();
            }
            ProductionRuleLookAheadBucket result;

            if (!this.automationBuckets.TryGetValue(bucketOwner, out result))
            {
                this.automationBuckets.Add(bucketOwner, result = new ProductionRuleLookAheadBucket()
                {
                    Owner = bucketOwner, BucketID = this.automationBuckets.Count + 1
                });
            }
            if (!bucketUseCount.ContainsKey(result))
            {
                bucketUseCount.Add(result, 0);
            }
            bucketUseCount[result]++;
            return(result);
        }