Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/02/12 16:07:35 (12 years ago)
Author:
sforsten
Message:

#1782:

  • added CanSave property to IProblemInstanceProvider to know if it can save its data
  • ProblemInstanceConsumerViewGeneric only shows the export button if an IProblemInstanceExporter is available and the selected SelectedProvider has the CanSave property set to true
  • added a default implementation for CanSave and SaveData to ProblemInstanceProvider, so classes which inherit from it, don't have to implement it.
  • Classes in Problems.Instances.DataAnalysis which implemented the IProblemInstanceProvider now inherit from the class ProblemInstanceProvider, so some code is obsolete now and had been deleted
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/ClassificationInstanceProvider.cs

    r7965 r8180  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections;
    2423using System.Collections.Generic;
    25 using System.IO;
    2624using System.Linq;
    27 using System.Text;
    2825using HeuristicLab.Problems.DataAnalysis;
    2926
    3027namespace HeuristicLab.Problems.Instances.DataAnalysis {
    31   public abstract class ClassificationInstanceProvider : IProblemInstanceProvider<IClassificationProblemData> {
    32     public IClassificationProblemData LoadData(string path) {
     28  public abstract class ClassificationInstanceProvider : ProblemInstanceProvider<IClassificationProblemData> {
     29    public override IClassificationProblemData LoadData(string path) {
    3330      TableFileParser csvFileParser = new TableFileParser();
    3431
     
    5653      return claData;
    5754    }
    58 
    59     public void SaveData(IClassificationProblemData instance, string path) {
    60       StringBuilder strBuilder = new StringBuilder();
    61 
    62       foreach (var variable in instance.InputVariables) {
    63         strBuilder.Append(variable + ";");
    64       }
    65       strBuilder.Remove(strBuilder.Length - 1, 1);
    66       strBuilder.AppendLine();
    67 
    68       Dataset dataset = instance.Dataset;
    69 
    70       for (int i = 0; i < dataset.Rows; i++) {
    71         for (int j = 0; j < dataset.Columns; j++) {
    72           strBuilder.Append(dataset.GetValue(i, j) + ";");
    73         }
    74         strBuilder.Remove(strBuilder.Length - 1, 1);
    75         strBuilder.AppendLine();
    76       }
    77 
    78       using (StreamWriter writer = new StreamWriter(path)) {
    79         writer.Write(strBuilder);
    80       }
    81     }
    82 
    83     public abstract IEnumerable<IDataDescriptor> GetDataDescriptors();
    84     public abstract IClassificationProblemData LoadData(IDataDescriptor descriptor);
    85 
    86     public abstract string Name { get; }
    87     public abstract string Description { get; }
    88     public abstract Uri WebLink { get; }
    89     public abstract string ReferencePublication { get; }
    9055  }
    9156}
Note: See TracChangeset for help on using the changeset viewer.