public SearchListData AddChildData(string key, string value, string category, string control, string description,SearchListData parent) { SearchListData sdata = new SearchListData(); sdata.key = key; sdata.value = value; sdata.categoryName = category; sdata.controlName = control; sdata.description = description; sdata.next = null; sdata.child = null; sdata.parent = parent; if (parent.child == null) { parent.child = sdata; } else { SearchListData tmpData = parent.child; while (tmpData.next != null) { tmpData = tmpData.next; } tmpData.next = sdata; } return sdata; }
public SearchListData AddChildValueKey(string valuekey,SearchListData parent) { SearchListData cdata = new SearchListData(); cdata.key = valuekey; cdata.value = null; cdata.next = null; cdata.child = null; cdata.description = null; cdata.controlName = null; cdata.categoryName = null; cdata.parent = parent; if (parent.child == null) { parent.child = cdata; } else { SearchListData tmpData= parent.child; while (tmpData.next != null) { tmpData = tmpData.next; } tmpData.next = cdata; } return cdata; }
public DemoGuiListData SearchChildList(SearchListData sKey,DemoGuiListData parent) { DemoGuiListData tmp = parent.child; while (tmp != null) { if(tmp.key.key==sKey.key){ return tmp; } tmp = tmp.next; } return null; }
public DemoGuiListData AddList(SearchListData key,Label lb,PictureBox pic) { DemoGuiListData tmp = new DemoGuiListData(); tmp.key = key; tmp.lb = lb; tmp.bx = pic; if (root == null) { root = tmp; } else { DemoGuiListData t = root; while (t.next != null) { t = t.next; } t.next = tmp; } return tmp; }
public DemoGuiListData AddChildList(SearchListData key, Label lb, PictureBox pic,DemoGuiListData parent) { DemoGuiListData tmp = new DemoGuiListData(); tmp.key = key; tmp.lb = lb; tmp.bx = pic; if (parent.child == null) { parent.child = tmp; } else { DemoGuiListData d = parent.child; while (d.next!=null) { d = d.next; } d.next = tmp; } return tmp; }
public DemoGuiListData SearchList(SearchListData sKey) { DemoGuiListData tmp = root; while(tmp!=null){ if(tmp.key.key == sKey.key){ return tmp; } tmp = tmp.next; } return null; }
public DemoGuiListData() { this.key = null; this.next = null; this.parent = null; this.child = null; this.lb = null; this.bx = null; }
public SearchListData AddKeyList(string key) { SearchListData data = new SearchListData(); data.key = key; data.value = null; data.description = null; data.categoryName = null; data.child = null; data.next = null; data.parent = null; if (head == null) { head = data; curr = data; } else { this.curr.next = data; this.curr = data; } return data; }
public SearchList(string listName) { this.head = null; this.curr = null; this.listName = listName; }
public string value; // SubCommand #endregion Fields #region Constructors public SearchListData() { this.next = null; this.child = null; this.parent = null; }
public SearchListData MatchingOnList(SearchListData list, string fulltext) { SearchListData tmp = list; while(tmp != null){ if (fulltext.Trim().StartsWith(tmp.key, StringComparison.OrdinalIgnoreCase)) { return tmp; } tmp = tmp.next; } return null; }
public SearchListData LongestMatch(SearchListData root,string fulltext) { SearchListData longlist = null; SearchListData highLevel = null; SearchListData lowLevel = null; SearchListData defautlist = null; int longcount = 0; while (root!=null) { if (root.key != "*") { string lastchar = root.key.Substring(root.key.Length - 1); string seachText = root.key.Substring(0, root.key.Length - 1); //Console.WriteLine("Check key :: " + root.key + " ::LongestMatch :: Full line " + fulltext + " last char --> " + lastchar); //if last char is * wildcard check if (lastchar == "*") { if (fulltext.Trim().StartsWith(seachText, StringComparison.OrdinalIgnoreCase)) { if (seachText.Length > longcount) { longcount = seachText.Length; //Console.WriteLine("chk --> " + root.key + " " + longcount); lowLevel = root; } } } else { if (fulltext.Equals(root.key, StringComparison.InvariantCultureIgnoreCase)) { highLevel = root; } } } //check default if(root.key == "*"){ defautlist = root; } root = root.next; } if(highLevel!=null){ longlist = highLevel; } else if(lowLevel!=null){ longlist = lowLevel; } else { longlist = defautlist; } return longlist; }
public SearchList() { this.head = null; this.curr = null; this.listName = "Default"; }
public SearchListData FindList(SearchListData list,string key) { SearchListData tmp = list; while (tmp != null) { if (tmp.key == key) { return tmp; } tmp = tmp.next; } return null; }
public SearchListData AddList(string key, string value, string category, string control, string description) { SearchListData sdata = new SearchListData(); sdata.key = key; sdata.value = value; sdata.categoryName = category; sdata.controlName = control; sdata.description = description; //sdata.searchListType = listtype; sdata.next = null; sdata.child = null; sdata.parent = null; if (this.head == null) { head = sdata; curr = head; } else { //head.next = sdata; this.curr.next = sdata; this.curr = sdata; } return sdata; }