Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/InputVariableResult.cs @ 3188

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

added license information (ticket #712)

File size: 3.8 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.Data.Linq;
25using System.Data.Linq.Mapping;
26using System.Text;
27
28namespace HeuristicLab.Modeling.Database.SQLServerCompact {
29  [Table(Name="InputVariableResult")]
30  public class InputVariableResult : IInputVariableResult {
31    public InputVariableResult() {
32      this.model = default(EntityRef<Model>);
33      this.variable = default(EntityRef<Variable>);
34      this.result = default(EntityRef<Result>);
35    }
36
37    public InputVariableResult(InputVariable inputVariable, Result result, double value)
38      : this() {
39      this.variableId = inputVariable.VariableId;
40      this.modelId = inputVariable.ModelId;
41      this.resultId = result.Id;
42      this.value = value;
43    }
44
45    private int variableId;
46    [Column(Storage = "variableId", IsPrimaryKey = true)]
47    public int VariableId {
48      get { return this.variableId; }
49      private set {
50        if (variableId != value) {
51          if (variable.HasLoadedOrAssignedValue)
52            throw new ForeignKeyReferenceAlreadyHasValueException();
53          variableId = value;
54        }
55      }
56    }
57
58    private EntityRef<Variable> variable;
59    [Association(Storage = "variable", ThisKey = "VariableId", OtherKey = "Id", IsForeignKey = true)]
60    public Variable Variable {
61      get { return variable.Entity; }
62    }
63
64    IVariable IInputVariableResult.Variable {
65      get { return this.Variable; }
66    }
67
68    private int modelId;
69    [Column(Storage = "modelId", IsPrimaryKey = true)]
70    public int ModelId {
71      get { return this.modelId; }
72      private set {
73        if (modelId != value) {
74          if (model.HasLoadedOrAssignedValue)
75            throw new ForeignKeyReferenceAlreadyHasValueException();
76          modelId = value;
77        }
78      }
79    }
80
81    private EntityRef<Model> model;
82    [Association(Storage = "model", ThisKey = "ModelId", OtherKey = "Id", IsForeignKey = true)]
83    public Model Model {
84      get { return model.Entity; }
85    }
86
87    IModel IInputVariableResult.Model {
88      get { return this.Model; }
89    }
90
91    private int resultId;
92    [Column(Storage = "resultId", IsPrimaryKey = true)]
93    public int ResultId {
94      get { return this.resultId; }
95      private set {
96        if (resultId != value) {
97          if (result.HasLoadedOrAssignedValue)
98            throw new ForeignKeyReferenceAlreadyHasValueException();
99          resultId = value;
100        }
101      }
102    }
103
104    private EntityRef<Result> result;
105    [Association(Storage = "result", ThisKey = "ResultId", OtherKey = "Id", IsForeignKey = true)]
106    public Result Result {
107      get { return result.Entity; }
108    }
109
110    IResult IInputVariableResult.Result {
111      get { return this.Result; }
112    }
113
114    private double value;
115    [Column(Storage = "value", CanBeNull = false)]
116    public double Value {
117      get { return this.value; }
118      set { this.value = value; }
119    }
120  }
121}
Note: See TracBrowser for help on using the repository browser.