Exemple #1
0
        public IGMacCompositeBinding PickConstantComponentsAsVariables()
        {
            var structPattern = new GMacStructureBinding(BaseStructure);

            foreach (var pair in _patternDictionary.Where(pair => pair.Value.HasConstantComponent))
            {
                var scalarPattern = pair.Value as GMacScalarBinding;

                if (scalarPattern != null)
                {
                    structPattern._patternDictionary.Add(
                        pair.Key,
                        scalarPattern.ToConstantsFreePattern() as IGMacTypedBinding
                        );

                    continue;
                }

                var compositePattern = pair.Value as IGMacCompositeBinding;

                if (compositePattern != null)
                {
                    structPattern._patternDictionary.Add(
                        pair.Key,
                        compositePattern.PickConstantComponentsAsVariables() as IGMacTypedBinding
                        );
                }
            }

            return(structPattern);
        }
Exemple #2
0
        public IGMacBinding ToConstantsFreePattern()
        {
            var structPattern = new GMacStructureBinding(BaseStructure);

            foreach (var pair in _patternDictionary)
            {
                structPattern
                ._patternDictionary
                .Add(
                    pair.Key,
                    pair.Value.ToConstantsFreePattern() as IGMacTypedBinding
                    );
            }

            return(structPattern);
        }