public virtual CovariateValuesCache Clone() { var clone = new CovariateValuesCache(); _covariateValuesCache.Each(x => clone.Add(x.Clone())); return(clone); }
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); } } }
public virtual void Merge(IndividualValuesCache individualValuesCache, PathCache <IParameter> parameterCache) { IndividualIds.AddRange(individualValuesCache.IndividualIds); CovariateValuesCache.Merge(individualValuesCache.CovariateValuesCache); ParameterValuesCache.Merge(individualValuesCache.ParameterValuesCache, parameterCache); }
public virtual void AddCovariate(string covariateName, IReadOnlyList <string> values) => CovariateValuesCache.Add(covariateName, values);
public virtual IndividualValuesCache Clone() { return(new IndividualValuesCache(ParameterValuesCache.Clone(), CovariateValuesCache.Clone(), new List <int>(IndividualIds))); }
public string[] GetCovariateValues(string covariateName) => CovariateValuesCache.GetValues(covariateName);
public void Add(IndividualValues individualValues) { CovariateValuesCache.AddIndividualValues(individualValues.Covariates); Add(individualValues.ParameterValues); IndividualIds.Add(getNextIndividualId()); }
public IndividualValuesCache(ParameterValuesCache parameterValuesCache, CovariateValuesCache covariateValuesCache, List <int> individualIds) { ParameterValuesCache = parameterValuesCache; CovariateValuesCache = covariateValuesCache; IndividualIds = individualIds; }
public virtual string CovariateValueFor(string covariateName, int individualId) => CovariateValuesCache.CovariateValueFor(covariateName, IndexOfIndividual(individualId));
public virtual string[] AllCovariateValuesForIndividual(int individualId) => CovariateValuesCache.AllCovariateValuesAt(IndexOfIndividual(individualId));
public virtual IReadOnlyList <string> AllCovariateValuesFor(string covariateName) => CovariateValuesCache.ValuesFor(covariateName);
public virtual string[] AllCovariatesNames() => CovariateValuesCache.AllCovariateNames();
/// <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);