Refine search
/** * Constructs a new range that is based on another {@link Range}. The * other range does not have to be a {@link DateRange}. If it is not, the * upper and lower bounds are evaluated as milliseconds since midnight * GMT, 1-Jan-1970. * * @param other the other range ({@code null} not permitted). */ public DateRange(Range other) { this(other.getLowerBound(), other.getUpperBound()); }
/** * Constructs a new range that is based on another {@link Range}. The * other range does not have to be a {@link DateRange}. If it is not, the * upper and lower bounds are evaluated as milliseconds since midnight * GMT, 1-Jan-1970. * * @param other the other range (<code>null</code> not permitted). */ public DateRange(Range other) { this(other.getLowerBound(), other.getUpperBound()); }
/** * Returns the display length for the axis. * * @return The display length. */ private double getDisplayLength() { if (this.displayStart < this.displayEnd) { return (this.displayEnd - this.displayStart); } else { return (this.fixedRange.getUpperBound() - this.displayStart) + (this.displayEnd - this.fixedRange.getLowerBound()); } }
/** * Returns the display length for the axis. * * @return The display length. */ private double getDisplayLength() { if (this.displayStart < this.displayEnd) { return (this.displayEnd - this.displayStart); } else { return (this.fixedRange.getUpperBound() - this.displayStart) + (this.displayEnd - this.fixedRange.getLowerBound()); } }
private Range getNewRange(Range newBounds, Range currentBounds, Range plotBounds) { if (currentBounds == null) { currentBounds = newBounds; } else { if (plotBounds.getLowerBound() > 0 && newBounds.getLowerBound() < currentBounds.getLowerBound() || newBounds.getUpperBound() > currentBounds.getUpperBound()) { currentBounds = new Range(Math.min(currentBounds.getLowerBound(), newBounds.getLowerBound()), Math.max(currentBounds.getUpperBound(), newBounds.getUpperBound())); } } return currentBounds; }
private Range getNewRange(Range newBounds, Range currentBounds, Range plotBounds) { if (currentBounds == null) { currentBounds = newBounds; } else { if (plotBounds.getLowerBound() > 0 && newBounds.getLowerBound() < currentBounds.getLowerBound() || newBounds.getUpperBound() > currentBounds.getUpperBound()) { currentBounds = new Range(Math.min(currentBounds.getLowerBound(), newBounds.getLowerBound()), Math.max(currentBounds.getUpperBound(), newBounds.getUpperBound())); } } return currentBounds; }
/** * Returns {@code true} if the range intersects with the specified * range, and {@code false} otherwise. * * @param range another range ({@code null} not permitted). * * @return A boolean. * * @since 1.0.9 */ public boolean intersects(Range range) { return intersects(range.getLowerBound(), range.getUpperBound()); }
/** * Returns <code>true</code> if the range intersects with the specified * range, and <code>false</code> otherwise. * * @param range another range (<code>null</code> not permitted). * * @return A boolean. * * @since 1.0.9 */ public boolean intersects(Range range) { return intersects(range.getLowerBound(), range.getUpperBound()); }
/** * Sets a new axis range. The period is extended to fit the range size, if * necessary. * * @param range the range. * @param turnOffAutoRange switch off the auto range. * @param notify notify? * * @see org.jfree.chart.axis.ValueAxis#setRange(Range, boolean, boolean) */ @Override public void setRange(Range range, boolean turnOffAutoRange, boolean notify) { double size = range.getUpperBound() - range.getLowerBound(); if (size > this.period) { this.period = size; } super.setRange(range, turnOffAutoRange, notify); }
/** * Sets a new axis range. The period is extended to fit the range size, if * necessary. * * @param range the range. * @param turnOffAutoRange switch off the auto range. * @param notify notify? * * @see org.jfree.chart.axis.ValueAxis#setRange(Range, boolean, boolean) */ public void setRange(Range range, boolean turnOffAutoRange, boolean notify) { double size = range.getUpperBound() - range.getLowerBound(); if (size > this.period) { this.period = size; } super.setRange(range, turnOffAutoRange, notify); }
private Range trimToContentHeight(Range r) { if (r == null) { return null; } double lowerBound = 0.0; double upperBound = Double.POSITIVE_INFINITY; if (r.getLowerBound() > 0.0) { lowerBound = trimToContentHeight(r.getLowerBound()); } if (r.getUpperBound() < Double.POSITIVE_INFINITY) { upperBound = trimToContentHeight(r.getUpperBound()); } return new Range(lowerBound, upperBound); }
private Range getNewPlotBounds(Range bounds) { double range = bounds.getLength(); double delta = range * relativePlotInset; return new Range(Math.max(0, bounds.getLowerBound() - delta), bounds.getUpperBound() + delta); }
private Range trimToContentWidth(Range r) { if (r == null) { return null; } double lowerBound = 0.0; double upperBound = Double.POSITIVE_INFINITY; if (r.getLowerBound() > 0.0) { lowerBound = trimToContentWidth(r.getLowerBound()); } if (r.getUpperBound() < Double.POSITIVE_INFINITY) { upperBound = trimToContentWidth(r.getUpperBound()); } return new Range(lowerBound, upperBound); }
private Range getNewPlotBounds(Range bounds) { double range = bounds.getLength(); double delta = range * relativePlotInset; return new Range(Math.max(0, bounds.getLowerBound() - delta), bounds.getUpperBound() + delta); }
private Range trimToContentWidth(Range r) { if (r == null) { return null; } double lowerBound = 0.0; double upperBound = Double.POSITIVE_INFINITY; if (r.getLowerBound() > 0.0) { lowerBound = trimToContentWidth(r.getLowerBound()); } if (r.getUpperBound() < Double.POSITIVE_INFINITY) { upperBound = trimToContentWidth(r.getUpperBound()); } return new Range(lowerBound, upperBound); }
private Range trimToContentHeight(Range r) { if (r == null) { return null; } double lowerBound = 0.0; double upperBound = Double.POSITIVE_INFINITY; if (r.getLowerBound() > 0.0) { lowerBound = trimToContentHeight(r.getLowerBound()); } if (r.getUpperBound() < Double.POSITIVE_INFINITY) { upperBound = trimToContentHeight(r.getUpperBound()); } return new Range(lowerBound, upperBound); }
/** * Scales the range by the specified factor. * * @param base the base range (<code>null</code> not permitted). * @param factor the scaling factor (must be non-negative). * * @return A new range. * * @since 1.0.9 */ public static Range scale(Range base, double factor) { if (base == null) { throw new IllegalArgumentException("Null 'base' argument."); } if (factor < 0) { throw new IllegalArgumentException("Negative 'factor' argument."); } return new Range(base.getLowerBound() * factor, base.getUpperBound() * factor); }
/** * Calculates the number of visible ticks. * * @return The number of visible ticks on the axis. */ protected int calculateVisibleTickCount() { double unit = getTickUnit().getSize(); Range range = getRange(); return (int) (Math.floor(range.getUpperBound() / unit) - Math.ceil(range.getLowerBound() / unit) + 1); }
/** * Calculates the number of visible ticks. * * @return The number of visible ticks on the axis. */ protected int calculateVisibleTickCount() { double unit = getTickUnit().getSize(); Range range = getRange(); return (int) (Math.floor(range.getUpperBound() / unit) - Math.ceil(range.getLowerBound() / unit) + 1); }
/** * Scales the range by the specified factor. * * @param base the base range ({@code null} not permitted). * @param factor the scaling factor (must be non-negative). * * @return A new range. * * @since 1.0.9 */ public static Range scale(Range base, double factor) { Args.nullNotPermitted(base, "base"); if (factor < 0) { throw new IllegalArgumentException("Negative 'factor' argument."); } return new Range(base.getLowerBound() * factor, base.getUpperBound() * factor); }