コード例 #1
0
ファイル: DataBlock.cs プロジェクト: yangfan111/CsharpCode
 internal virtual void AddMarkedData(MarkedData data)
 {
     if (!indexMap.ContainsKey(data.GetIndex()))
     {
         indexMap[data.GetIndex()] = indexMap.Count;
         this.dataList.Add(data);
         this.feList.Add(data.GetFe());
     }
 }
コード例 #2
0
        public override int[] Sort(IList <MarkedData> datas, string feature)
        {
            int[] r = new int[datas.Count];
            MyDictionary <string, int> set = new MyDictionary <string, int>();

            if (comparator == null)
            {
                comparator = GetComparator(feature);
            }
            if (comparator != null)
            {
                datas.Sort(GetComparator(feature));
            }
            for (int i = 0; i < datas.Count; i++)
            {
                MarkedData data = datas[i];
                if (data != null)
                {
                    IFeaturable fe = data.GetFe();
                    if (fe != null)
                    {
                        object v = fe.GetFeatureValue(feature);
                        if (v != null)
                        {
                            SetIndex(r, i, v, set);
                        }
                        else
                        {
                            r[i] = REMOVE;
                        }
                    }
                    else
                    {
                        r[i] = REMOVE;
                    }
                }
                else
                {
                    r[i] = REMOVE;
                }
            }
            return(r);
        }