Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/07/09 00:38:54 (16 years ago)
Author:
gkronber
Message:

worked on presentation layer for CEDMA #419

Location:
branches/CEDMA-Refactoring-Ticket419
Files:
3 edited
4 moved

Legend:

Unmodified
Added
Removed
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Charting/HeuristicLab.CEDMA.Charting.csproj

    r858 r1075  
    8686      <DependentUpon>ModelView.cs</DependentUpon>
    8787    </Compile>
    88     <Compile Include="Record.cs" />
    8988    <Compile Include="HeuristicLabCedmaChartingPlugin.cs" />
    9089    <Compile Include="Properties\AssemblyInfo.cs" />
    91     <Compile Include="ResultList.cs" />
    92     <Compile Include="ResultListView.cs">
    93       <SubType>UserControl</SubType>
    94     </Compile>
    95     <Compile Include="ResultListView.Designer.cs">
    96       <DependentUpon>ResultListView.cs</DependentUpon>
    97     </Compile>
    9890  </ItemGroup>
    9991  <ItemGroup>
     
    156148      <SubType>Designer</SubType>
    157149    </EmbeddedResource>
    158     <EmbeddedResource Include="ResultListView.resx">
    159       <DependentUpon>ResultListView.cs</DependentUpon>
    160       <SubType>Designer</SubType>
    161     </EmbeddedResource>
    162150  </ItemGroup>
    163151  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/DataSetView.cs

    r1073 r1075  
    6464    private void resultsButton_Click(object sender, EventArgs e) {
    6565      Results results = dataSet.GetResults();
    66       Control resultsControl = (Control)results.CreateView();
     66      IControl resultsControl = (IControl)results.CreateView();
    6767      PluginManager.ControlManager.ShowControl(resultsControl);
    6868    }
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/HeuristicLab.CEDMA.Core.csproj

    r1073 r1075  
    7676      <SubType>UserControl</SubType>
    7777    </Compile>
    78     <Compile Include="Interfaces\ICedmaAlgorithm.cs" />
    79     <Compile Include="Interfaces\ITimeSeriesAlgorithm.cs" />
    80     <Compile Include="Interfaces\IClassificationAlgorithm.cs" />
    81     <Compile Include="Interfaces\IRegressionAlgorithm.cs" />
    8278    <Compile Include="Problem.cs" />
    8379    <Compile Include="DataSet.cs" />
     
    104100    <Compile Include="Properties\AssemblyInfo.cs" />
    105101    <Compile Include="ProblemInjector.cs" />
     102    <Compile Include="Results.cs" />
     103    <Compile Include="ResultsView.cs">
     104      <SubType>UserControl</SubType>
     105    </Compile>
     106    <Compile Include="ResultsView.Designer.cs">
     107      <DependentUpon>ResultsView.cs</DependentUpon>
     108    </Compile>
    106109  </ItemGroup>
    107110  <ItemGroup>
     
    152155      <DependentUpon>ProblemView.cs</DependentUpon>
    153156    </EmbeddedResource>
     157    <EmbeddedResource Include="ResultsView.resx">
     158      <DependentUpon>ResultsView.cs</DependentUpon>
     159    </EmbeddedResource>
    154160  </ItemGroup>
    155161  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/Results.cs

    r1073 r1075  
    3636
    3737namespace HeuristicLab.CEDMA.Core {
    38   public class ResultList : IViewable {
     38  public class Results : IViewable, IEnumerable<Record> {
    3939    private Dictionary<Record, Dataset> datasets;
    4040
     
    4444      set {
    4545        store = value;
    46         Action reloadList = ReloadList;
    47         reloadList.BeginInvoke(null, null);
    4846      }
    4947    }
    5048
    51     private List<string> variableNames = new List<string>() { Record.TARGET_VARIABLE, Record.TREE_SIZE, Record.TREE_HEIGHT, Record.SELECTIONPRESSURE,
    52     Record.MAPE_TRAINING, Record.MAPE_VALIDATION, Record.MAPE_TEST,
    53     Record.R2_TRAINING, Record.R2_VALIDATION, Record.R2_TEST};
    54     public string[] VariableNames {
    55       get {
    56         return variableNames.ToArray();
    57       }
    58     }
    59 
    60     private Dictionary<Entity, string> predicateToVariableName;
    61 
    62     public event EventHandler<RecordAddedEventArgs> OnRecordAdded;
    63 
    64     private List<Record> records;
    65     public List<Record> Records {
    66       get {
    67         List<Record> result = new List<Record>();
    68         lock(records) {
    69           result.AddRange(records);
    70         }
    71         return result;
    72       }
    73     }
    7449    private void ReloadList() {
    7550      var results = store.Select(new Statement(Ontology.AnyEntity, Ontology.PredicateInstanceOf, Ontology.TypeGeneticProgrammingFunctionTree))
     
    10580    }
    10681
    107     private void FireRecordAdded(Record r) {
    108       if(OnRecordAdded != null) OnRecordAdded(this, new RecordAddedEventArgs(r));
    109     }
    110 
    111     public ResultList()
     82    public Results(IStore store)
    11283      : base() {
     84      this.store = store;
    11385      records = new List<Record>();
    11486      datasets = new Dictionary<Record, Dataset>();
     
    12799
    128100    public override IView CreateView() {
    129       return new ResultListView(this);
     101      return new ResultsView(this);
    130102    }
    131103
    132     internal void OpenModel(Record record) {
    133       IList<Statement> modelResults = store.Select(new Statement(new Entity(record.Uri), Ontology.PredicateSerializedData, Ontology.AnyEntity));
    134       if(modelResults.Count == 1) {
    135         string rawData = ((SerializedLiteral)modelResults[0].Property).RawData;
    136         XmlDocument doc = new XmlDocument();
    137         doc.LoadXml(rawData);
    138         IFunctionTree tree = (IFunctionTree)PersistenceManager.Restore(doc.ChildNodes[1], new Dictionary<Guid, IStorable>());
    139         int targetVariable = (int)record.Get(Record.TARGET_VARIABLE);
    140         Dataset dataset = GetDataset(record);
     104    //internal void OpenModel(Record record) {
     105    //  IList<Statement> modelResults = store.Select(new Statement(new Entity(record.Uri), Ontology.PredicateSerializedData, Ontology.AnyEntity));
     106    //  if(modelResults.Count == 1) {
     107    //    string rawData = ((SerializedLiteral)modelResults[0].Property).RawData;
     108    //    XmlDocument doc = new XmlDocument();
     109    //    doc.LoadXml(rawData);
     110    //    IFunctionTree tree = (IFunctionTree)PersistenceManager.Restore(doc.ChildNodes[1], new Dictionary<Guid, IStorable>());
     111    //    int targetVariable = (int)record.Get(Record.TARGET_VARIABLE);
     112    //    Dataset dataset = GetDataset(record);
    141113
    142         ModelView modelView = new ModelView(record, dataset, tree, targetVariable);
    143         PluginManager.ControlManager.ShowControl(modelView);
    144       }
     114    //    ModelView modelView = new ModelView(record, dataset, tree, targetVariable);
     115    //    PluginManager.ControlManager.ShowControl(modelView);
     116    //  }
     117    //}
     118
     119    //private Dataset GetDataset(Record record) {
     120    //  if(!datasets.ContainsKey(record)) {
     121    //    IList<Statement> result = store.Select(new Statement(Ontology.AnyEntity, Ontology.PredicateHasModel, new Entity(record.Uri)));
     122    //    if(result.Count == 1) {
     123    //      IList<Statement> datasetResult = store.Select(new Statement(result[0].Subject, Ontology.PredicateSerializedData, Ontology.AnyEntity));
     124    //      if(datasetResult.Count == 1) {
     125    //        string rawData = ((SerializedLiteral)datasetResult[0].Property).RawData;
     126    //        XmlDocument doc = new XmlDocument();
     127    //        doc.LoadXml(rawData);
     128    //        Dataset dataset = (Dataset)PersistenceManager.Restore(doc.ChildNodes[1], new Dictionary<Guid, IStorable>());
     129    //        datasets.Add(record, dataset);
     130    //      }
     131    //    }
     132    //  }
     133    //  return datasets[record];
     134    //}
     135
     136    //internal void OpenAlgorithm(Record record) {
     137    //  IList<Statement> generatedBy = store.Select(new Statement(new Entity(record.Uri), Ontology.PredicateGeneratedBy, Ontology.AnyEntity));
     138    //  if(generatedBy.Count == 1) {
     139    //    IList<Statement> algoResult = store.Select(new Statement((Entity)generatedBy[0].Property, Ontology.PredicateSerializedData, Ontology.AnyEntity));
     140    //    if(algoResult.Count == 1) {
     141    //      string rawData = ((SerializedLiteral)algoResult[0].Property).RawData;
     142    //      XmlDocument doc = new XmlDocument();
     143    //      doc.LoadXml(rawData);
     144    //      IItem algo = (IItem)PersistenceManager.Restore(doc.ChildNodes[1], new Dictionary<Guid, IStorable>());
     145    //      PluginManager.ControlManager.ShowControl(algo.CreateView());
     146    //    }
     147    //  }
     148    //}
     149
     150    internal void FilterDataSet(Entity entity) {
     151
    145152    }
    146153
    147     private Dataset GetDataset(Record record) {
    148       if(!datasets.ContainsKey(record)) {
    149         IList<Statement> result = store.Select(new Statement(Ontology.AnyEntity, Ontology.PredicateHasModel, new Entity(record.Uri)));
    150         if(result.Count == 1) {
    151           IList<Statement> datasetResult = store.Select(new Statement(result[0].Subject, Ontology.PredicateSerializedData, Ontology.AnyEntity));
    152           if(datasetResult.Count == 1) {
    153             string rawData = ((SerializedLiteral)datasetResult[0].Property).RawData;
    154             XmlDocument doc = new XmlDocument();
    155             doc.LoadXml(rawData);
    156             Dataset dataset = (Dataset)PersistenceManager.Restore(doc.ChildNodes[1], new Dictionary<Guid, IStorable>());
    157             datasets.Add(record, dataset);
    158           }
    159         }
    160       }
    161       return datasets[record];
     154    #region IEnumerable<Record> Members
     155
     156    public IEnumerator<Record> GetEnumerator() {
     157      throw new NotImplementedException();
    162158    }
    163159
    164     internal void OpenAlgorithm(Record record) {
    165       IList<Statement> generatedBy = store.Select(new Statement(new Entity(record.Uri), Ontology.PredicateGeneratedBy, Ontology.AnyEntity));
    166       if(generatedBy.Count == 1) {
    167         IList<Statement> algoResult = store.Select(new Statement((Entity)generatedBy[0].Property, Ontology.PredicateSerializedData, Ontology.AnyEntity));
    168         if(algoResult.Count == 1) {
    169           string rawData = ((SerializedLiteral)algoResult[0].Property).RawData;
    170           XmlDocument doc = new XmlDocument();
    171           doc.LoadXml(rawData);
    172           IItem algo = (IItem)PersistenceManager.Restore(doc.ChildNodes[1], new Dictionary<Guid, IStorable>());
    173           PluginManager.ControlManager.ShowControl(algo.CreateView());
    174         }
    175       }
     160    #endregion
     161
     162    #region IEnumerable Members
     163
     164    IEnumerator IEnumerable.GetEnumerator() {
     165      return this.GetEnumerator();
    176166    }
     167
     168    #endregion
    177169  }
    178170}
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ResultsView.Designer.cs

    r1073 r1075  
    11namespace HeuristicLab.CEDMA.Core {
    2   partial class ResultListView {
     2  partial class ResultsView {
    33    /// <summary>
    44    /// Required designer variable.
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ResultsView.cs

    r1073 r1075  
    88using System.Windows.Forms;
    99using HeuristicLab.Core;
     10using HeuristicLab.CEDMA.Charting;
    1011
    1112namespace HeuristicLab.CEDMA.Core {
    12   public partial class ResultListView : ViewBase {
    13     private ResultList results;
     13  public partial class ResultsView : ViewBase {
     14    private Results results;
    1415    private const string FREQUENCY = "<Frequency>";
    1516    private const string CONSTANT_SIZE = "<constant>";
     
    1819    private Label pleaseSelectAxisLabel = new Label();
    1920
    20     public ResultListView(ResultList results) {
     21    public ResultsView(Results results) {
    2122      this.results = results;
    2223      InitializeComponent();
Note: See TracChangeset for help on using the changeset viewer.