コード例 #1
0
    public Case Reuse(System.Collections.ArrayList stats)
    {
        if (stats == null || stats.Count <= 0)
        {
            return(null);
        }
        if (_env == null)
        {
            throw new ContextException("environment variable is not set");
        }

        ICBRContext ctx = CBRContextManager.GetCBRContext(_env);

        if (ctx == null)
        {
            throw new ContextException("ctx is not set");
        }

        Case problem = ctx.GetCurrentCase();

        if (problem == null)
        {
            throw new ContextException(
                      "interface ICBRContext's GetCurrentCase return null");
        }
        ArrayList list = problem.GetFeatures();

        for (int i = 0; i < list.Count; i++)
        {
            Feature f = (Feature)list[i];
            if (f.GetIsKey() && TypeHandle.IsNumericFeature(f))
            {
                //compute the mean value of features
                f.SetFeatureValue(ComputeMeanValue(stats,
                                                   f.GetFeatureName()));
            }
        }
        return(problem);
    }