Changeset 9392 for branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Variable
- Timestamp:
- 04/23/13 13:31:29 (12 years ago)
- Location:
- branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Variable
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Variable/DoubleVariable.cs
r9242 r9392 130 130 var targetCast = target as DoubleVariable; 131 131 if (targetCast == null) { return false; } 132 if (variableName != targetCast.variableName || currentCenter.IsAlmost(targetCast.currentCenter)133 || currentSpread.IsAlmost(targetCast.currentSpread) ||max.IsAlmost(targetCast.max)134 || min.IsAlmost(targetCast.min)) { return false; }132 if (variableName != targetCast.variableName || !currentCenter.IsAlmost(targetCast.currentCenter) 133 || !currentSpread.IsAlmost(targetCast.currentSpread) || !max.IsAlmost(targetCast.max) 134 || !min.IsAlmost(targetCast.min)) { return false; } 135 135 136 136 return true; -
branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Variable/IntVariable.cs
r9242 r9392 133 133 || currentValue != targetCast.currentValue) { return false; } 134 134 135 if (possibleFeatures.Except(targetCast.possibleFeatures).Count() != 0 136 || targetCast.possibleFeatures.Except(possibleFeatures).Count() != 0) { return false; } 135 var thisEnumerator = possibleFeatures.GetEnumerator(); 136 var castEnumerator = targetCast.possibleFeatures.GetEnumerator(); 137 while (thisEnumerator.MoveNext() && castEnumerator.MoveNext()) { 138 if (thisEnumerator.Current != castEnumerator.Current) 139 return false; 140 } 137 141 138 return true;142 return !thisEnumerator.MoveNext() && !castEnumerator.MoveNext(); 139 143 } 140 144 -
branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Variable/StringVariable.cs
r9242 r9392 87 87 featureMapping = new Dictionary<int, string>(); 88 88 var distinctValuesEnumerator = variableValues.Distinct().GetEnumerator(); 89 possibleFeatures = Enumerable.Range(0, featureMapping.Count());89 possibleFeatures = Enumerable.Range(0, variableValues.Count()); 90 90 var possibleFeaturesEnumerator = possibleFeatures.GetEnumerator(); 91 91 while (possibleFeaturesEnumerator.MoveNext() && distinctValuesEnumerator.MoveNext()) { … … 178 178 || currentValue != targetCast.currentValue) { return false; } 179 179 180 if (featureMapping.Keys.Except(targetCast.featureMapping.Keys).Count() != 0 181 || targetCast.featureMapping.Keys.Except(featureMapping.Keys).Count() != 0) { return false; } 182 183 foreach (var keyValuePair in targetCast.featureMapping) { 184 if (!featureMapping[keyValuePair.Key].Equals(keyValuePair.Value)) { return false; } 185 } 186 187 return true; 180 var thisEnumerator = featureMapping.GetEnumerator(); 181 var castEnumerator = targetCast.featureMapping.GetEnumerator(); 182 while (thisEnumerator.MoveNext() && castEnumerator.MoveNext()) { 183 if (thisEnumerator.Current.Key != castEnumerator.Current.Key || 184 thisEnumerator.Current.Value != castEnumerator.Current.Value) 185 return false; 186 } 187 188 return !thisEnumerator.MoveNext() && !castEnumerator.MoveNext(); 188 189 } 189 190
Note: See TracChangeset
for help on using the changeset viewer.