Пример #1
0
 public AdvanceStringList(FuzzyData.FuzzyArray array, int start_index = -1)
 {
     exists = false;
     if (array == null)
     {
         return;
     }
     this.start_index = start_index;
     for (int i = 0; i < array.Size; i++)
     {
         Add(array[i]);
         if (array[i] is FuzzyData.FuzzyNil)
         {
             continue;
         }
         else if (array[i] is FuzzyData.FuzzyString)
         {
             FuzzyData.FuzzyString str = array[i] as FuzzyData.FuzzyString;
             if (str.Text == "")
             {
                 continue;
             }
             if (this.start_index == -1)
             {
                 this.start_index = i;
             }
             data.Add(str);
         }
         else
         {
             return;
         }
     }
     exists = true;
 }
Пример #2
0
 static object LoadArray(FuzzyData.FuzzyArray Object, int Key)
 {
     if (Key < 0 || Key >= Object.Length)
     {
         return(null);
     }
     return(Object[Key]);
 }
Пример #3
0
 public AdvanceCollectArray(FuzzyData.FuzzyArray origin, AdvanceCollect collect = null)
 {
     if (collect == null)
     {
         collect = this.DefaultCollect;
     }
     Exists = CollectArray(origin, collect);
 }
Пример #4
0
        static object LoadArray(FuzzyData.FuzzyArray Object, string Key)
        {
            int i = 0;

            if (int.TryParse(Key, out i))
            {
                return(LoadArray(Object, i));
            }
            return(null);
        }
Пример #5
0
 protected override Adapter.AdvanceCollectNameArray ConvertToValue(FuzzyData.FuzzyObject origin)
 {
     FuzzyData.FuzzyArray arr = origin as FuzzyData.FuzzyArray;
     if (arr == null)
     {
         return(null);
     }
     Adapter.AdvanceCollectNameArray array = new Adapter.AdvanceCollectNameArray(arr);
     return(array.Exists ? array : null);
 }
Пример #6
0
        protected override bool CollectArray(FuzzyData.FuzzyArray origin, AdvanceCollectArray.AdvanceCollect collect)
        {
            i = j = 0;
            data.Clear();
            link.Clear();
            bool b = base.CollectArray(origin, collect);

            // 核心超频连线!
            FuzzyData.FuzzyArray temp = this | origin;
            return(b);
        }
Пример #7
0
 protected override Adapter.AdvanceStringList ConvertToValue(FuzzyData.FuzzyObject origin)
 {
     FuzzyData.FuzzyArray fa = origin as FuzzyData.FuzzyArray;
     if (fa == null)
     {
         return(null);
     }
     Adapter.AdvanceStringList asl = new Adapter.AdvanceStringList(fa);
     if (asl.Exists)
     {
         return(asl);
     }
     return(null);
 }
Пример #8
0
        public AdvanceArray(FuzzyData.FuzzyArray array)
        {
            // Initialize
            exists    = false;
            classname = "";
            // Check
            FuzzyData.FuzzyObject fob;
            foreach (object ob in array)
            {
                if ((fob = ob as FuzzyData.FuzzyObject) == null)
                {
                    return;
                }
                else
                if (fob == FuzzyData.FuzzyNil.Instance)
                {
                    continue;
                }
                else if (ClassName == "")
                {
                    classname = fob.ClassName.Name;
                }
                else if (fob.ClassName.Name != ClassName)
                {
                    return;
                }
            }
            exists = true;
            // Data
            int i = 0, j = 0;

            foreach (object ob in array)
            {
                base.Add(ob);
                fob = ob as FuzzyData.FuzzyObject;
                if (fob == FuzzyData.FuzzyNil.Instance)
                {
                    continue;
                }
                else
                {
                    Link.Add(i++, j); Data.Add(fob);
                }
                j++;
            }
        }
Пример #9
0
 protected virtual bool CollectArray(FuzzyData.FuzzyArray origin, AdvanceCollect collect)
 {
     foreach (object ob in origin)
     {
         AdvanceCollectResult result = collect(ob);
         if (result == AdvanceCollectResult.Denied)
         {
             return(false);
         }
         else if (result == AdvanceCollectResult.Accepted)
         {
             SetAcceptedItem(ob);
         }
         else if (result == AdvanceCollectResult.Wrong)
         {
             SetWrongItem(ob);
         }
     }
     return(true);
 }
Пример #10
0
 static object LoadArray(FuzzyData.FuzzyArray Object, FuzzyData.FuzzyFixnum Key)
 {
     return(LoadArray(Object, Convert.ToInt32(Key.Value)));
 }
Пример #11
0
            static public ContentFactor Allocate(string format, string path, params object[] para)
            {
                // 拆解各个参数部分
                string[] keys = path.Split('|');
                int      max = para.Length, now = 0;
                // 计算根值 TODO
                object root;
                Regex  reg = new Regex("\\[.+?\\]");
                Match  m;

                if (keys[0] == "" || keys[0] == "#")
                {
                    root = para[0];
                }
                else if (keys[0] == "##")
                {
                    int i = 0;
                    while (i < max && i < keys.Length && keys[i] == "##")
                    {
                        keys[i++] = null;
                    }
                    if (i < keys.Length && keys[i] == "#")
                    {
                        keys[i] = null;
                    }
                    root = para[i];
                }
                else if ((m = reg.Match(keys[0])).Success)
                {
                    string all = m.Value;
                    all = all.Remove(0, 1);
                    all = all.Remove(all.Length - 1, 1);
                    string[]             parts = all.Split('/');
                    FuzzyData.FuzzyArray fa    = new FuzzyData.FuzzyArray(parts);
                    root = fa;
                }
                else
                {
                    root = FileManager.Create(keys[0]).Data;
                }
                keys[0] = null;
                // 结算路径
                List <object> list = new List <object>();

                foreach (string key in keys)
                {
                    if (key == null)
                    {
                        continue;
                    }
                    else if (key == "#")
                    {
                        list.Add(para[now]);
                    }
                    else if (key == "##")
                    {
                        if (++now >= max)
                        {
                            throw new ArgumentException("字符串匹配中超界");
                        }
                    }
                    else
                    {
                        list.Add(key);
                    }
                }
                return(new ContentFactor(root, list.ToArray(), format));
            }
Пример #12
0
 public AdvanceCollectTypeArray(FuzzyData.FuzzyArray origin, AdvanceCollect collect = null)
     : base(origin, collect)
 {
 }
Пример #13
0
 public AdvanceCollectNameArray(FuzzyData.FuzzyArray origin, AdvanceCollect collect = null)
     : base(origin, collect)
 {
     ClassName = null;
 }