public Set<Statistic> getStats() { return sampleStats[0].getStatistics(); }
public Double value(int i, Statistic stat) { return sampleStats[i].getStatisticValue(stat); }
public Long count(int i) { return sampleStats[i].getNumAccepted(firstStat); }
for (int i = 0; i < size; i++) { final Range range = classificationRanges.get(i); final Class<? extends Number> rangeClass = range.getMin().getClass(); RangeFactory.convert( RangeFactory.create( range.getMin().doubleValue(), range.isMinIncluded(), range.getMax().doubleValue(), range.isMaxIncluded()), rangeType); rltBuilder.add(rangeJaiext, convert(reference, noDataClass));
public static RangeLookupTable getRangeLookupTable( List<Range> classificationRanges, final int[] outputPixelValues, final Number noDataValue, final Class<? extends Number> clazz) { final RangeLookupTable.Builder rltBuilder = new RangeLookupTable.Builder(); final int size = classificationRanges.size(); final boolean useCustomOutputPixelValues = outputPixelValues != null && outputPixelValues.length == size; Class<? extends Number> widestClass = noDataValue.getClass(); for (int i = 0; i < size; i++) { final Range range = classificationRanges.get(i); final Class<? extends Number> rangeClass = range.getMin().getClass(); if (widestClass != rangeClass) { widestClass = ClassChanger.getWidestClass(widestClass, rangeClass); } final int reference = useCustomOutputPixelValues ? outputPixelValues[i] : i + 1; rltBuilder.add(range, convert(reference, noDataValue.getClass())); } // Add the largest range that contains the no data value rltBuilder.add( new Range(getClassMinimum(widestClass), true, getClassMaximum(widestClass), true), noDataValue); return rltBuilder.build(); }
new Range<Double>(min, true, max, true); novalueRangeList = new ArrayList<Range<Double>>(); novalueRangeList.add(novalueRange);
for (int i = 0; i < rc.getSize(); i++) { ranges.add( Range.create( (Double) rc.getMin(i), true, i == rc.getSize() - 1)); StreamingSampleStats s = new StreamingSampleStats(Range.Type.INCLUDE); s.setStatistics(stats.toArray(new Statistic[stats.size()])); s.addNoDataValue(noData); sampleStats[slot].offer(dubVal);
/** * Tests if this range intersects another range. Two ranges intersect if * there is at least one value, x, for which contains(x) returns true * for both ranges * * @param other the range to check for intersection * @return {@code true} if the ranges intersect; {@code false} otherwise */ public boolean intersects(Range<T> other) { RangeExtendedComparator.Result comp = this.compareTo(other); return RangeExtendedComparator.isIntersection(comp); }
/** * Offers an array of sample values. * * @param samples the sample values */ public void offer(Double[] samples) { for (int i = 0; i < samples.length; i++) { offer(samples[i]); } }
ranges.add(Range.create(breaks[i], true, breaks[i + 1], i == breaks.length - 2));
/** * Return a new instance of class {@code clazz} taking its value from {@code number} * * @param number the number object whose value will be copied * @param clazz the class of the new instance * * @return a new instance of the request class with value {@code number} */ public static Number newInstance(Number number, Class<? extends Number> clazz) { ClassInfo ci = ClassInfo.get(clazz); return newInstance(number, ci, false); }
/** * Gets the bin index for a value. The value is not added to the histogram. * * @param value the value * * @return the bin index or {@link #NO_BIN} */ public int getBinForValue(T value) { ensureBinsSorted(); return findBin(value); }
/** * Offers a sample value. Offered values are filtered through excluded ranges. * {@code Double.NaNs} and {@code nulls} are excluded by default. * * @param sample the sample value */ public void offer(Double sample) { for (Processor p : processors) { p.offer(sample); } }
/** * {@inheritDoc} */ protected boolean update(Double sample) { if (isAccepted(sample)) { sum += sample; return true; } return false; }
/** * Tests if two {@code float} values are equal within the default tolerance. * This is equivalent to {@code dzero(x1 - x2)}. * * @param x1 first value * @param x2 second value * * @return {@code true} if equal; {@code false} otherwise */ public static boolean aequal(float x1, float x2) { return isZero(x1 - x2); }
/** * Creates a new element. * * @param image the image * @param outsideValue the outside value */ public Element(RenderedImage image, Number outsideValue) { this.image = image; this.outsideValue = NumberOperations.copy(outsideValue); }
} else { Range<Double> noData = new Range<Double>( catRange.getMinimum(), catRange.isMinIncluded(),
public Results(List<Range<Double>> ranges, StreamingSampleStats[] sampleStats) { this.ranges = ranges; this.sampleStats = sampleStats; this.firstStat = sampleStats[0].getStatistics().iterator().next(); }
/** * Cast the value from {@code number} to the class {@code clazz} * * @param number the number object whose value will be copied * @param clazz the class of the new instance * * @return a new instance of the request class with value {@code number} */ public static Number castNumber(Number number, Class<? extends Number> clazz) { ClassInfo ci = ClassInfo.get(clazz); return newInstance(number, ci, true); }
public void print() { for (int i = 0; i < size(); i++) { LOG.info(String.valueOf(range(i))); for (Statistic stat : sampleStats[0].getStatistics()) { LOG.info(stat + " = " + value(i, stat)); } } } }