private IDataSet <string[]> getRandomSet() { IDataSet <string[]> temp = Factory.getObject <IDataSet <string[]> >(); temp.AddItem(getRandomData()); IDataItem <string[]> di = Factory.getObject <IDataItem <string[]> >(); di.setValue(new string[3]); di.getValue()[0] = r.Next(1, 4).ToString(); temp.AddItem(di); temp.AddItem(getRandomData()); if (temp.GetItem(0).getValue() != temp.GetItem(2).getValue()) { return(temp); } else { return(getRandomSet()); } }
public IList <IDataSet <string> > Parse(StreamReader sr) { IList <IDataSet <string> > data = Factory.getObject <IList <IDataSet <string> > >(); IDataItem <string> di = null; IDataSet <string> ds = null; string[] values; using (sr) { //remove headers sr.ReadLine(); while (!sr.EndOfStream) { values = sr.ReadLine().Split(','); ds = Factory.getObject <IDataSet <string> >(); //start at 1 to remove the reference for (int i = 1; i < values.Length; i++) { di = Factory.getObject <IDataItem <string> >(); di.setValue(values[i]); ds.AddItem(di); } data.Add(ds); } } return(data); }
private IDataItem <string[]> getRandomData() { int row, col; row = r.Next(fileData.Length); col = r.Next(fileData[0].Length()); IDataItem <String[]> di = Factory.getObject <IDataItem <string[]> >(); di.setValue(new string[3]); di.getValue()[0] = col.ToString(); di.getValue()[1] = fileData[row].GetItem(col).getValue(); return(di); }