Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/08/10 04:36:13 (14 years ago)
Author:
mkommend
Message:

sorting of column names in RunCollection and fixed errors in RunCollectionConstraints (ticket #970)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization/3.3/RunCollectionConstraints/RunCollectionComparisonConstraint.cs

    r3632 r3717  
    6161
    6262    [Storable]
    63     private int constraintColumn;
    64     public int ConstraintColumn {
     63    private string constraintColumn;
     64    public string ConstraintColumn {
    6565      get { return constraintColumn; }
    6666      set {
    67         if (value < 0 || value >= ((IStringConvertibleMatrix)ConstrainedValue).ColumnNames.Count())
     67        if (!((IStringConvertibleMatrix)ConstrainedValue).ColumnNames.Contains(value))
    6868          throw new ArgumentException("Could not set ConstraintData to not existing column index.");
    6969        if (constraintColumn != value) {
     
    8080      if (handler != null)
    8181        handler(this, EventArgs.Empty);
     82    }
     83
     84    protected override void OnConstrainedValueChanged() {
     85      base.OnConstrainedValueChanged();
     86      IStringConvertibleMatrix matrix = (IStringConvertibleMatrix)ConstrainedValue;
     87      if (constraintColumn == null && ConstrainedValue != null && matrix.Columns != 0)
     88        constraintColumn = matrix.ColumnNames.ElementAt(0);
    8289    }
    8390
     
    111118      IStringConvertibleMatrix matrix = ConstrainedValue;
    112119      if (matrix != null && matrix.ColumnNames.Count() != 0)
    113         s += matrix.ColumnNames.ElementAt(constraintColumn) + " ";
     120        s += constraintColumn + " ";
    114121      else
    115122        return "ComparisonConstraint";
Note: See TracChangeset for help on using the changeset viewer.