protected SymbolicExpressionGrammarBase(SymbolicExpressionGrammarBase original, Cloner cloner) : base(original, cloner) { cachedMinExpressionLength = new Dictionary <string, int>(); cachedMaxExpressionLength = new Dictionary <Tuple <string, int>, int>(); cachedMinExpressionDepth = new Dictionary <string, int>(); cachedMaxExpressionDepth = new Dictionary <string, int>(); cachedIsAllowedChildSymbol = new Dictionary <Tuple <string, string>, bool>(); cachedIsAllowedChildSymbolIndex = new Dictionary <Tuple <string, string, int>, bool>(); symbols = original.symbols.ToDictionary(x => x.Key, y => cloner.Clone(y.Value)); symbolSubtreeCount = new Dictionary <string, Tuple <int, int> >(original.symbolSubtreeCount); allowedChildSymbols = new Dictionary <string, List <string> >(); foreach (var element in original.allowedChildSymbols) { allowedChildSymbols.Add(element.Key, new List <string>(element.Value)); } allowedChildSymbolsPerIndex = new Dictionary <Tuple <string, int>, List <string> >(); foreach (var element in original.allowedChildSymbolsPerIndex) { allowedChildSymbolsPerIndex.Add(element.Key, new List <string>(element.Value)); } suppressEvents = false; }
protected SymbolicExpressionGrammarBase(SymbolicExpressionGrammarBase original, Cloner cloner) : base(original, cloner) { cachedMinExpressionLength = new Dictionary<string, int>(); cachedMaxExpressionLength = new Dictionary<Tuple<string, int>, int>(); cachedMinExpressionDepth = new Dictionary<string, int>(); cachedMaxExpressionDepth = new Dictionary<string, int>(); cachedIsAllowedChildSymbol = new Dictionary<Tuple<string, string>, bool>(); cachedIsAllowedChildSymbolIndex = new Dictionary<Tuple<string, string, int>, bool>(); symbols = original.symbols.ToDictionary(x => x.Key, y => cloner.Clone(y.Value)); symbolSubtreeCount = new Dictionary<string, Tuple<int, int>>(original.symbolSubtreeCount); allowedChildSymbols = new Dictionary<string, List<string>>(); foreach (var element in original.allowedChildSymbols) allowedChildSymbols.Add(element.Key, new List<string>(element.Value)); allowedChildSymbolsPerIndex = new Dictionary<Tuple<string, int>, List<string>>(); foreach (var element in original.allowedChildSymbolsPerIndex) allowedChildSymbolsPerIndex.Add(element.Key, new List<string>(element.Value)); suppressEvents = false; }