Exemplo n.º 1
0
 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
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 public void addRow(String s)
 {
     if(size == capacity) { growRowsByTen(); }
     rows[size++] = new DataRow(s, attribs, classes );
 }
Exemplo n.º 4
0
        //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();
            }
        }
Exemplo n.º 5
0
 private bool testRow(DataRow row)
 {
     return searchTree(root,row);
 }