Exemplo n.º 1
0
        } /* InitiateClass */

        public void   Increment(PicesClass mlClass,
                                float areaMM
                                )
        {
            if (mlClass == null)
            {
                mlClass = PicesClassList.GetUnKnownClassStatic();
            }

            ClassTotals2 classTotals = totals.LookUp(mlClass.Name);

            if (classTotals == null)
            {
                classTotals = new ClassTotals2(mlClass.Name,
                                               sizeInitial,
                                               sizeGrowthFactor,
                                               sizeEndRange,
                                               bucketCount,
                                               sizeBucketStart,
                                               sizeBucketEnd
                                               );
                totals.Add(classTotals);
            }

            classTotals.Increment(areaMM);
        } /* Increment */
Exemplo n.º 2
0
        } /* Increment */

        /// <summary>
        ///
        /// </summary>
        /// <param name="o">Output stream to print report to.</param>
        /// <param name="volume">If volume == 0.0 then prints units otherwise prints the density units/mm^3. </param>
        public void   PrintTabDelDistributionMatrix(System.IO.StreamWriter o,
                                                    float volume
                                                    )
        {
            totals.SortByName();

            PrintTabDelHeader(o);

            ClassTotals2 classTotals = null;

            ClassTotals2 grandTotals = new ClassTotals2("Grand Totals",
                                                        sizeInitial,
                                                        sizeGrowthFactor,
                                                        sizeEndRange,
                                                        bucketCount,
                                                        sizeBucketStart,
                                                        sizeBucketEnd
                                                        );

            int idx;

            for (idx = 0; idx < totals.Count; idx++)
            {
                classTotals = totals[idx];
                classTotals.PrintTabDelLine(o, volume);
                grandTotals.AddIn(classTotals);
            }
            o.WriteLine();
            grandTotals.PrintTabDelLine(o, volume);
        } /* PrintTabDelDistributionMatrix */
Exemplo n.º 3
0
        } /* ExtractFamily */

        /// <summary>
        /// Will add in the contents of another SizeDistribution2 instance into this instance.
        /// </summary>
        /// <param name="x">The other 'SizeDistribution2' instance to be accumulated to this instance.</param>
        public void  Add(SizeDistribution2 x)
        {
            if ((x.bucketCount != this.bucketCount) ||
                (x.sizeInitial != this.sizeInitial) ||
                (x.sizeGrowthFactor != this.sizeGrowthFactor) ||
                (x.sizeEndRange != this.sizeEndRange)
                )
            {
                throw new Exception("'SizeDistribution2.Add   ***ERROR***   Dimensions are not the same" + "\n" +
                                    "Left.sizeInitial      [" + sizeInitial.ToString() + "]  Right [" + x.sizeInitial.ToString() + "]" + "\n" +
                                    "Left.sizeGrowthFactor [" + sizeGrowthFactor.ToString() + "]  Right [" + x.sizeGrowthFactor.ToString() + "]" + "\n" +
                                    "Left.sizeEndRange     [" + sizeEndRange.ToString() + "]  Right [" + x.sizeEndRange.ToString() + "]"
                                    );
            }

            foreach (ClassTotals2 ct in x.totals)
            {
                ClassTotals2 classTotals = totals.LookUp(ct.Name);
                if (classTotals == null)
                {
                    classTotals = new ClassTotals2(ct.Name,
                                                   sizeInitial,
                                                   sizeGrowthFactor,
                                                   sizeEndRange,
                                                   bucketCount,
                                                   sizeBucketStart,
                                                   sizeBucketEnd
                                                   );
                    totals.Add(classTotals);
                }
                classTotals.AddIn(ct);
            }
        } /* SizeDistribution2 */
Exemplo n.º 4
0
        /// <summary>
        /// Returns an instance of 'ClassTotals' that contains a summary of the classes that are decedent of 'ancestor'.
        /// </summary>
        /// <param name="ancestor"></param>
        /// <returns></returns>
        public ClassTotals2  SummarizeFamilyOfClasses(PicesClass ancestor)
        {
            ClassTotals2 familySummary = new ClassTotals2(ancestor.Name, sizeInitial, sizeGrowthFactor, sizeEndRange, bucketCount, sizeBucketStart, sizeBucketEnd);

            AddFamilyOfClassesToSizeClassTotals(familySummary, ancestor);
            return(familySummary);
        } /* SummarizeFamilyOfClasses */
Exemplo n.º 5
0
            public void  AddIn(ClassTotals2 classTotals)
            {
                int idx;

                count = count + classTotals.count;

                for (idx = 0; idx < bucketCount; idx++)
                {
                    sizeBuckets[idx] = sizeBuckets[idx] + classTotals.sizeBuckets[idx];
                }
            } /* AddIn */
Exemplo n.º 6
0
        } /* SizeDistribution2 */

        //
        /// <summary>
        /// Will add in the contents of a ClassTotals2 instance into this instance of SizeDistribution2.
        /// </summary>
        /// <param name="x"></param>
        public void  Add(ClassTotals2 x)
        {
            if ((x.SizeInitial != this.sizeInitial) ||
                (x.SizeGrowthFactor != this.sizeGrowthFactor) ||
                (x.SizeEndRange != this.sizeEndRange)
                )
            {
                throw new Exception("'SizeDistribution2.Add   ***ERROR***   Dimensions are not Compatible" + "\n" +
                                    "Left.sizeInitial      [" + sizeInitial.ToString() + "]  Right [" + x.SizeInitial.ToString() + "]" + "\n" +
                                    "Left.sizeGrowthFactor [" + sizeGrowthFactor.ToString() + "]  Right [" + x.SizeGrowthFactor.ToString() + "]" + "\n" +
                                    "Left.sizeEndRange     [" + sizeEndRange.ToString() + "]  Right [" + x.SizeEndRange.ToString() + "]"
                                    );
            }

            totals.Add(x);
        } /* SizeDistribution2 */
Exemplo n.º 7
0
        } /* PrintTabDelDistributionMatrixesForSummaryClasses */

        private PicesClassList  BuildMLClassList()
        {
            PicesClassList mlClasses = new PicesClassList();

            int cIDX;

            //for  (cIDX = 0;  cIDX <  totals->end ();  cIDX++)
            for (cIDX = 0; cIDX < totals.Count; cIDX++)
            {
                ClassTotals2 ct = totals[cIDX];
                mlClasses.Add(PicesClassList.GetUniqueClass(ct.Name, ""));
            }

            mlClasses.SortByName();

            return(mlClasses);
        } /* BuildMLClassList */
Exemplo n.º 8
0
        } /* ExtractFamilyOfClasses */

        private void  ExtractFamily(SizeDistribution2 family,
                                    PicesClass ancestor
                                    )
        {
            ClassTotals2 ct = totals.LookUp(ancestor.Name);

            if (ct != null)
            {
                family.Add(ct);
            }

            if (ancestor.Children != null)
            {
                foreach (PicesClass pc in ancestor.Children)
                {
                    ExtractFamily(family, pc);
                }
            }

            return;
        } /* ExtractFamily */
Exemplo n.º 9
0
        } /* SummarizeFamilyOfClasses */

        private void  AddFamilyOfClassesToSizeClassTotals(ClassTotals2 summary,
                                                          PicesClass ancestor
                                                          )
        {
            ClassTotals2 ct = totals.LookUp(ancestor.Name);

            if (ct != null)
            {
                summary.AddIn(ct);
            }

            if (ancestor.Children != null)
            {
                foreach (PicesClass pc in ancestor.Children)
                {
                    AddFamilyOfClassesToSizeClassTotals(summary, pc);
                }
            }

            return;
        } /* AddFamilyOfClassesToSizeClassTotals */
Exemplo n.º 10
0
        } /* SizeDistribution2 */

        /// <summary>
        /// Method used to guarantee that the specified class is included; even if none occur.
        /// </summary>
        /// <param name="mlClass">Class to add </param>
        public void   InitiateClass(PicesClass mlClass)
        {
            if (mlClass == null)
            {
                mlClass = PicesClassList.GetUnKnownClassStatic();
            }

            ClassTotals2 classTotals = totals.LookUp(mlClass.Name);

            if (classTotals == null)
            {
                classTotals = new ClassTotals2(mlClass.Name,
                                               sizeInitial,
                                               sizeGrowthFactor,
                                               sizeEndRange,
                                               bucketCount,
                                               sizeBucketStart,
                                               sizeBucketEnd
                                               );
                totals.Add(classTotals);
            }
            return;
        } /* InitiateClass */