public virtual void Merge(CovariateValuesCache covariateValuesCache) { var numberOfNewItems = covariateValuesCache.Count; var currentCount = Count; foreach (var covariateName in covariateValuesCache.AllCovariateNames()) { if (!Has(covariateName)) { addDefaultValues(covariateName, currentCount); } CovariateValuesFor(covariateName).Merge(covariateValuesCache.CovariateValuesFor(covariateName)); } //fill up the one missing foreach (var covariateName in AllCovariateNames()) { if (!covariateValuesCache.Has(covariateName)) { addDefaultValues(covariateName, numberOfNewItems); } } }
/// <summary> /// Returns the covariates with the given <paramref name="covariateName" /> or null if not defined /// </summary> /// <param name="covariateName"></param> /// <returns></returns> public virtual CovariateValues CovariateValuesFor(string covariateName) => CovariateValuesCache.CovariateValuesFor(covariateName);