public MappingFunctionStore(MapForceMapping mapForceMapping, TargetElementStore targetElementStore)
        {
            foreach (FunctionComponent functionComponent in mapForceMapping.FunctionComponents)
            {
                switch (functionComponent.FunctionType)
                {
                case "split":
                {
                    List <object> targetCcElements = new List <object>();

                    foreach (InputOutputKey outputKey in functionComponent.OutputKeys)
                    {
                        string targetElementKey = mapForceMapping.GetMappingTargetKey(outputKey.Value);
                        if (targetElementKey != null)
                        {
                            targetCcElements.Add(targetElementStore.GetTargetCc(targetElementKey));
                        }
                    }

                    MappingFunction mappingFunction = new MappingFunction(targetCcElements);

                    foreach (InputOutputKey inputKey in functionComponent.InputKeys)
                    {
                        mappingFunctions[inputKey.Value] = mappingFunction;
                    }
                }
                break;
                }
            }
        }
        public SchemaMapping(MapForceMapping mapForceMapping, XmlSchemaSet xmlSchemaSet, ICcLibrary ccLibrary, ICctsRepository cctsRepository)
        {
            sourceItemStore = new MapForceSourceItemTree(mapForceMapping, xmlSchemaSet);

            targetElementStore = new TargetElementStore(mapForceMapping, ccLibrary, cctsRepository);

            mappingFunctionStore = new MappingFunctionStore(mapForceMapping, targetElementStore);

            RootElementMapping = MapElement(sourceItemStore.RootSourceItem, "/" + sourceItemStore.RootSourceItem.Name, new Stack <XmlQualifiedName>());

            elementMappings.Add(RootElementMapping);

            elementMappings = new List <ElementMapping>(ResolveTypeMappings(elementMappings));

            foreach (KeyValuePair <string, List <ComplexTypeMapping> > pair in complexTypeMappings)
            {
                foreach (ComplexTypeMapping complexTypeMapping in pair.Value)
                {
                    complexTypeMapping.RemoveInvalidAsmaMappings();
                }
            }

            Dictionary <string, List <ComplexTypeMapping> > relevantComplexTypeMappings = new Dictionary <string, List <ComplexTypeMapping> >();

            foreach (KeyValuePair <string, List <ComplexTypeMapping> > pair in complexTypeMappings)
            {
                string             complexTypeName = pair.Key;
                ComplexTypeMapping relevantMapping = GetComplexTypeMappingWithMostChildren(pair.Value);
                if (relevantMapping is ComplexTypeToMaMapping)
                {
                    relevantMapping = CreateComplexTypeMappingForChildMappings(relevantMapping.Children, complexTypeName, relevantMapping.SourceElementName);
                }
                if (relevantMapping != null)
                {
                    relevantComplexTypeMappings[complexTypeName] = new List <ComplexTypeMapping> {
                        relevantMapping
                    };
                }
            }
            complexTypeMappings = relevantComplexTypeMappings;

            foreach (ElementMapping elementMapping in elementMappings)
            {
                if (elementMapping is AsmaMapping)
                {
                    AsmaMapping        asmaMapping        = (AsmaMapping)elementMapping;
                    ComplexTypeMapping complexTypeMapping = CreateComplexTypeMappingForChildMappings(asmaMapping.TargetMapping.Children, asmaMapping.TargetMapping.ComplexTypeName, asmaMapping.TargetMapping.SourceElementName);
                    asmaMapping.TargetMapping = complexTypeMapping;
                }
            }

            foreach (KeyValuePair <string, List <ComplexTypeMapping> > pair in complexTypeMappings)
            {
                foreach (ComplexTypeMapping complexTypeMapping in pair.Value)
                {
                    complexTypeMapping.RemoveInvalidAsmaMappings();
                }
            }


            // The following lines of code were used for the CEC 2010 paper evaluation.

            //Console.Out.WriteLine("Kennzahl 3 (implizite Mappings): haendisch");
            //Console.Out.WriteLine("Kennzahl 4 (Anzahl der gemappten Elemente)): " + (elementMappings.Count + simpleTypeMappings.Count + complexTypeMappings.Count));

            //Console.Out.WriteLine("Importer Kennzahl 3a (anhand elementMapping variable): " + elementMappings.Count);
            //Console.Out.WriteLine("Importer Kennzahl 3b (anhand simpleTypeMappings): " + simpleTypeMappings.Count);
            //Console.Out.WriteLine("Importer Kennzahl 3c (anhand complexTypeMappings): " + complexTypeMappings.Count);
        }