Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/Model.cs @ 2326

Last change on this file since 2326 was 2326, checked in by mkommend, 15 years ago

added name in IModel
added update methods for IModel and ModelData
(ticket #712)

File size: 4.7 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Linq;
25using System.Data.Linq;
26using System.Data.Linq.Mapping;
27using System.Text;
28
29namespace HeuristicLab.Modeling.Database.SQLServerCompact {
30  [Table(Name = "Model")]
31  public class Model : IModel {
32    public Model() {
33      targetVariable = default(EntityRef<Variable>);
34      algorithm = default(EntityRef<Algorithm>);     
35    }
36
37    public Model(Variable targetVariable, Algorithm algorithm)
38      : this() {
39      this.targetVariableId = targetVariable.Id;
40      this.algorithmId = algorithm.Id;
41    }
42
43    private int id;
44    [Column(Storage = "id", IsPrimaryKey = true, IsDbGenerated = true)]
45    public int Id {
46      get { return this.id; }
47      private set { this.id = value; }
48    }
49
50    private int algorithmId;
51    [Column(Storage = "algorithmId", CanBeNull = false)]
52    public int AlgorithmId {
53      get { return this.algorithmId; }
54      private set {
55        if (algorithmId != value) {
56          if (algorithm.HasLoadedOrAssignedValue)
57            throw new ForeignKeyReferenceAlreadyHasValueException();
58          algorithmId = value;
59        }
60      }
61    }
62
63    private EntityRef<Algorithm> algorithm;
64    [Association(Storage = "algorithm", ThisKey = "AlgorithmId", OtherKey = "Id", IsForeignKey = true)]
65    public Algorithm Algorithm {
66      get { return this.algorithm.Entity; }
67    }
68
69    IAlgorithm IModel.Algorithm {
70      get { return this.Algorithm; }
71    }
72
73    private int targetVariableId;
74    [Column(Storage = "targetVariableId", CanBeNull = false)]
75    public int TargetVariableId {
76      get { return this.targetVariableId; }
77      private set {
78        if (targetVariableId != value) {
79          if (targetVariable.HasLoadedOrAssignedValue)
80            throw new ForeignKeyReferenceAlreadyHasValueException();
81          targetVariableId = value;
82        }
83      }
84    }
85
86    private EntityRef<Variable> targetVariable;
87    [Association(Storage = "targetVariable", ThisKey = "TargetVariableId", OtherKey = "Id", IsForeignKey = true)]
88    public Variable TargetVariable {
89      get { return this.targetVariable.Entity; }
90    }
91
92    IVariable IModel.TargetVariable {
93      get { return this.TargetVariable; }
94    }
95
96    private string name;
97    [Column(Storage = "name", CanBeNull = true)]
98    public string Name {
99      get { return this.name; }
100      set { this.name = value; }
101    }
102
103    private int trainingSamplesStart;
104    [Column(Storage = "trainingSamplesStart", CanBeNull = false)]
105    public int TrainingSamplesStart {
106      get { return this.trainingSamplesStart; }
107      set { this.trainingSamplesStart = value; }
108    }
109
110    private int trainingSamplesEnd;
111    [Column(Storage = "trainingSamplesEnd", CanBeNull = false)]
112    public int TrainingSamplesEnd {
113      get { return this.trainingSamplesEnd; }
114      set { this.trainingSamplesEnd = value; }
115    }
116
117    private int validationSamplesStart;
118    [Column(Storage = "validationSamplesStart", CanBeNull = false)]
119    public int ValidationSamplesStart {
120      get { return this.validationSamplesStart; }
121      set { this.validationSamplesStart = value; }
122    }
123
124    private int validationSamplesEnd;
125    [Column(Storage = "validationSamplesEnd", CanBeNull = false)]
126    public int ValidationSamplesEnd {
127      get { return this.validationSamplesEnd; }
128      set { this.validationSamplesEnd = value; }
129    }
130
131    private int testSamplesStart;
132    [Column(Storage = "testSamplesStart", CanBeNull = false)]
133    public int TestSamplesStart {
134      get { return this.testSamplesStart; }
135      set { this.testSamplesStart = value; }
136    }
137
138    private int testSamplesEnd;
139    [Column(Storage = "testSamplesEnd", CanBeNull = false)]
140    public int TestSamplesEnd {
141      get { return this.testSamplesEnd; }
142      set { this.testSamplesEnd = value; }
143    }
144  }
145}
Note: See TracBrowser for help on using the repository browser.