Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2974


Ignore:
Timestamp:
03/09/10 03:57:18 (15 years ago)
Author:
swagner
Message:

Adapted Permutation and renamed IStringConvertibleArrayData.Rows to IStringConvertibleArrayData.Length (#899)

Location:
trunk/sources
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleArrayDataView.Designer.cs

    r2973 r2974  
    4646    private void InitializeComponent() {
    4747      this.components = new System.ComponentModel.Container();
    48       this.rowsLabel = new System.Windows.Forms.Label();
    49       this.rowsTextBox = new System.Windows.Forms.TextBox();
     48      this.lengthLabel = new System.Windows.Forms.Label();
     49      this.lengthTextBox = new System.Windows.Forms.TextBox();
    5050      this.dataGridView = new System.Windows.Forms.DataGridView();
    5151      this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
     
    5454      this.SuspendLayout();
    5555      //
    56       // rowsLabel
     56      // lengthLabel
    5757      //
    58       this.rowsLabel.AutoSize = true;
    59       this.rowsLabel.Location = new System.Drawing.Point(3, 3);
    60       this.rowsLabel.Name = "rowsLabel";
    61       this.rowsLabel.Size = new System.Drawing.Size(37, 13);
    62       this.rowsLabel.TabIndex = 0;
    63       this.rowsLabel.Text = "&Rows:";
     58      this.lengthLabel.AutoSize = true;
     59      this.lengthLabel.Location = new System.Drawing.Point(3, 3);
     60      this.lengthLabel.Name = "lengthLabel";
     61      this.lengthLabel.Size = new System.Drawing.Size(43, 13);
     62      this.lengthLabel.TabIndex = 0;
     63      this.lengthLabel.Text = "&Length:";
    6464      //
    65       // rowsTextBox
     65      // lengthTextBox
    6666      //
    67       this.rowsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     67      this.lengthTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    6868                  | System.Windows.Forms.AnchorStyles.Right)));
    69       this.rowsTextBox.Location = new System.Drawing.Point(69, 0);
    70       this.rowsTextBox.Name = "rowsTextBox";
    71       this.rowsTextBox.Size = new System.Drawing.Size(355, 20);
    72       this.rowsTextBox.TabIndex = 1;
    73       this.rowsTextBox.Validated += new System.EventHandler(this.rowsTextBox_Validated);
    74       this.rowsTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.rowsTextBox_KeyDown);
    75       this.rowsTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.rowsTextBox_Validating);
     69      this.lengthTextBox.Location = new System.Drawing.Point(52, 0);
     70      this.lengthTextBox.Name = "lengthTextBox";
     71      this.lengthTextBox.Size = new System.Drawing.Size(372, 20);
     72      this.lengthTextBox.TabIndex = 1;
     73      this.lengthTextBox.Validated += new System.EventHandler(this.lengthTextBox_Validated);
     74      this.lengthTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.lengthTextBox_KeyDown);
     75      this.lengthTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.lengthTextBox_Validating);
    7676      //
    7777      // dataGridView
     
    8888      this.dataGridView.Name = "dataGridView";
    8989      this.dataGridView.Size = new System.Drawing.Size(424, 378);
    90       this.dataGridView.TabIndex = 4;
     90      this.dataGridView.TabIndex = 2;
    9191      this.dataGridView.CellParsing += new System.Windows.Forms.DataGridViewCellParsingEventHandler(this.dataGridView_CellParsing);
    9292      this.dataGridView.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.dataGridView_CellValidating);
     
    103103      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    104104      this.Controls.Add(this.dataGridView);
    105       this.Controls.Add(this.rowsTextBox);
    106       this.Controls.Add(this.rowsLabel);
     105      this.Controls.Add(this.lengthTextBox);
     106      this.Controls.Add(this.lengthLabel);
    107107      this.Name = "StringConvertibleArrayDataView";
    108108      this.Size = new System.Drawing.Size(424, 404);
     
    116116    #endregion
    117117
    118     private System.Windows.Forms.Label rowsLabel;
    119     private System.Windows.Forms.TextBox rowsTextBox;
     118    private System.Windows.Forms.Label lengthLabel;
     119    private System.Windows.Forms.TextBox lengthTextBox;
    120120    private System.Windows.Forms.DataGridView dataGridView;
    121121    private System.Windows.Forms.ErrorProvider errorProvider;
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleArrayDataView.cs

    r2973 r2974  
    4040      InitializeComponent();
    4141      Caption = "StringConvertibleArrayData View";
    42       errorProvider.SetIconAlignment(rowsTextBox, ErrorIconAlignment.MiddleLeft);
    43       errorProvider.SetIconPadding(rowsTextBox, 2);
     42      errorProvider.SetIconAlignment(lengthTextBox, ErrorIconAlignment.MiddleLeft);
     43      errorProvider.SetIconPadding(lengthTextBox, 2);
    4444    }
    4545    public StringConvertibleArrayDataView(IStringConvertibleArrayData content)
     
    6565      if (Content == null) {
    6666        Caption = "StringConvertibleArrayData View";
    67         rowsTextBox.Text = "";
    68         rowsTextBox.Enabled = false;
     67        lengthTextBox.Text = "";
     68        lengthTextBox.Enabled = false;
    6969        dataGridView.Rows.Clear();
    7070        dataGridView.Columns.Clear();
     
    7777
    7878    private void UpdateData() {
    79       rowsTextBox.Text = Content.Rows.ToString();
    80       rowsTextBox.Enabled = true;
     79      lengthTextBox.Text = Content.Length.ToString();
     80      lengthTextBox.Enabled = true;
    8181      dataGridView.Rows.Clear();
    8282      dataGridView.Columns.Clear();
    83       if (Content.Rows > 0) {
     83      if (Content.Length > 0) {
    8484        dataGridView.ColumnCount++;
    8585        dataGridView.Columns[0].FillWeight = float.Epsilon;  // sum of all fill weights must not be larger than 65535
    86         dataGridView.RowCount = Content.Rows;
    87         for (int i = 0; i < Content.Rows; i++) {
     86        dataGridView.RowCount = Content.Length;
     87        for (int i = 0; i < Content.Length; i++) {
    8888          dataGridView.Rows[i].Cells[0].Value = Content.GetValue(i);
    8989        }
     
    110110
    111111    #region TextBox Events
    112     private void rowsTextBox_Validating(object sender, CancelEventArgs e) {
     112    private void lengthTextBox_Validating(object sender, CancelEventArgs e) {
    113113      int i = 0;
    114       if (!int.TryParse(rowsTextBox.Text, out i) || (i < 0)) {
     114      if (!int.TryParse(lengthTextBox.Text, out i) || (i < 0)) {
    115115        e.Cancel = true;
    116         errorProvider.SetError(rowsTextBox, "Invalid Number of Rows (Valid Values: Positive Integers Larger or Equal to 0)");
    117         rowsTextBox.SelectAll();
     116        errorProvider.SetError(lengthTextBox, "Invalid Array Length (Valid Values: Positive Integers Larger or Equal to 0)");
     117        lengthTextBox.SelectAll();
    118118      }
    119119    }
    120     private void rowsTextBox_Validated(object sender, EventArgs e) {
    121       Content.Rows = int.Parse(rowsTextBox.Text);
    122       errorProvider.SetError(rowsTextBox, string.Empty);
     120    private void lengthTextBox_Validated(object sender, EventArgs e) {
     121      Content.Length = int.Parse(lengthTextBox.Text);
     122      errorProvider.SetError(lengthTextBox, string.Empty);
    123123    }
    124     private void rowsTextBox_KeyDown(object sender, KeyEventArgs e) {
     124    private void lengthTextBox_KeyDown(object sender, KeyEventArgs e) {
    125125      if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return)
    126         rowsLabel.Focus();  // set focus on label to validate data
     126        lengthLabel.Focus();  // set focus on label to validate data
    127127      if (e.KeyCode == Keys.Escape) {
    128         rowsTextBox.Text = Content.Rows.ToString();
    129         rowsLabel.Focus();  // set focus on label to validate data
     128        lengthTextBox.Text = Content.Length.ToString();
     129        lengthLabel.Focus();  // set focus on label to validate data
    130130      }
    131131    }
  • trunk/sources/HeuristicLab.Data/3.3/BoolArrayData.cs

    r2973 r2974  
    4141
    4242    #region IStringConvertibleArrayData Members
    43     int IStringConvertibleArrayData.Rows {
     43    int IStringConvertibleArrayData.Length {
    4444      get { return Length; }
    4545      set { Length = value; }
  • trunk/sources/HeuristicLab.Data/3.3/DoubleArrayData.cs

    r2973 r2974  
    4141
    4242    #region IStringConvertibleArrayData Members
    43     int IStringConvertibleArrayData.Rows {
     43    int IStringConvertibleArrayData.Length {
    4444      get { return Length; }
    4545      set { Length = value; }
  • trunk/sources/HeuristicLab.Data/3.3/IStringConvertibleArrayData.cs

    r2973 r2974  
    2525namespace HeuristicLab.Data {
    2626  public interface IStringConvertibleArrayData {
    27     int Rows { get; set; }
     27    int Length { get; set; }
    2828
    2929    bool Validate(string value, out string errorMessage);
  • trunk/sources/HeuristicLab.Data/3.3/IntArrayData.cs

    r2973 r2974  
    4141
    4242    #region IStringConvertibleArrayData Members
    43     int IStringConvertibleArrayData.Rows {
     43    int IStringConvertibleArrayData.Length {
    4444      get { return Length; }
    4545      set { Length = value; }
  • trunk/sources/HeuristicLab.Data/3.3/StringArrayData.cs

    r2973 r2974  
    9797
    9898    #region IStringConvertibleArrayData Members
    99     int IStringConvertibleArrayData.Rows {
     99    int IStringConvertibleArrayData.Length {
    100100      get { return Length; }
    101101      set { Length = value; }
  • trunk/sources/HeuristicLab.Encodings.Permutation/3.3/Permutation.cs

    r2906 r2974  
    3131  [Item("Permutation", "Represents a permutation of integer values.")]
    3232  [Creatable("Test")]
    33   public sealed class Permutation : ValueTypeArrayData<int>, IStringConvertibleMatrixData {
     33  public sealed class Permutation : ValueTypeArrayData<int>, IStringConvertibleArrayData {
    3434    public Permutation() : base() { }
    3535    public Permutation(int length)
     
    8585    }
    8686
    87     #region IStringConvertibleMatrixData Members
    88     StringConvertibleArrayDataDimensions IStringConvertibleMatrixData.Dimensions {
    89       get { return StringConvertibleArrayDataDimensions.Rows; }
    90     }
    91     int IStringConvertibleMatrixData.Rows {
     87    #region IStringConvertibleArrayData Members
     88    int IStringConvertibleArrayData.Length {
    9289      get { return Length; }
    9390      set { Length = value; }
    9491    }
    95     int IStringConvertibleMatrixData.Columns {
    96       get { return 1; }
    97       set { throw new NotSupportedException("The number of columns cannot be changed."); }
    98     }
    9992
    100     bool IStringConvertibleMatrixData.Validate(string value, out string errorMessage) {
     93    bool IStringConvertibleArrayData.Validate(string value, out string errorMessage) {
    10194      int val;
    10295      bool valid = int.TryParse(value, out val);
     
    111104      return valid;
    112105    }
    113     string IStringConvertibleMatrixData.GetValue(int rowIndex, int columIndex) {
    114       return this[rowIndex].ToString();
     106    string IStringConvertibleArrayData.GetValue(int index) {
     107      return this[index].ToString();
    115108    }
    116     bool IStringConvertibleMatrixData.SetValue(string value, int rowIndex, int columnIndex) {
     109    bool IStringConvertibleArrayData.SetValue(string value, int index) {
    117110      int val;
    118111      if (int.TryParse(value, out val)) {
    119         this[rowIndex] = val;
     112        this[index] = val;
    120113        return true;
    121114      } else {
     
    123116      }
    124117    }
    125     event EventHandler<EventArgs<int, int>> IStringConvertibleMatrixData.ItemChanged {
    126       add { base.ItemChanged += value; }
    127       remove { base.ItemChanged -= value; }
    128     }
    129     event EventHandler IStringConvertibleMatrixData.Reset {
    130       add { base.Reset += value; }
    131       remove { base.Reset -= value; }
    132     }
    133118    #endregion
    134119  }
Note: See TracChangeset for help on using the changeset viewer.