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; }
static object LoadArray(FuzzyData.FuzzyArray Object, int Key) { if (Key < 0 || Key >= Object.Length) { return(null); } return(Object[Key]); }
public AdvanceCollectArray(FuzzyData.FuzzyArray origin, AdvanceCollect collect = null) { if (collect == null) { collect = this.DefaultCollect; } Exists = CollectArray(origin, collect); }
static object LoadArray(FuzzyData.FuzzyArray Object, string Key) { int i = 0; if (int.TryParse(Key, out i)) { return(LoadArray(Object, i)); } return(null); }
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); }
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); }
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); }
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++; } }
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); }
static object LoadArray(FuzzyData.FuzzyArray Object, FuzzyData.FuzzyFixnum Key) { return(LoadArray(Object, Convert.ToInt32(Key.Value))); }
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)); }
public AdvanceCollectTypeArray(FuzzyData.FuzzyArray origin, AdvanceCollect collect = null) : base(origin, collect) { }
public AdvanceCollectNameArray(FuzzyData.FuzzyArray origin, AdvanceCollect collect = null) : base(origin, collect) { ClassName = null; }