示例#1
0
 private void GenerateLayerKeywordTypes(IEnumerable <Type> relevantSchemaTypes)
 {
     foreach (var t in relevantSchemaTypes)
     {
         foreach (var layer in new[] { GSATargetLayer.Design, GSATargetLayer.Analysis })
         {
             if (MatchesLayer(t, layer))
             {
                 layerKeywordTypes[layer].Add(t, GsaRecord.GetGwaKeyword(t));
             }
         }
     }
 }
示例#2
0
        private void GenerateLayerKeywords(IEnumerable <Type> relevantSchemaTypes)
        {
            //This dictionary should be independent of layer
            var keywordDependencies = relevantSchemaTypes.ToDictionary(t => GsaRecord.GetGwaKeyword(t), t => GsaRecord.GetReferencedKeywords(t));

            var implementedKwsByLayer = relevantSchemaTypes.ToDictionary(t => GsaRecord.GetGwaKeyword(t), t => TypeLayers(t));

            foreach (var kw in keywordDependencies.Keys)
            {
                foreach (var layer in new[] { GSATargetLayer.Design, GSATargetLayer.Analysis })
                {
                    if (implementedKwsByLayer[kw][layer])
                    {
                        if (!layerKeywords[layer].Contains(kw))
                        {
                            layerKeywords[layer].Add(kw);
                        }
                    }
                    if (keywordDependencies[kw] != null && keywordDependencies[kw].Length > 0)
                    {
                        foreach (var kwPrereq in keywordDependencies[kw])
                        {
                            //The attributes on the types are the container for knowing which layer a keyword is for.  For each referenced
                            //(i.e. prerequiste) keyword of a keyword, a corresponding type will need to be found in order to determine which
                            //layer that referenced keyword is on.
                            //However, at any point in time, there might not be a type created yet for that referenced keyword.  For these cases,
                            //assume that the referenced keyword is for both layers.

                            if (((implementedKwsByLayer.ContainsKey(kwPrereq) && implementedKwsByLayer[kwPrereq][layer]) || !implementedKwsByLayer.ContainsKey(kwPrereq)) &&
                                (!layerKeywords[layer].Contains(kwPrereq)))
                            {
                                layerKeywords[layer].Add(kwPrereq);
                            }
                        }
                    }
                }
            }
        }