Exemplo n.º 1
0
        private void Calculate()
        {
            initialList = new List <List <string> >();

            foreach (var item in initialStrings)
            {
                initialList.Add(Extensions.GetSplittedWords(item.Value));
            }

            comparationList = Operands.CompareLines(initialStrings.Values.ToList());

            List <List <int> > groupsList = Groupping.Group(comparationList);

            gropsFull        = Operands.GetUniqueInGroups(initialStrings, groupsList);
            groupsSimplified = Groupping.Simplify(initialStrings, gropsFull);

            modulesFull       = new Dictionary <List <int>, string>();
            graphsListInitial = new List <IBidirectionalGraph <object, IEdge <object> > >();
            graphsListModuled = new List <IBidirectionalGraph <object, IEdge <object> > >();

            int counter = 0;

            foreach (var item in groupsSimplified)
            {
                graphsListInitial.Add(Graph.AdjacentyMatrixToGraph(Modules.CreateRelationMatrix(initialStrings, item)));

                var modulesMatrix = Modules.GetModulesMatrix(initialStrings, item);
                graphsListModuled.Add(Graph.AdjacentyMatrixToGraph(modulesMatrix));

                modulesFull.Add(item.Key, String.Join("  ", modulesMatrix.Headers.Values.ToList()));
                counter++;
            }

            modulesUnique = Modules.GetModulesUnique(modulesFull);

            graphFlows = Modules.GetFlows(initialStrings.Values.ToList(), groupsSimplified.Values.ToList(), modulesUnique);

            initialized = true;
        }