public bool HasFeature(string featureName, string featureValue) { if (_featureSpecifications.ContainsKey(featureName)) { List <FeatureSpec> featureVals = _featureSpecifications[featureName]; FeatureSpec spec = featureVals.Find(delegate(FeatureSpec fs) { return(fs.FeatureValue == featureValue); }); return(spec != null); } return(false); }
public FeatureSpec GetFeatureSpec(string featureName, string featureValue) { if (!_featureSpecifications.ContainsKey(featureName)) { return(null); } List <FeatureSpec> featureVals = _featureSpecifications[featureName]; FeatureSpec spec = featureVals.Find(delegate(FeatureSpec fs) { return(fs.FeatureValue == featureValue); }); return(spec); }
/// <summary> /// instantiates a featureSpecification object and adds it to the blueprint. If it finds a matching existing specification, /// it replaces it with the new one /// </summary> /// <param name="featureName">e.g., Strand</param> /// <param name="featureValue">e.g., Algebra</param> /// <param name="minNum">minimum allowable number</param> /// <param name="maxNum">maximim allowable number</param> /// <param name="startAbility">starting ability on for this feature/value pair. May be null</param> /// <param name="startInfo">starting information on this feature/value pair. May be null</param> /// <param name="cut">cut score on this feature/value pair</param> /// <param name="lambda">lambda multiplier. see adaptive algorithm</param> internal void AddFeatureSpecification(string featureName, string featureValue, int minNum, int maxNum, double startAbility, double startInfo, double cut, double lambda, double scaleCutScore, string testSegment) { FeatureSpec spec = new FeatureSpec(featureName, featureValue, minNum, maxNum, startAbility, startInfo, cut, lambda, scaleCutScore, testSegment); if (!_featureSpecifications.ContainsKey(featureName)) { _featureSpecifications.Add(featureName, new List <FeatureSpec>()); } List <FeatureSpec> lstSpec = _featureSpecifications[featureName]; if (lstSpec.Find(delegate(FeatureSpec existSpec) { return(featureValue == existSpec.FeatureValue); }) != null) { lstSpec.RemoveAll(delegate(FeatureSpec existSpec) { return(featureValue == existSpec.FeatureValue); }); } lstSpec.Add(spec); }