Example #1
0
 public void readFromFile(string fileName)
 {
     using (var reader = new System.IO.StreamReader(fileName))
     {
         string line = reader.ReadLine();
         schema = new DataSetSchema(line);
         while (!reader.EndOfStream)
         {
             line = reader.ReadLine();
             DataPoint point = new DataPoint();
             point.readFromString(line, schema);
             this.records.Add(point);
         }
     }
 }
Example #2
0
        public void readFromString(string data, DataSetSchema schema)
        {
            this.schema = schema;
            var splitted = data.Split(DataSet.separators, StringSplitOptions.RemoveEmptyEntries);

            for (int i = 0; i < schema.numberIfInputs; i++)
            {
                switch (schema.inputsType[i])
                {
                case DataType.logic:
                    addLogicValue(splitted[i] == "TRUE" || splitted[i] == "true" || splitted[i] == "True" || splitted[i] == "1");
                    break;

                case DataType.numerical:
                    addIntegerValue(int.Parse(splitted[i]));
                    break;

                case DataType.character:
                    addCharValue(splitted[i][0]);
                    break;

                case DataType.text:
                    addStringValue(splitted[i]);
                    break;
                }
            }
            for (int i = 0; i < schema.numberOfOutputs; i++)
            {
                switch (schema.outputsType[i])
                {
                case DataType.logic:
                    addLogicValue(splitted[schema.numberIfInputs + i] == "TRUE" || splitted[schema.numberIfInputs + i] == "true" || splitted[schema.numberIfInputs + i] == "True" || splitted[schema.numberIfInputs + i] == "1");
                    break;

                case DataType.numerical:
                    addIntegerValue(int.Parse(splitted[schema.numberIfInputs + i]));
                    break;

                case DataType.character:
                    addCharValue(splitted[schema.numberIfInputs + i][0]);
                    break;

                case DataType.text:
                    addStringValue(splitted[schema.numberIfInputs + i]);
                    break;
                }
            }
        }
Example #3
0
 public NodeModifier(DataSetSchema problemSchema)
 {
     createCategories();
     this.problemSchema = problemSchema;
 }