public CompletionNode[] GetCandidateList(string[] targets, bool exactmatch) { List <CompletionNode> ret = new List <CompletionNode>(); int found = curr.GetCandidates(ret, targets, 0, exactmatch); if (found == 0) { return(null); } return(ret.ToArray()); }
public int GetCandidates(List <CompletionNode> ret, String[] syms, int part, bool exactmatch) { if (children == null) { return(0); } int len = children.Length; int found = 0; String s = syms[part]; for (int n = 0; n < len; n++) { CompletionNode cn = (CompletionNode)children[n]; if (cn.name.StartsWith(s)) { int temp = found; if (cn.name.Equals(s)) { if (part < syms.Length - 1) { found += cn.GetCandidates(ret, syms, part + 1, exactmatch); } /*else * { * //force all childrens to be in * found += cn.GetCandidates(ret, empty, 0); * }*/ } //add the parent only if no children were added if (temp == found && cn.name.Equals(s) == exactmatch) { found++; ret.Add(cn); } } } return(found); }