Changeset 3598
- Timestamp:
- 05/03/10 17:43:58 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Data/3.3/Constraints
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Data/3.3/Constraints/ComparisonConstraint.cs
r3592 r3598 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 28 29 namespace HeuristicLab.Data .Constraints{29 namespace HeuristicLab.Data { 30 30 [StorableClass] 31 31 [Item("ComparisonConstraint", "A constraint which checks for specified compare operation.")] … … 39 39 } 40 40 41 public ComparisonConstraint(IItem constrainedValue) 42 : base(constrainedValue) { 41 public ComparisonConstraint(IItem constrainedValue, ComparisonOperation comparisonOperation, object comparisonValue) 42 : base() { 43 this.ConstrainedValue = constrainedValue; 44 this.ComparisonOperation = comparisonOperation; 45 this.ComparisonValue = comparisonValue; 43 46 } 44 47 -
trunk/sources/HeuristicLab.Data/3.3/Constraints/ComparisonOperation.cs
r3592 r3598 22 22 using System.Collections.Generic; 23 23 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 24 [StorableClass] 25 public sealed class ComparisonOperation { 26 public static readonly ComparisonOperation Equal = new ComparisonOperation(0, "Equal"); 27 public static readonly ComparisonOperation NotEqual = new ComparisonOperation(1, "Not equal"); 28 public static readonly ComparisonOperation Lesser = new ComparisonOperation(2, "Lesser"); 29 public static readonly ComparisonOperation LesserOrEqual = new ComparisonOperation(3, "Lesser or equal"); 30 public static readonly ComparisonOperation Greater = new ComparisonOperation(4, "Greater"); 31 public static readonly ComparisonOperation GreaterOrEqual = new ComparisonOperation(5, "Greater or equal"); 32 public static readonly ComparisonOperation IsTypeOf = new ComparisonOperation(6, "Is type of"); 33 public static readonly ComparisonOperation IsNotTypeOf = new ComparisonOperation(7, "Is not type of"); 24 namespace HeuristicLab.Data { 25 [StorableClass] 26 public sealed class ComparisonOperation { 27 public static readonly ComparisonOperation Equal = new ComparisonOperation(0, "Equal"); 28 public static readonly ComparisonOperation NotEqual = new ComparisonOperation(1, "Not equal"); 29 public static readonly ComparisonOperation Lesser = new ComparisonOperation(2, "Lesser"); 30 public static readonly ComparisonOperation LesserOrEqual = new ComparisonOperation(3, "Lesser or equal"); 31 public static readonly ComparisonOperation Greater = new ComparisonOperation(4, "Greater"); 32 public static readonly ComparisonOperation GreaterOrEqual = new ComparisonOperation(5, "Greater or equal"); 33 public static readonly ComparisonOperation IsTypeOf = new ComparisonOperation(6, "Is type of"); 34 public static readonly ComparisonOperation IsNotTypeOf = new ComparisonOperation(7, "Is not type of"); 34 35 35 [Storable]36 private int value;37 [Storable]38 private string name;39 [StorableConstructor]40 private ComparisonOperation() {41 value = -1;42 name = "empty";43 }44 private ComparisonOperation(int value, string name) {45 this.value = value;46 this.name = name;47 }36 [Storable] 37 private int value; 38 [Storable] 39 private string name; 40 [StorableConstructor] 41 private ComparisonOperation() { 42 value = -1; 43 name = "empty"; 44 } 45 private ComparisonOperation(int value, string name) { 46 this.value = value; 47 this.name = name; 48 } 48 49 49 public override string ToString() {50 return name;51 }50 public override string ToString() { 51 return name; 52 } 52 53 53 public override bool Equals(object obj) {54 if (obj is ComparisonOperation)55 return this == (ComparisonOperation)obj;54 public override bool Equals(object obj) { 55 if (obj is ComparisonOperation) 56 return this == (ComparisonOperation)obj; 56 57 57 return false; 58 } 59 public override int GetHashCode() { 60 return value; 61 } 62 public static bool operator ==(ComparisonOperation co1, ComparisonOperation co2) { 63 return co1.value == co2.value; 64 } 65 public static bool operator !=(ComparisonOperation co1, ComparisonOperation co2) { 66 return !(co1 == co2); 58 return false; 59 } 60 public override int GetHashCode() { 61 return value; 62 } 63 public static bool operator ==(ComparisonOperation co1, ComparisonOperation co2) { 64 return co1.value == co2.value; 65 } 66 public static bool operator !=(ComparisonOperation co1, ComparisonOperation co2) { 67 return !(co1 == co2); 68 } 67 69 } 68 70 } -
trunk/sources/HeuristicLab.Data/3.3/Constraints/Constraint.cs
r3592 r3598 28 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 29 30 namespace HeuristicLab.Data .Constraints{30 namespace HeuristicLab.Data { 31 31 [StorableClass] 32 32 public abstract class Constraint : Item, IConstraint { … … 39 39 } 40 40 41 public Constraint(IItem constrainedValue )41 public Constraint(IItem constrainedValue,ComparisonOperation comparisonOperation, object comparisonValue) 42 42 : this() { 43 43 this.ConstrainedValue = constrainedValue; 44 this.ComparisonOperation = comparisonOperation; 45 this.ComparisonValue = comparisonValue; 44 46 } 45 47 -
trunk/sources/HeuristicLab.Data/3.3/Constraints/EqualityConstraint.cs
r3592 r3598 28 28 using HeuristicLab.Common; 29 29 30 namespace HeuristicLab.Data .Constraints{30 namespace HeuristicLab.Data { 31 31 [StorableClass] 32 32 [Item("EqualityConstraint", "A constraint which checks for equality")] … … 40 40 } 41 41 42 public EqualityConstraint(IItem constrainedValue) 43 : base(constrainedValue) { 42 public EqualityConstraint(IItem constrainedValue, ComparisonOperation comparisonOperation, object compareValue) 43 : base() { 44 this.ConstrainedValue = constrainedValue; 45 this.ComparisonOperation = comparisonOperation; 46 this.ComparisonValue = ComparisonValue; 44 47 } 45 48 -
trunk/sources/HeuristicLab.Data/3.3/Constraints/IConstraint.cs
r3592 r3598 26 26 using HeuristicLab.Core; 27 27 28 namespace HeuristicLab.Data .Constraints{28 namespace HeuristicLab.Data { 29 29 public interface IConstraint: IItem{ 30 30 bool Active { get; set; } -
trunk/sources/HeuristicLab.Data/3.3/Constraints/TypeConstraint.cs
r3592 r3598 27 27 using HeuristicLab.Core; 28 28 29 namespace HeuristicLab.Data .Constraints{29 namespace HeuristicLab.Data { 30 30 [StorableClass] 31 31 [Item("TypeConstraint", "A constraint which checks the types for specified compare operation.")] … … 39 39 } 40 40 41 public TypeConstraint(IItem constrainedValue) 42 : base(constrainedValue) { 41 public TypeConstraint(IItem constrainedValue, ComparisonOperation comparisonOperation, Type comparisonValue) 42 : base() { 43 this.ConstrainedValue = constrainedValue; 44 this.ComparisonOperation = comparisonOperation; 45 this.ComparisonValue = comparisonValue; 43 46 } 44 47
Note: See TracChangeset
for help on using the changeset viewer.