- Timestamp:
- 04/27/09 15:29:27 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Constraints/3.3/IsIntegerConstraint.cs
r1529 r1672 25 25 using HeuristicLab.Core; 26 26 using HeuristicLab.Data; 27 using HeuristicLab.Persistence.Default.Decomposers.Storable; 27 28 28 29 namespace HeuristicLab.Constraints { … … 30 31 /// Constraint that allows only integer values. 31 32 /// </summary> 32 public class IsIntegerConstraint : ConstraintBase{ 33 [EmptyStorableClass] 34 public class IsIntegerConstraint : ConstraintBase { 33 35 /// <inheritdoc select="summary"/> 34 36 public override string Description { … … 43 45 public override bool Check(IItem item) { 44 46 // ConstrainedIntData is always integer => just return true 45 if (item is ConstrainedIntData)47 if (item is ConstrainedIntData) 46 48 return true; 47 49 48 50 // if we have an item of ConstrainedDoubleData then we check if it is integer or not 49 if (item is ConstrainedDoubleData) {51 if (item is ConstrainedDoubleData) { 50 52 ConstrainedDoubleData d = (ConstrainedDoubleData)item; 51 if (d.Data == Math.Truncate(d.Data)) {53 if (d.Data == Math.Truncate(d.Data)) { 52 54 return true; 53 55 } else {
Note: See TracChangeset
for help on using the changeset viewer.