internal CountedClassifier( PropertyCollection propertyCollection, object key, Func <IClassifier> createFunc) { _countedValue = CountedValue <IClassifier> .GetOrCreate(propertyCollection, key, createFunc); }
internal CountedTagger( PropertyCollection propertyCollection, object key, Func <ITagger <TTag> > createFunc) { _countedValue = CountedValue <ITagger <TTag> > .GetOrCreate(propertyCollection, key, createFunc); }
internal static CountedValue <T> GetOrCreate( PropertyCollection propertyCollection, object key, Func <T> createFunc) { CountedValue <T> countedValue; if (propertyCollection.TryGetPropertySafe(key, out countedValue)) { countedValue._count++; return(countedValue); } countedValue = new CountedValue <T>(propertyCollection, key, createFunc()); propertyCollection[key] = countedValue; return(countedValue); }