@Test public void testNormalizeWithinBoundsRanges() { final double minRange = 10; final double maxRange = 100; final BinRange[] binRange = getNormalizedRanges(minRange, maxRange); Assert.assertEquals(minRange, binRange[0].getNormalizedMin(), DELTA); Assert.assertEquals(maxRange, binRange[0].getNormalizedMax(), DELTA); }
@Override public BinRange[] getNormalizedRanges(final NumericData range) { if (range == null) { return new BinRange[0]; } if (FloatCompareUtils.checkDoublesEqual(range.getMin(), range.getMax())) { return super.getNormalizedRanges(range); } final double normalizedMin = getNormalizedLongitude(range.getMin()); final double normalizedMax = getNormalizedLongitude(range.getMax()); if ((normalizedMax < normalizedMin) && !((FloatCompareUtils.checkDoublesEqual(normalizedMax, -1) && (FloatCompareUtils.checkDoublesEqual(normalizedMin, 0))))) { return new BinRange[] {new BinRange(-180, normalizedMax), new BinRange(normalizedMin, 180)}; } return new BinRange[] {new BinRange(normalizedMin, normalizedMax)}; }
LongitudeDefinition extends BasicDimensionDefinition { @Override public BinRange[] getNormalizedRanges(final NumericData range) { if (range == null) { return new BinRange[0]; } if (FloatCompareUtils.checkDoublesEqual(range.getMin(), range.getMax())) { return super.getNormalizedRanges(range); } final double normalizedMin = getNormalizedLongitude(range.getMin()); final double normalizedMax = getNormalizedLongitude(range.getMax()); if ((normalizedMax < normalizedMin) && !((FloatCompareUtils.checkDoublesEqual(normalizedMax, -1) && (FloatCompareUtils.checkDoublesEqual(normalizedMin, 0))))) { return new BinRange[] {new BinRange(-180, normalizedMax), new BinRange(normalizedMin, 180)}; } return new BinRange[] {new BinRange(normalizedMin, normalizedMax)}; } }
LongitudeDefinition extends BasicDimensionDefinition { @Override public BinRange[] getNormalizedRanges(final NumericData range) { if (range == null) { return new BinRange[0]; } if (FloatCompareUtils.checkDoublesEqual(range.getMin(), range.getMax())) { return super.getNormalizedRanges(range); } final double normalizedMin = getNormalizedLongitude(range.getMin()); final double normalizedMax = getNormalizedLongitude(range.getMax()); if ((normalizedMax < normalizedMin) && !((FloatCompareUtils.checkDoublesEqual(normalizedMax, -1) && (FloatCompareUtils.checkDoublesEqual(normalizedMin, 0))))) { return new BinRange[] {new BinRange(-180, normalizedMax), new BinRange(normalizedMin, 180)}; } return new BinRange[] {new BinRange(normalizedMin, normalizedMax)}; } LongitudeDefinition(); }
LongitudeDefinition extends BasicDimensionDefinition { @Override public BinRange[] getNormalizedRanges(final NumericData range) { if (range == null) { return new BinRange[0]; } if (FloatCompareUtils.checkDoublesEqual(range.getMin(), range.getMax())) { return super.getNormalizedRanges(range); } final double normalizedMin = getNormalizedLongitude(range.getMin()); final double normalizedMax = getNormalizedLongitude(range.getMax()); if ((normalizedMax < normalizedMin) && !((FloatCompareUtils.checkDoublesEqual(normalizedMax, -1) && (FloatCompareUtils.checkDoublesEqual(normalizedMin, 0))))) { return new BinRange[] {new BinRange(-180, normalizedMax), new BinRange(normalizedMin, 180)}; } return new BinRange[] {new BinRange(normalizedMin, normalizedMax)}; } LongitudeDefinition(); @Override BinRange[] getNormalizedRanges(final NumericData range); static double getNormalizedLongitude(final double lon); @Override byte[] toBinary(); @Override void fromBinary(final byte[] bytes); }
LongitudeDefinition extends BasicDimensionDefinition { @Override public BinRange[] getNormalizedRanges(final NumericData range) { if (range == null) { return new BinRange[0]; } if (FloatCompareUtils.checkDoublesEqual(range.getMin(), range.getMax())) { return super.getNormalizedRanges(range); } final double normalizedMin = getNormalizedLongitude(range.getMin()); final double normalizedMax = getNormalizedLongitude(range.getMax()); if ((normalizedMax < normalizedMin) && !((FloatCompareUtils.checkDoublesEqual(normalizedMax, -1) && (FloatCompareUtils.checkDoublesEqual(normalizedMin, 0))))) { return new BinRange[] {new BinRange(-180, normalizedMax), new BinRange(normalizedMin, 180)}; } return new BinRange[] {new BinRange(normalizedMin, normalizedMax)}; } LongitudeDefinition(); @Override BinRange[] getNormalizedRanges(final NumericData range); static double getNormalizedLongitude(final double lon); @Override byte[] toBinary(); @Override void fromBinary(final byte[] bytes);  }