Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4153


Ignore:
Timestamp:
08/04/10 17:11:42 (14 years ago)
Author:
mkommend
Message:

chained storable ctors for constraints (ticket #1129)

Location:
trunk/sources/HeuristicLab.Core/3.3/Constraints
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.3/Constraints/ComparisonConstraint.cs

    r4068 r4153  
    2828  [Item("ComparisonConstraint", "A constraint which checks for specified compare operation.")]
    2929  public class ComparisonConstraint : Constraint {
    30     public ComparisonConstraint()
    31       : base() {
    32     }
    3330    [StorableConstructor]
    34     protected ComparisonConstraint(bool deserializing) {
    35     }
     31    protected ComparisonConstraint(bool deserializing) : base(deserializing) { }
     32
     33    public ComparisonConstraint() : base() { }
    3634    public ComparisonConstraint(IItem constrainedValue, ConstraintOperation comparisonOperation, object comparisonValue)
    3735      : base(constrainedValue, comparisonOperation, comparisonValue) {
  • trunk/sources/HeuristicLab.Core/3.3/Constraints/Constraint.cs

    r4068 r4153  
    2929  [StorableClass]
    3030  public abstract class Constraint : Item, IConstraint {
     31    [StorableConstructor]
     32    protected Constraint(bool deserializing) : base(deserializing) { }
     33
    3134    protected Constraint() {
    3235      this.Active = false;
    3336      if (AllowedConstraintOperations != null && AllowedConstraintOperations.Count() != 0)
    3437        this.ConstraintOperation = AllowedConstraintOperations.ElementAt(0);
    35     }
    36     [StorableConstructor]
    37     protected Constraint(bool deserializing) {
    3838    }
    3939    protected Constraint(IItem constrainedValue, ConstraintOperation constraintOperation, object constraintData)
     
    115115      return this.constrainedValue;
    116116    }
     117    protected abstract bool Check(object constrainedMember);
     118    protected abstract bool Check(object constrainedMember, out string errorMessage);
     119
    117120    public bool Check() {
    118121      if (!Active)
     
    122125      return this.Check(constrainedMember);
    123126    }
    124     protected abstract bool Check(object constrainedMember);
    125 
    126127    public bool Check(out string errorMessage) {
    127128      errorMessage = string.Empty;
     
    132133      return this.Check(constrainedMember, out errorMessage);
    133134    }
    134 
    135     protected abstract bool Check(object constrainedMember, out string errorMessage);
    136135
    137136    #region events
  • trunk/sources/HeuristicLab.Core/3.3/Constraints/ConstraintOperation.cs

    r4068 r4153  
    3939
    4040    [StorableConstructor]
    41     protected ConstraintOperation(bool deserializing) {
    42     }
     41    protected ConstraintOperation(bool deserializing) { }
    4342    protected ConstraintOperation(int value, string name) {
    4443      this.value = value;
  • trunk/sources/HeuristicLab.Core/3.3/Constraints/EqualityConstraint.cs

    r4068 r4153  
    2828  [Item("EqualityConstraint", "A constraint which checks for equality.")]
    2929  public class EqualityConstraint : Constraint {
    30     public EqualityConstraint()
    31       : base() {
    32     }
    3330    [StorableConstructor]
    34     protected EqualityConstraint(bool deserializing) {
    35     }
     31    protected EqualityConstraint(bool deserializing) : base(deserializing) { }
     32
     33    public EqualityConstraint() : base() { }
    3634    public EqualityConstraint(IItem constrainedValue, ConstraintOperation constraintOperation, object constraintData)
    3735      : base(constrainedValue, constraintOperation, constraintData) {
  • trunk/sources/HeuristicLab.Core/3.3/Constraints/TypeCompatibilityConstraint.cs

    r4068 r4153  
    3131    }
    3232    [StorableConstructor]
    33     protected TypeCompatibilityConstraint(bool deserializing)
    34       : base() {
    35     }
     33    protected TypeCompatibilityConstraint(bool deserializing) : base(deserializing) { }
    3634    public TypeCompatibilityConstraint(IItem constrainedValue, ConstraintOperation constraintOperation, Type constraintData)
    3735      : base(constrainedValue, constraintOperation, constraintData) {
Note: See TracChangeset for help on using the changeset viewer.