private bool searchTree(DNode n, DataRow row) { if(n.classification != null) {return row.checkClass(n.classification);} else { string a = row.getAttribute(n.attribute); for(uint x = 0; x < n.children.Length; x++) { if(n.children[x].path.Equals(a)) { return searchTree(n.children[x],row);} } } //Console.WriteLine("Am I here"); return false; //should never get here }
private void growRowsByTen() { DataRow[] temp = new DataRow[capacity+10]; for(uint x=0; x < rows.Length; x++) { temp[x] = rows[x]; } capacity = (uint) temp.Length; rows = temp; }
public void addRow(String s) { if(size == capacity) { growRowsByTen(); } rows[size++] = new DataRow(s, attribs, classes ); }
//private bool[] marked; public DataSet(String filename) { rows = new DataRow[10]; capacity = 10; size = 0; StreamReader reader = new StreamReader(filename); String input = reader.ReadLine(); attribs = new AttributeSet((uint) input.Split(',').Length-1); classes= new ClassificationSet(); //marked = new bool[attribs.getLength()]; //for(uint x=0; x < marked.Length; x++) //{ marked[x] = false; } while(input != null) { if(size == capacity) { growRowsByTen();} rows[size++] = new DataRow(input, attribs, classes); input = reader.ReadLine(); } }
private bool testRow(DataRow row) { return searchTree(root,row); }