Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/23/14 15:27:20 (11 years ago)
Author:
mleitner
Message:

Add FilteredPreprocessing data for applying and caching filter status

Location:
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/FilterLogic.cs

    r10703 r10783  
    2424using System;
    2525using System.Linq;
     26using HeuristicLab.DataPreprocessing.Interfaces;
    2627namespace HeuristicLab.DataPreprocessing {
    2728  public class FilterLogic : IFilterLogic {
    2829
    29     private ITransactionalPreprocessingData preprocessingData;
     30    private IFilteredPreprocessingData preprocessingData;
    3031
    31     public FilterLogic(ITransactionalPreprocessingData preprocessingData) {
     32    public FilterLogic(IFilteredPreprocessingData preprocessingData)
     33    {
    3234      this.preprocessingData = preprocessingData;
    3335    }
     
    5254        }
    5355
     56        preprocessingData.SetFilter(result);
     57       
    5458        return result;
    5559    }
     
    5761    public void Apply(IList<IFilter> filters)
    5862    {
    59         bool[] results = Preview(filters);
     63        preprocessingData.SetFilter(Preview(filters));
     64        preprocessingData.PersistFilter();
     65    }
    6066
    61         preprocessingData.InTransaction(() =>
    62         {
    63           for (int row = (results.Length - 1); row >= 0; --row)
    64           {
    65             if (results[row])
    66             {
    67               preprocessingData.DeleteRow(row);
    68             }
    69           }
    70         });
    71      }
    72 
     67    public void Reset() {
     68      preprocessingData.ResetFilter();
     69    }
    7370
    7471    public IPreprocessingData PreprocessingData
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingContext.cs

    r10695 r10783  
    2828using HeuristicLab.Problems.DataAnalysis.Symbolic;
    2929using Variable = HeuristicLab.Problems.DataAnalysis.Symbolic.Variable;
     30using HeuristicLab.DataPreprocessing.Implementations;
     31using HeuristicLab.DataPreprocessing.Interfaces;
    3032
    3133namespace HeuristicLab.DataPreprocessing {
     
    3436    : Item, IPreprocessingContext {
    3537
    36     public ITransactionalPreprocessingData Data { get; private set; }
     38    public IFilteredPreprocessingData Data { get; private set; }
    3739
    3840    public IDataAnalysisProblemData DataAnalysisProblemData { get; private set; }
     
    4345
    4446    public PreprocessingContext(IDataAnalysisProblemData dataAnalysisProblemData, IAlgorithm algorithm, IDataAnalysisProblem problem) {
    45       Data = new TransactionalPreprocessingData(dataAnalysisProblemData);
     47
     48      TransactionalPreprocessingData transactionalPreprocessingData = new TransactionalPreprocessingData(dataAnalysisProblemData);
     49
     50      Data = new FilteredPreprocessingData(transactionalPreprocessingData);
    4651      DataAnalysisProblemData = dataAnalysisProblemData;
    4752      Algorithm = algorithm;
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingData.cs

    r10772 r10783  
    8484
    8585    protected IList<IList> CopyVariableValues(IList<IList> original) {
    86       var copy = new List<IList>(variableValues);
     86      var copy = new List<IList>(original);
    8787      for (int i = 0; i < original.Count; ++i) {
    88         variableValues[i] = (IList)Activator.CreateInstance(original[i].GetType(), original[i]);
     88        copy[i] = (IList)Activator.CreateInstance(original[i].GetType(), original[i]);
    8989      }
    9090      return copy;
Note: See TracChangeset for help on using the changeset viewer.