diff --git a/src/studio/kdb/K.java b/src/studio/kdb/K.java index bc6eda7d..c1a23570 100755 --- a/src/studio/kdb/K.java +++ b/src/studio/kdb/K.java @@ -111,6 +111,16 @@ public double toDouble() { return value; } + @Override + public boolean isPositiveInfinity() { + return false; + } + + @Override + public boolean isNegativeInfinity() { + return false; + } + @Override protected void serialiseData(OutputStream o) throws IOException { write(o, value); @@ -153,6 +163,16 @@ public boolean isNull() { return value == Integer.MIN_VALUE; } + @Override + public boolean isPositiveInfinity() { + return value == Integer.MAX_VALUE; + } + + @Override + public boolean isNegativeInfinity() { + return value == -Integer.MAX_VALUE; + } + public double toDouble() { return value; } @@ -204,6 +224,16 @@ public double toDouble() { return value; } + @Override + public boolean isPositiveInfinity() { + return value == Long.MAX_VALUE; + } + + @Override + public boolean isNegativeInfinity() { + return value == -Long.MAX_VALUE; + } + public long toLong() { return value; } @@ -247,6 +277,16 @@ public double toDouble() { return value; } + @Override + public boolean isPositiveInfinity() { + return value == Double.POSITIVE_INFINITY; + } + + @Override + public boolean isNegativeInfinity() { + return value == Double.NEGATIVE_INFINITY; + } + @Override public void serialiseData(OutputStream o) throws IOException { long j = Double.doubleToLongBits(value); @@ -575,6 +615,16 @@ public double toDouble() { return b ? 1.0 : 0.0; } + @Override + public boolean isPositiveInfinity() { + return false; + } + + @Override + public boolean isNegativeInfinity() { + return false; + } + public boolean toBoolean() { return b; } @@ -634,6 +684,16 @@ public double toDouble() { return s; } + @Override + public boolean isPositiveInfinity() { + return s == Short.MAX_VALUE; + } + + @Override + public boolean isNegativeInfinity() { + return s == -Short.MAX_VALUE; + } + public KShort(short s) { super(-5); this.s = s; @@ -826,6 +886,16 @@ public double toDouble() { return f; } + @Override + public boolean isPositiveInfinity() { + return f == Float.POSITIVE_INFINITY; + } + + @Override + public boolean isNegativeInfinity() { + return f == Float.NEGATIVE_INFINITY; + } + public KFloat(float f) { super(-8); this.f = f; diff --git a/src/studio/kdb/ToDouble.java b/src/studio/kdb/ToDouble.java index 9de03589..fbe8f308 100755 --- a/src/studio/kdb/ToDouble.java +++ b/src/studio/kdb/ToDouble.java @@ -1,5 +1,12 @@ package studio.kdb; public interface ToDouble { - public double toDouble(); + + double toDouble(); + boolean isPositiveInfinity(); + boolean isNegativeInfinity(); + + default boolean isInfinity() { + return isPositiveInfinity() || isNegativeInfinity(); + } } diff --git a/src/studio/ui/chart/Chart.java b/src/studio/ui/chart/Chart.java index d35d7ab9..1f3e379d 100755 --- a/src/studio/ui/chart/Chart.java +++ b/src/studio/ui/chart/Chart.java @@ -307,9 +307,11 @@ private IntervalXYDataset getDateset(int col) { K.KBase yValue = (K.KBase)table.getValueAt(row, col); if (xValue.isNull() || yValue.isNull()) continue; - double x = ((ToDouble)xValue).toDouble(); - double y = ((ToDouble)yValue).toDouble(); - series.add(x, y); + ToDouble x = (ToDouble)xValue; + ToDouble y = (ToDouble)yValue; + if (x.isInfinity() || y.isInfinity()) continue; + + series.add(x.toDouble(), y.toDouble()); } collection.addSeries(series); return collection;