Exemple #1
0
        public StructureGraphInformation GetDifference(StructureGraphInformation other)
        {
            StructureGraphInformation output = new StructureGraphInformation();

            output.name       = "Difference between " + name + " and " + other.name;
            output.InputCount = InputCount - other.InputCount;
            output.TotalCount = TotalCount - other.TotalCount;
            output.LeafNodes  = LeafNodes - other.LeafNodes;

            output.LevelRange         = LevelRange.GetDifference(other.LevelRange);
            output.LeafLevelRange     = LeafLevelRange.GetDifference(other.LeafLevelRange);
            output.ChildrenCountRange = ChildrenCountRange.GetDifference(other.ChildrenCountRange);

            return(output);
        }
        //public void Publish(folderNode folder, String name, aceAuthorNotation notation=null)
        //{
        //    DataTable dt = items.ReportToDataTable<StructureGraphInformation>(true);
        //    dt.SetTitle(name + " records");
        //    dt.GetReportAndSave(folder, notation);

        //    dt = changes.ReportToDataTable<StructureGraphInformation>(true);
        //    dt.SetTitle(name + " changes");
        //    dt.GetReportAndSave(folder, notation);

        //    builderForText output = new builderForText();
        //    foreach (var item in items)
        //    {
        //        item.Report(null, output);
        //    }
        //    output.ReportSave(folder, name + "_records", "Structure graph entries");

        //    output = new builderForText();
        //    foreach (var item in changes)
        //    {
        //        item.Report(null, output);
        //    }
        //    output.ReportSave(folder, name + "_changes", "Structure graph changes log");
        //}

        /// <summary>
        /// Adds the specified item and returns difference compared to the last added
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="information">The information.</param>
        /// <returns></returns>
        public StructureGraphInformation Add(String name, StructureGraphInformation information)
        {
            information.name = name;

            StructureGraphInformation last = items.LastOrDefault();

            items.Add(information);

            StructureGraphInformation change = information;

            if (last != null)
            {
                change = information.GetDifference(last);
                if (change.TotalCount != 0)
                {
                    changes.Add(change);
                }
            }

            return(change);
        }