Changeset 1075 for branches/CEDMA-Refactoring-Ticket419
- Timestamp:
- 01/07/09 00:38:54 (16 years ago)
- 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 86 86 <DependentUpon>ModelView.cs</DependentUpon> 87 87 </Compile> 88 <Compile Include="Record.cs" />89 88 <Compile Include="HeuristicLabCedmaChartingPlugin.cs" /> 90 89 <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>98 90 </ItemGroup> 99 91 <ItemGroup> … … 156 148 <SubType>Designer</SubType> 157 149 </EmbeddedResource> 158 <EmbeddedResource Include="ResultListView.resx">159 <DependentUpon>ResultListView.cs</DependentUpon>160 <SubType>Designer</SubType>161 </EmbeddedResource>162 150 </ItemGroup> 163 151 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/DataSetView.cs
r1073 r1075 64 64 private void resultsButton_Click(object sender, EventArgs e) { 65 65 Results results = dataSet.GetResults(); 66 Control resultsControl = (Control)results.CreateView();66 IControl resultsControl = (IControl)results.CreateView(); 67 67 PluginManager.ControlManager.ShowControl(resultsControl); 68 68 } -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/HeuristicLab.CEDMA.Core.csproj
r1073 r1075 76 76 <SubType>UserControl</SubType> 77 77 </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" />82 78 <Compile Include="Problem.cs" /> 83 79 <Compile Include="DataSet.cs" /> … … 104 100 <Compile Include="Properties\AssemblyInfo.cs" /> 105 101 <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> 106 109 </ItemGroup> 107 110 <ItemGroup> … … 152 155 <DependentUpon>ProblemView.cs</DependentUpon> 153 156 </EmbeddedResource> 157 <EmbeddedResource Include="ResultsView.resx"> 158 <DependentUpon>ResultsView.cs</DependentUpon> 159 </EmbeddedResource> 154 160 </ItemGroup> 155 161 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/Results.cs
r1073 r1075 36 36 37 37 namespace HeuristicLab.CEDMA.Core { 38 public class Result List : IViewable{38 public class Results : IViewable, IEnumerable<Record> { 39 39 private Dictionary<Record, Dataset> datasets; 40 40 … … 44 44 set { 45 45 store = value; 46 Action reloadList = ReloadList;47 reloadList.BeginInvoke(null, null);48 46 } 49 47 } 50 48 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 }74 49 private void ReloadList() { 75 50 var results = store.Select(new Statement(Ontology.AnyEntity, Ontology.PredicateInstanceOf, Ontology.TypeGeneticProgrammingFunctionTree)) … … 105 80 } 106 81 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) 112 83 : base() { 84 this.store = store; 113 85 records = new List<Record>(); 114 86 datasets = new Dictionary<Record, Dataset>(); … … 127 99 128 100 public override IView CreateView() { 129 return new Result ListView(this);101 return new ResultsView(this); 130 102 } 131 103 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); 141 113 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 145 152 } 146 153 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(); 162 158 } 163 159 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(); 176 166 } 167 168 #endregion 177 169 } 178 170 } -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ResultsView.Designer.cs
r1073 r1075 1 1 namespace HeuristicLab.CEDMA.Core { 2 partial class Result ListView {2 partial class ResultsView { 3 3 /// <summary> 4 4 /// Required designer variable. -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ResultsView.cs
r1073 r1075 8 8 using System.Windows.Forms; 9 9 using HeuristicLab.Core; 10 using HeuristicLab.CEDMA.Charting; 10 11 11 12 namespace HeuristicLab.CEDMA.Core { 12 public partial class Result ListView : ViewBase {13 private Result Listresults;13 public partial class ResultsView : ViewBase { 14 private Results results; 14 15 private const string FREQUENCY = "<Frequency>"; 15 16 private const string CONSTANT_SIZE = "<constant>"; … … 18 19 private Label pleaseSelectAxisLabel = new Label(); 19 20 20 public Result ListView(ResultListresults) {21 public ResultsView(Results results) { 21 22 this.results = results; 22 23 InitializeComponent();
Note: See TracChangeset
for help on using the changeset viewer.