Changeset 3617


Ignore:
Timestamp:
05/05/10 01:53:45 (12 years ago)
Author:
mkommend
Message:

refactored cloning of constraints (ticket #996)

Location:
trunk/sources/HeuristicLab.Optimization/3.3
Files:
1 added
1 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj

    r3616 r3617  
    8787    <Compile Include="Algorithm.cs" />
    8888    <Compile Include="BatchRun.cs" />
     89    <Compile Include="RunCollectionConstraints\RunCollectionComparisonConstraint.cs" />
     90    <Compile Include="RunCollectionConstraints\RunCollectionConstraintCollection.cs" />
     91    <Compile Include="RunCollectionConstraints\RunCollectionTypeCompatiblityConstraint.cs" />
     92    <Compile Include="RunCollectionConstraints\RunCollectionEqualityConstraint.cs" />
    8993    <Compile Include="Interfaces\IAnalyzer.cs" />
    90     <Compile Include="RunCollectionComparisonConstraint.cs" />
    91     <Compile Include="RunCollectionConstraintCollection.cs" />
    92     <Compile Include="RunCollectionTypeCompatiblityConstraint.cs" />
    93     <Compile Include="RunCollectionEqualityConstraint.cs" />
    9494    <Compile Include="Interfaces\ISingleObjectiveReplacer.cs" />
    9595    <Compile Include="Interfaces\IMigrator.cs" />
  • trunk/sources/HeuristicLab.Optimization/3.3/RunCollectionConstraints/RunCollectionComparisonConstraint.cs

    r3614 r3617  
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2828using HeuristicLab.Data;
     29using HeuristicLab.Common;
    2930
    3031namespace HeuristicLab.Optimization {
     
    123124      return s;
    124125    }
     126
     127    public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) {
     128      RunCollectionComparisonConstraint clone = (RunCollectionComparisonConstraint)base.Clone(cloner);
     129      clone.ConstrainedValue = null;
     130
     131      IItem constraintDataItem = this.ConstraintData as IItem;
     132      ICloneable constraintDataCloneable = this.ConstraintData as ICloneable;
     133      if (constraintDataItem != null)
     134        clone.ConstraintData = (IStringConvertibleValue)cloner.Clone(constraintDataItem);
     135      else if (constraintDataCloneable != null)
     136        clone.ConstraintData = (IStringConvertibleValue)constraintDataCloneable.Clone();
     137      else
     138        clone.ConstraintData = this.ConstraintData;
     139
     140      clone.ConstraintOperation = this.ConstraintOperation;
     141      clone.constraintColumn = this.constraintColumn;
     142
     143      return clone;
     144    }
    125145  }
    126146}
  • trunk/sources/HeuristicLab.Optimization/3.3/RunCollectionConstraints/RunCollectionEqualityConstraint.cs

    r3614 r3617  
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2828using HeuristicLab.Data;
     29using HeuristicLab.Common;
    2930
    3031namespace HeuristicLab.Optimization {
     
    5253
    5354    public new string ConstraintData {
    54       get { return (string) base.ConstraintData;}
    55       set { base.ConstraintData = value;}
     55      get { return (string)base.ConstraintData; }
     56      set { base.ConstraintData = value; }
    5657    }
    5758
     
    121122      return s;
    122123    }
     124
     125    public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) {
     126      RunCollectionEqualityConstraint clone = (RunCollectionEqualityConstraint)base.Clone(cloner);
     127      clone.ConstrainedValue = null;
     128      clone.ConstraintData = this.ConstraintData;
     129      clone.ConstraintOperation = this.ConstraintOperation;
     130      clone.constraintColumn = this.constraintColumn;
     131
     132      return clone;
     133    }
    123134  }
    124135}
  • trunk/sources/HeuristicLab.Optimization/3.3/RunCollectionConstraints/RunCollectionTypeCompatiblityConstraint.cs

    r3614 r3617  
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2828using HeuristicLab.Data;
     29using HeuristicLab.Common;
    2930
    3031namespace HeuristicLab.Optimization {
     
    113114      return s;
    114115    }
     116
     117    public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) {
     118      RunCollectionTypeCompatibilityConstraint clone = (RunCollectionTypeCompatibilityConstraint)base.Clone(cloner);
     119      clone.ConstrainedValue = null;
     120      clone.ConstraintData = this.ConstraintData;
     121      clone.ConstraintOperation = this.ConstraintOperation;
     122      clone.constraintColumn = this.constraintColumn;
     123
     124      return clone;
     125    }
    115126  }
    116127}
Note: See TracChangeset for help on using the changeset viewer.