In numeric bin index, count infinity values as errors
git-svn-id: http://google-refine.googlecode.com/svn/trunk@1700 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
8d422e2e54
commit
764558c48a
@ -185,8 +185,11 @@ abstract public class NumericBinIndex {
|
|||||||
_hasError = true;
|
_hasError = true;
|
||||||
} else if (ExpressionUtils.isNonBlankData(v)) {
|
} else if (ExpressionUtils.isNonBlankData(v)) {
|
||||||
if (v instanceof Number) {
|
if (v instanceof Number) {
|
||||||
|
if (processValue(((Number) v).doubleValue(), allValues)) {
|
||||||
_hasNumeric = true;
|
_hasNumeric = true;
|
||||||
processValue(((Number) v).doubleValue(), allValues);
|
} else {
|
||||||
|
_hasError = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
_hasNonNumeric = true;
|
_hasNonNumeric = true;
|
||||||
}
|
}
|
||||||
@ -202,8 +205,11 @@ abstract public class NumericBinIndex {
|
|||||||
_hasError = true;
|
_hasError = true;
|
||||||
} else if (ExpressionUtils.isNonBlankData(v)) {
|
} else if (ExpressionUtils.isNonBlankData(v)) {
|
||||||
if (v instanceof Number) {
|
if (v instanceof Number) {
|
||||||
|
if (processValue(((Number) v).doubleValue(), allValues)) {
|
||||||
_hasNumeric = true;
|
_hasNumeric = true;
|
||||||
processValue(((Number) v).doubleValue(), allValues);
|
} else {
|
||||||
|
_hasError = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
_hasNonNumeric = true;
|
_hasNonNumeric = true;
|
||||||
}
|
}
|
||||||
@ -215,8 +221,11 @@ abstract public class NumericBinIndex {
|
|||||||
_totalValueCount++;
|
_totalValueCount++;
|
||||||
|
|
||||||
if (value instanceof Number) {
|
if (value instanceof Number) {
|
||||||
|
if (processValue(((Number) value).doubleValue(), allValues)) {
|
||||||
_hasNumeric = true;
|
_hasNumeric = true;
|
||||||
processValue(((Number) value).doubleValue(), allValues);
|
} else {
|
||||||
|
_hasError = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
_hasNonNumeric = true;
|
_hasNonNumeric = true;
|
||||||
}
|
}
|
||||||
@ -248,11 +257,14 @@ abstract public class NumericBinIndex {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void processValue(double v, List<Double> allValues) {
|
protected boolean processValue(double v, List<Double> allValues) {
|
||||||
if (!Double.isInfinite(v) && !Double.isNaN(v)) {
|
if (!Double.isInfinite(v) && !Double.isNaN(v)) {
|
||||||
_min = Math.min(_min, v);
|
_min = Math.min(_min, v);
|
||||||
_max = Math.max(_max, v);
|
_max = Math.max(_max, v);
|
||||||
allValues.add(v);
|
allValues.add(v);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user