Changeset 4187
- Timestamp:
- 08/10/10 23:07:25 (14 years ago)
- Location:
- trunk/tools/Templates
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/Templates/HeuristicLab.VS2010Wizards/AlgorithmWizard.cs
r4176 r4187 59 59 if (!form.IsMultiObjective) 60 60 replacementsDictionary["$problemType$"] = problemType.Replace("Multi", "Single"); 61 replacementsDictionary.Add("$parameterProperties$", form.ParameterProperties); 62 replacementsDictionary.Add("$properties$", form.Properties); 63 replacementsDictionary.Add("$parameterInitializers$", form.ParameterInitializers); 61 64 shouldAddItem = true; 62 65 } else shouldAddItem = false; -
trunk/tools/Templates/HeuristicLab.VS2010Wizards/AlgorithmWizardForm.Designer.cs
r4181 r4187 33 33 this.finishButton = new System.Windows.Forms.Button(); 34 34 this.panel1 = new System.Windows.Forms.Panel(); 35 this.label4 = new System.Windows.Forms.Label(); 36 this.pictureBox1 = new System.Windows.Forms.PictureBox(); 35 37 this.page2Panel = new System.Windows.Forms.Panel(); 36 38 this.label3 = new System.Windows.Forms.Label(); 37 this.label4 = new System.Windows.Forms.Label(); 38 this.pictureBox1 = new System.Windows.Forms.PictureBox(); 39 this.parametersControl = new HeuristicLab.VS2010Wizards.ParametersControl(); 39 40 this.panel2 = new System.Windows.Forms.Panel(); 40 41 this.nextButton = new System.Windows.Forms.Button(); 41 42 this.previousButton = new System.Windows.Forms.Button(); 42 43 this.page1Panel = new System.Windows.Forms.Panel(); 43 this.parametersControl1 = new HeuristicLab.VS2010Wizards.ParametersControl();44 44 this.panel1.SuspendLayout(); 45 ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); 45 46 this.page2Panel.SuspendLayout(); 46 ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();47 47 this.page1Panel.SuspendLayout(); 48 48 this.SuspendLayout(); … … 76 76 this.algorithmDescriptionTextBox.Size = new System.Drawing.Size(469, 63); 77 77 this.algorithmDescriptionTextBox.TabIndex = 3; 78 this.algorithmDescriptionTextBox.TextChanged += new System.EventHandler(this.algorithmDescriptionTextBox_TextChanged);79 78 // 80 79 // isMultiObjectiveCheckBox … … 88 87 this.isMultiObjectiveCheckBox.Text = "Multi-Objective"; 89 88 this.isMultiObjectiveCheckBox.UseVisualStyleBackColor = true; 90 this.isMultiObjectiveCheckBox.CheckedChanged += new System.EventHandler(this.isMultiObjectiveCheckBox_CheckedChanged);91 89 // 92 90 // algorithmNameTextBox … … 98 96 this.algorithmNameTextBox.TabIndex = 1; 99 97 this.algorithmNameTextBox.Text = "MyAlgorithm"; 100 this.algorithmNameTextBox.TextChanged += new System.EventHandler(this.algorithmNameTextBox_TextChanged);101 98 // 102 99 // cancelButton … … 134 131 this.panel1.TabIndex = 8; 135 132 // 136 // page2Panel137 //138 this.page2Panel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)139 | System.Windows.Forms.AnchorStyles.Left)140 | System.Windows.Forms.AnchorStyles.Right)));141 this.page2Panel.Controls.Add(this.label3);142 this.page2Panel.Controls.Add(this.parametersControl1);143 this.page2Panel.Location = new System.Drawing.Point(0, 86);144 this.page2Panel.Name = "page2Panel";145 this.page2Panel.Size = new System.Drawing.Size(676, 289);146 this.page2Panel.TabIndex = 10;147 this.page2Panel.Visible = false;148 //149 // label3150 //151 this.label3.AutoSize = true;152 this.label3.Location = new System.Drawing.Point(13, 10);153 this.label3.Name = "label3";154 this.label3.Size = new System.Drawing.Size(63, 13);155 this.label3.TabIndex = 1;156 this.label3.Text = "Parameters:";157 //158 133 // label4 159 134 // … … 174 149 this.pictureBox1.TabIndex = 0; 175 150 this.pictureBox1.TabStop = false; 151 // 152 // page2Panel 153 // 154 this.page2Panel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 155 | System.Windows.Forms.AnchorStyles.Left) 156 | System.Windows.Forms.AnchorStyles.Right))); 157 this.page2Panel.Controls.Add(this.label3); 158 this.page2Panel.Controls.Add(this.parametersControl); 159 this.page2Panel.Location = new System.Drawing.Point(0, 86); 160 this.page2Panel.Name = "page2Panel"; 161 this.page2Panel.Size = new System.Drawing.Size(676, 289); 162 this.page2Panel.TabIndex = 10; 163 this.page2Panel.Visible = false; 164 // 165 // label3 166 // 167 this.label3.AutoSize = true; 168 this.label3.Location = new System.Drawing.Point(13, 10); 169 this.label3.Name = "label3"; 170 this.label3.Size = new System.Drawing.Size(63, 13); 171 this.label3.TabIndex = 1; 172 this.label3.Text = "Parameters:"; 173 // 174 // parametersControl 175 // 176 this.parametersControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 177 | System.Windows.Forms.AnchorStyles.Left) 178 | System.Windows.Forms.AnchorStyles.Right))); 179 this.parametersControl.Location = new System.Drawing.Point(0, 33); 180 this.parametersControl.Name = "parametersControl"; 181 this.parametersControl.Size = new System.Drawing.Size(676, 256); 182 this.parametersControl.TabIndex = 0; 176 183 // 177 184 // panel2 … … 224 231 this.page1Panel.TabIndex = 9; 225 232 // 226 // parametersControl1227 //228 this.parametersControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)229 | System.Windows.Forms.AnchorStyles.Left)230 | System.Windows.Forms.AnchorStyles.Right)));231 this.parametersControl1.Location = new System.Drawing.Point(0, 33);232 this.parametersControl1.Name = "parametersControl1";233 this.parametersControl1.Size = new System.Drawing.Size(676, 256);234 this.parametersControl1.TabIndex = 0;235 //236 233 // AlgorithmWizardForm 237 234 // … … 245 242 this.Controls.Add(this.finishButton); 246 243 this.Controls.Add(this.panel2); 244 this.Controls.Add(this.page2Panel); 247 245 this.Controls.Add(this.page1Panel); 248 this.Controls.Add(this.page2Panel);249 246 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 250 247 this.Name = "AlgorithmWizardForm"; … … 252 249 this.panel1.ResumeLayout(false); 253 250 this.panel1.PerformLayout(); 251 ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); 254 252 this.page2Panel.ResumeLayout(false); 255 253 this.page2Panel.PerformLayout(); 256 ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();257 254 this.page1Panel.ResumeLayout(false); 258 255 this.page1Panel.PerformLayout(); … … 278 275 private System.Windows.Forms.Panel page1Panel; 279 276 private System.Windows.Forms.Panel page2Panel; 280 private ParametersControl parametersControl 1;277 private ParametersControl parametersControl; 281 278 private System.Windows.Forms.Label label3; 282 279 } -
trunk/tools/Templates/HeuristicLab.VS2010Wizards/AlgorithmWizardForm.cs
r4181 r4187 22 22 private set; 23 23 } 24 public string ParameterProperties { 25 get; 26 private set; 27 } 28 public string Properties { 29 get; 30 private set; 31 } 32 public string ParameterInitializers { 33 get; 34 private set; 35 } 24 36 25 37 public AlgorithmWizardForm() { … … 31 43 32 44 private void finishButton_Click(object sender, System.EventArgs e) { 45 SetProperties(); 33 46 DialogResult = System.Windows.Forms.DialogResult.OK; 34 47 Close(); … … 40 53 } 41 54 42 private void algorithmNameTextBox_TextChanged(object sender, EventArgs e) {55 private void SetProperties() { 43 56 AlgorithmName = algorithmNameTextBox.Text; 44 }45 46 private void algorithmDescriptionTextBox_TextChanged(object sender, EventArgs e) {47 57 AlgorithmDescription = algorithmDescriptionTextBox.Text; 48 }49 50 private void isMultiObjectiveCheckBox_CheckedChanged(object sender, EventArgs e) {51 58 IsMultiObjective = isMultiObjectiveCheckBox.Checked; 59 ParameterProperties = parametersControl.GetParameterProperties("private"); 60 Properties = parametersControl.GetProperties("public"); 61 ParameterInitializers = parametersControl.GetInitializers(); 52 62 } 53 63 -
trunk/tools/Templates/HeuristicLab.VS2010Wizards/AlgorithmWizardForm.resx
r4181 r4187 113 113 </resheader> 114 114 <resheader name="reader"> 115 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version= 2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>115 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 116 116 </resheader> 117 117 <resheader name="writer"> 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version= 2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </resheader> 120 <assembly alias="System.Drawing" name="System.Drawing, Version= 2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />120 <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 121 121 <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> 122 122 <value> -
trunk/tools/Templates/HeuristicLab.VS2010Wizards/ParametersControl.Designer.cs
r4181 r4187 73 73 this.removeButton = new System.Windows.Forms.Button(); 74 74 this.addButton = new System.Windows.Forms.Button(); 75 this.parameterTypeComboBox = new System.Windows.Forms.ComboBox(); 76 this.customInputTextBox = new System.Windows.Forms.TextBox(); 75 77 this.SuspendLayout(); 76 78 // … … 170 172 this.addButton.Click += new System.EventHandler(this.addButton_Click); 171 173 // 174 // parameterTypeComboBox 175 // 176 this.parameterTypeComboBox.FormattingEnabled = true; 177 this.parameterTypeComboBox.Items.AddRange(new object[] { 178 "", 179 "Value", 180 "Lookup", 181 "ValueLookup", 182 "ScopeTreeLookup"}); 183 this.parameterTypeComboBox.Location = new System.Drawing.Point(3, 232); 184 this.parameterTypeComboBox.Name = "parameterTypeComboBox"; 185 this.parameterTypeComboBox.Size = new System.Drawing.Size(26, 21); 186 this.parameterTypeComboBox.TabIndex = 5; 187 this.parameterTypeComboBox.Visible = false; 188 this.parameterTypeComboBox.SelectedIndexChanged += new System.EventHandler(this.parameterTypeComboBox_SelectedIndexChanged); 189 this.parameterTypeComboBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.parameterTypeComboBox_KeyUp); 190 this.parameterTypeComboBox.Leave += new System.EventHandler(this.parameterTypeComboBox_Leave); 191 // 192 // customInputTextBox 193 // 194 this.customInputTextBox.Location = new System.Drawing.Point(3, 206); 195 this.customInputTextBox.Name = "customInputTextBox"; 196 this.customInputTextBox.Size = new System.Drawing.Size(26, 20); 197 this.customInputTextBox.TabIndex = 6; 198 this.customInputTextBox.Visible = false; 199 this.customInputTextBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.customInputTextBox_KeyUp); 200 this.customInputTextBox.Leave += new System.EventHandler(this.customInputTextBox_Leave); 201 // 172 202 // ParametersControl 173 203 // 204 this.Controls.Add(this.customInputTextBox); 205 this.Controls.Add(this.parameterTypeComboBox); 174 206 this.Controls.Add(this.downButton); 175 207 this.Controls.Add(this.upButton); … … 180 212 this.Size = new System.Drawing.Size(740, 256); 181 213 this.ResumeLayout(false); 214 this.PerformLayout(); 182 215 183 216 } … … 195 228 private System.Windows.Forms.ColumnHeader descriptionColumnHeader; 196 229 private System.Windows.Forms.ColumnHeader typeColumnHeader; 230 private System.Windows.Forms.ComboBox parameterTypeComboBox; 231 private System.Windows.Forms.TextBox customInputTextBox; 197 232 } 198 233 } -
trunk/tools/Templates/HeuristicLab.VS2010Wizards/ParametersControl.cs
r4181 r4187 36 36 37 37 public string GetParameterProperties(string accessModifier) { 38 return string.Empty; 38 StringBuilder builder = new StringBuilder(); 39 foreach (ListViewItem item in parametersListView.Items) { 40 string name = item.Text.Trim(); 41 string type = item.SubItems[typeColumnHeader.DisplayIndex].Text.Trim(); 42 string dataType = item.SubItems[dataTypeColumnHeader.DisplayIndex].Text.Trim(); 43 builder.Append(accessModifier); 44 builder.Append(" " + type + "Parameter"); 45 if (dataType != string.Empty) 46 builder.Append("<" + dataType + ">"); 47 builder.Append(" " + name + "Parameter {" + Environment.NewLine); 48 builder.Append("\tget { return "); 49 builder.Append("(" + type + "Parameter"); 50 if (dataType != string.Empty) 51 builder.Append("<" + dataType + ">"); 52 builder.Append(")Parameters[\"" + name + "\"]; }" + Environment.NewLine); 53 builder.Append("}" + Environment.NewLine); 54 } 55 return builder.ToString(); 39 56 } 40 57 41 58 public string GetProperties(string accessModifier) { 42 return string.Empty; 59 StringBuilder builder = new StringBuilder(); 60 foreach (ListViewItem item in parametersListView.Items) { 61 string name = item.Text.Trim(); 62 string type = item.SubItems[typeColumnHeader.DisplayIndex].Text.Trim(); 63 string dataType = item.SubItems[dataTypeColumnHeader.DisplayIndex].Text.Trim(); 64 if (type.ToLower().Equals("value")) { 65 builder.Append(accessModifier + " " + dataType); 66 builder.Append(" " + name + " {" + Environment.NewLine); 67 builder.Append("\tget { return " + name + "Parameter.Value; }" + Environment.NewLine); 68 builder.Append("\tset { " + name + "Parameter.Value = value; }" + Environment.NewLine); 69 builder.Append("}" + Environment.NewLine); 70 } 71 } 72 return builder.ToString(); 43 73 } 44 74 45 75 public string GetInitializers() { 46 return string.Empty; 47 } 48 49 private void parametersListView_MouseDoubleClick(object sender, MouseEventArgs e) { 50 var hit = parametersListView.HitTest(e.Location); 51 TextBox dynamicUserInput = new TextBox(); 52 dynamicUserInput.Left = parametersListView.Left + hit.SubItem.Bounds.Left + 3; 53 dynamicUserInput.Top = parametersListView.Top + hit.SubItem.Bounds.Top; 54 dynamicUserInput.Width = hit.SubItem.Bounds.Width; 55 dynamicUserInput.Height = hit.SubItem.Bounds.Height; 56 dynamicUserInput.Text = hit.SubItem.Text; 57 dynamicUserInput.Tag = hit.SubItem; 58 Controls.Add(dynamicUserInput); 59 dynamicUserInput.BringToFront(); 60 Refresh(); 61 dynamicUserInput.Focus(); 62 dynamicUserInput.SelectAll(); 63 dynamicUserInput.KeyUp += new KeyEventHandler(dynamicUserInput_KeyUp); 64 dynamicUserInput.LostFocus += new EventHandler(dynamicUserInput_LostFocus); 65 } 66 67 private void dynamicUserInput_LostFocus(object sender, EventArgs e) { 68 TextBox t = (TextBox)sender; 69 System.Windows.Forms.ListViewItem.ListViewSubItem subItem = t.Tag as System.Windows.Forms.ListViewItem.ListViewSubItem; 70 subItem.Text = t.Text; 71 t.KeyUp -= new KeyEventHandler(dynamicUserInput_KeyUp); 72 t.LostFocus -= new EventHandler(dynamicUserInput_LostFocus); 73 Controls.Remove(t); 74 } 75 76 private void dynamicUserInput_KeyUp(object sender, KeyEventArgs e) { 77 if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Enter) 78 dynamicUserInput_LostFocus(sender, EventArgs.Empty); 79 } 80 81 private void parametersListView_SelectedIndexChanged(object sender, EventArgs e) { 82 if (parametersListView.SelectedIndices.Count > 0) { 83 removeButton.Enabled = true; 84 upButton.Enabled = true; 85 downButton.Enabled = true; 86 } else { 87 removeButton.Enabled = false; 88 upButton.Enabled = false; 89 downButton.Enabled = false; 90 } 91 } 92 76 StringBuilder builder = new StringBuilder(); 77 foreach (ListViewItem item in parametersListView.Items) { 78 string name = item.Text.Trim(); 79 string type = item.SubItems[typeColumnHeader.DisplayIndex].Text.Trim(); 80 string dataType = item.SubItems[dataTypeColumnHeader.DisplayIndex].Text.Trim(); 81 string description = item.SubItems[descriptionColumnHeader.DisplayIndex].Text.Trim(); 82 string initialValue = item.SubItems[defaultValueColumnHeader.DisplayIndex].Text.Trim(); 83 builder.Append("\tParameters.Add(new " + type + "Parameter"); 84 if (dataType != string.Empty) 85 builder.Append("<" + dataType + ">"); 86 builder.Append("(\"" + name + "\", "); 87 builder.Append("\"" + description + "\""); 88 if (initialValue != string.Empty) 89 builder.Append(", " + initialValue); 90 builder.Append("));" + Environment.NewLine); 91 } 92 return builder.ToString(); 93 } 94 95 #region Button Event Handlers 93 96 private void removeButton_Click(object sender, EventArgs e) { 94 97 if (parametersListView.SelectedIndices.Count > 0) { … … 142 145 item.SubItems.Add("IItem"); 143 146 item.SubItems.Add("Add a description."); 144 item.SubItems.Add(" ");147 item.SubItems.Add("null"); 145 148 parametersListView.Items.Add(item); 149 } 150 #endregion 151 152 private void parametersListView_MouseDoubleClick(object sender, MouseEventArgs e) { 153 var hit = parametersListView.HitTest(e.Location); 154 if (hit.Item.SubItems[typeColumnHeader.DisplayIndex] == hit.SubItem) { 155 parameterTypeComboBox.Left = parametersListView.Left + hit.SubItem.Bounds.Left + 3; 156 parameterTypeComboBox.Top = parametersListView.Top + hit.SubItem.Bounds.Top; 157 parameterTypeComboBox.Width = hit.SubItem.Bounds.Width; 158 parameterTypeComboBox.Height = hit.SubItem.Bounds.Height; 159 parameterTypeComboBox.Text = hit.SubItem.Text; 160 parameterTypeComboBox.Tag = hit.SubItem; 161 parameterTypeComboBox.Visible = true; 162 parameterTypeComboBox.BringToFront(); 163 Refresh(); 164 parameterTypeComboBox.Focus(); 165 parameterTypeComboBox.SelectAll(); 166 } else { 167 customInputTextBox.Left = parametersListView.Left + hit.SubItem.Bounds.Left + 3; 168 customInputTextBox.Top = parametersListView.Top + hit.SubItem.Bounds.Top; 169 if (hit.SubItem != hit.Item.SubItems[0]) 170 customInputTextBox.Width = hit.SubItem.Bounds.Width; 171 else customInputTextBox.Width = hit.Item.SubItems[1].Bounds.Left; 172 customInputTextBox.Height = hit.SubItem.Bounds.Height; 173 customInputTextBox.Text = hit.SubItem.Text; 174 customInputTextBox.Tag = hit.SubItem; 175 customInputTextBox.Visible = true; 176 customInputTextBox.BringToFront(); 177 Refresh(); 178 customInputTextBox.Focus(); 179 customInputTextBox.SelectAll(); 180 } 181 } 182 183 private void parametersListView_SelectedIndexChanged(object sender, EventArgs e) { 184 if (parametersListView.SelectedIndices.Count > 0) { 185 removeButton.Enabled = true; 186 upButton.Enabled = true; 187 downButton.Enabled = true; 188 } else { 189 removeButton.Enabled = false; 190 upButton.Enabled = false; 191 downButton.Enabled = false; 192 } 193 } 194 195 private void customInputTextBox_Leave(object sender, EventArgs e) { 196 TextBox t = (TextBox)sender; 197 System.Windows.Forms.ListViewItem.ListViewSubItem subItem = t.Tag as System.Windows.Forms.ListViewItem.ListViewSubItem; 198 subItem.Text = t.Text; 199 t.Visible = false; 200 } 201 202 private void customInputTextBox_KeyUp(object sender, KeyEventArgs e) { 203 if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Enter) 204 customInputTextBox_Leave(sender, EventArgs.Empty); 205 } 206 207 private void parameterTypeComboBox_Leave(object sender, EventArgs e) { 208 ComboBox c = (ComboBox)sender; 209 System.Windows.Forms.ListViewItem.ListViewSubItem subItem = c.Tag as System.Windows.Forms.ListViewItem.ListViewSubItem; 210 subItem.Text = c.Text; 211 c.Visible = false; 212 } 213 214 private void parameterTypeComboBox_SelectedIndexChanged(object sender, EventArgs e) { 215 if (parameterTypeComboBox.Visible) 216 parameterTypeComboBox_Leave(sender, e); 217 } 218 219 private void parameterTypeComboBox_KeyUp(object sender, KeyEventArgs e) { 220 if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Enter) 221 parameterTypeComboBox_Leave(sender, EventArgs.Empty); 146 222 } 147 223 } -
trunk/tools/Templates/HeuristicLab.VS2010Wizards/ParametersControl.resx
r4181 r4187 113 113 </resheader> 114 114 <resheader name="reader"> 115 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version= 2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>115 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 116 116 </resheader> 117 117 <resheader name="writer"> 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version= 2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </resheader> 120 120 </root> -
trunk/tools/Templates/HeuristicLabAlgorithmTemplate/DefaultAlgorithm.cs
r4176 r4187 46 46 47 47 #region Parameter Properties 48 private ValueParameter<IntValue> SeedParameter { 49 get { return (ValueParameter<IntValue>)Parameters["Seed"]; } 50 } 51 private ValueParameter<BoolValue> SetSeedRandomlyParameter { 52 get { return (ValueParameter<BoolValue>)Parameters["SetSeedRandomly"]; } 53 } 54 private ValueParameter<MultiAnalyzer> AnalyzerParameter { 55 get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; } 56 } 48 $parameterProperties$ 57 49 #endregion 58 50 59 51 #region Properties 60 public IntValue Seed { 61 get { return SeedParameter.Value; } 62 set { SeedParameter.Value = value; } 63 } 64 public BoolValue SetSeedRandomly { 65 get { return SetSeedRandomlyParameter.Value; } 66 set { SetSeedRandomlyParameter.Value = value; } 67 } 68 public MultiAnalyzer Analyzer { 69 get { return AnalyzerParameter.Value; } 70 set { AnalyzerParameter.Value = value; } 52 $properties$ 53 private RandomCreator RandomCreator { 54 get { return (RandomCreator)OperatorGraph.InitialOperator; } 71 55 } 72 56 #endregion … … 76 60 public $safeitemname$() 77 61 : base() { 78 Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0))); 79 Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true))); 80 Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each iteration.", new MultiAnalyzer())); 62 $parameterInitializers$ 81 63 82 // TODO: Create and assign OperatorGraph.InitialOperator 64 RandomCreator randomCreator = new RandomCreator(); 65 OperatorGraph.InitialOperator = randomCreator; 83 66 84 // TODO: Build operator graph 67 randomCreator.RandomParameter.ActualName = "Random"; 68 randomCreator.SeedParameter.ActualName = SeedParameter.Name; 69 randomCreator.SeedParameter.Value = null; 70 randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name; 71 randomCreator.SetSeedRandomlyParameter.Value = null; 72 randomCreator.Successor = null; // TODO: 73 74 // TODO: Create further operators and build operator graph 85 75 76 UpdateAnalyzers(); 86 77 AttachEventHandlers(); 87 78 } … … 101 92 protected override void OnProblemChanged() { 102 93 // TODO: Initialize and parameterize operators 94 UpdateAnalyzers(); 103 95 base.OnProblemChanged(); 104 96 } … … 114 106 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { 115 107 // TODO: Parameterize operators 108 UpdateAnalyzers(); 116 109 base.Problem_OperatorsChanged(sender, e); 117 110 }
Note: See TracChangeset
for help on using the changeset viewer.