/** Replaces the dataset and checks that the data range is as expected. */ public void testReplaceDataset() { // create a dataset... Number[][] data = new Integer[][] { {new Integer(-30), new Integer(-20)}, {new Integer(-10), new Integer(10)}, {new Integer(20), new Integer(30)} }; CategoryDataset newData = DatasetUtilities.createCategoryDataset("S", "C", data); LocalListener l = new LocalListener(); this.chart.addChangeListener(l); this.chart.getCategoryPlot().setDataset(newData); assertEquals(true, l.flag); ValueAxis axis = this.chart.getCategoryPlot().getRangeAxis(); Range range = axis.getRange(); assertTrue( "Expecting the lower bound of the range to be around -30: " + range.getLowerBound(), range.getLowerBound() <= -30); assertTrue( "Expecting the upper bound of the range to be around 30: " + range.getUpperBound(), range.getUpperBound() >= 30); }
/** * Shifts the range by the specified amount. * * @param base the base range (<code>null</code> not permitted). * @param delta the shift amount. * @param allowZeroCrossing a flag that determines whether or not the bounds of the range are * allowed to cross zero after adjustment. * @return A new range. */ public static Range shift(Range base, double delta, boolean allowZeroCrossing) { ParamChecks.nullNotPermitted(base, "base"); if (allowZeroCrossing) { return new Range(base.getLowerBound() + delta, base.getUpperBound() + delta); } else { return new Range( shiftWithNoZeroCrossing(base.getLowerBound(), delta), shiftWithNoZeroCrossing(base.getUpperBound(), delta)); } }
/** * Combines two ranges. This method has a special handling for Double.NaN. * * @param range1 the first range (<code>null</code> permitted). * @param range2 the second range (<code>null</code> permitted). * @return A new range (possibly <code>null</code>). * @since 1.0.15 */ public static Range combineIgnoringNaN(Range range1, Range range2) { if (range1 == null) { return range2; } if (range2 == null) { return range1; } double l = min(range1.getLowerBound(), range2.getLowerBound()); double u = max(range1.getUpperBound(), range2.getUpperBound()); return new Range(l, u); }
/** * Returns a range that includes all the values in the specified <code>range</code> AND the * specified <code>value</code>. * * @param range the range (<code>null</code> permitted). * @param value the value that must be included. * @return A range. * @since 1.0.1 */ public static Range expandToInclude(Range range, double value) { if (range == null) { return new Range(value, value); } if (value < range.getLowerBound()) { return new Range(value, range.getUpperBound()); } else if (value > range.getUpperBound()) { return new Range(range.getLowerBound(), value); } else { return range; } }
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) { ParamChecks.nullNotPermitted(base, "base"); if (factor < 0) { throw new IllegalArgumentException("Negative 'factor' argument."); } return new Range(base.getLowerBound() * factor, base.getUpperBound() * factor); }
/** * Converts a coordinate in Java2D space to the corresponding data value, assuming that the axis * runs along one edge of the specified plotArea. * * @param java2DValue the coordinate in Java2D space. * @param plotArea the area in which the data is plotted. * @param edge the axis location. * @return The data value. */ @Override public double java2DToValue(double java2DValue, Rectangle2D plotArea, RectangleEdge edge) { Range range = getRange(); double axisMin = switchedLog10(range.getLowerBound()); double axisMax = switchedLog10(range.getUpperBound()); double plotMin = 0.0; double plotMax = 0.0; if (RectangleEdge.isTopOrBottom(edge)) { plotMin = plotArea.getX(); plotMax = plotArea.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { plotMin = plotArea.getMaxY(); plotMax = plotArea.getMinY(); } if (isInverted()) { return switchedPow10( axisMax - ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin)); } else { return switchedPow10( axisMin + ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin)); } }
/** * Converts a data value to a coordinate in Java2D space, assuming that the axis runs along one * edge of the specified plotArea. Note that it is possible for the coordinate to fall outside the * plotArea. * * @param value the data value. * @param plotArea the area for plotting the data. * @param edge the axis location. * @return The Java2D coordinate. */ @Override public double valueToJava2D(double value, Rectangle2D plotArea, RectangleEdge edge) { Range range = getRange(); double axisMin = switchedLog10(range.getLowerBound()); double axisMax = switchedLog10(range.getUpperBound()); double min = 0.0; double max = 0.0; if (RectangleEdge.isTopOrBottom(edge)) { min = plotArea.getMinX(); max = plotArea.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { min = plotArea.getMaxY(); max = plotArea.getMinY(); } value = switchedLog10(value); if (isInverted()) { return max - (((value - axisMin) / (axisMax - axisMin)) * (max - min)); } else { return min + (((value - axisMin) / (axisMax - axisMin)) * (max - min)); } }
/** Rescales the axis to ensure that all data is visible. */ @Override protected void autoAdjustRange() { Plot plot = getPlot(); if (plot == null) { return; // no plot, no data } if (plot instanceof ValueAxisPlot) { ValueAxisPlot vap = (ValueAxisPlot) plot; Range r = vap.getDataRange(this); if (r == null) { r = getDefaultAutoRange(); } long upper = Math.round(r.getUpperBound()); long lower = Math.round(r.getLowerBound()); this.first = createInstance( this.autoRangeTimePeriodClass, new Date(lower), this.timeZone, this.locale); this.last = createInstance( this.autoRangeTimePeriodClass, new Date(upper), this.timeZone, this.locale); setRange(r, false, false); } }
/** * 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); }
protected int calculateVisibleTickCount() { double unit = getTickUnit().getSize(); Range range = getRange(); return (int) ((Math.floor(range.getUpperBound() / unit) - Math.ceil(range.getLowerBound() / unit)) + NormalizedMatrixSeries.DEFAULT_SCALE_FACTOR); }
/** * Returns the minimum x-value in the dataset. * * @param includeInterval a flag that determines whether or not the x-interval is taken into * account. * @return The minimum value. */ public double getDomainLowerBound(boolean includeInterval) { double result = Double.NaN; Range r = getDomainBounds(includeInterval); if (r != null) { result = r.getLowerBound(); } return result; }
private void saveCurrentChart() { String fileName = new SimpleDateFormat("yyyyMMddhhmmssSS'.png'").format(new Date()); try { NumberAxis domain = (NumberAxis) this.timeseriesPlot.getDomainAxis(); Range domainRange = domain.getRange(); NumberAxis range = (NumberAxis) this.timeseriesPlot.getRangeAxis(); Range rangeRange = range.getRange(); String annotationString = "W:" + this.chartData.getSAXWindowSize() + ", P:" + this.chartData.getSAXPaaSize() + ", A:" + this.chartData.getSAXAlphabetSize(); XYTextAnnotation a = new XYTextAnnotation( annotationString, domainRange.getLowerBound() + domainRange.getLength() / 100, rangeRange.getLowerBound() + rangeRange.getLength() / 5 * 3.5); a.setTextAnchor(TextAnchor.BOTTOM_LEFT); a.setPaint(Color.RED); a.setOutlinePaint(Color.BLACK); a.setOutlineVisible(true); a.setFont(new java.awt.Font("SansSerif", java.awt.Font.BOLD, 14)); // XYPointerAnnotation a = new XYPointerAnnotation("Bam!", domainRange.getLowerBound() // + domainRange.getLength() / 10, rangeRange.getLowerBound() + rangeRange.getLength() / 5 // * 4, 5 * Math.PI / 8); this.timeseriesPlot.addAnnotation(a); // this.paintTheChart(); ChartUtilities.saveChartAsPNG(new File(fileName), this.chart, 1400, 425); } catch (IOException e) { e.printStackTrace(); } }
/** * Returns the lower and upper bounds (range) of the x-values in the specified dataset. * * @param dataset the dataset (<code>null</code> permitted). * @return The range (<code>null</code> if the dataset is <code>null</code> or empty). * @see #findRangeBounds(XYDataset) */ public Range findDomainBounds(XYDataset dataset) { if (dataset == null) { return null; } Range r = DatasetUtilities.findDomainBounds(dataset, false); if (r == null) { return null; } return new Range( r.getLowerBound() + this.xOffset, r.getUpperBound() + this.blockWidth + this.xOffset); }
/** * Creates a new range by adding margins to an existing range. * * @param range the range (<code>null</code> not permitted). * @param lowerMargin the lower margin (expressed as a percentage of the range length). * @param upperMargin the upper margin (expressed as a percentage of the range length). * @return The expanded range. */ public static Range expand(Range range, double lowerMargin, double upperMargin) { ParamChecks.nullNotPermitted(range, "range"); double length = range.getLength(); double lower = range.getLowerBound() - length * lowerMargin; double upper = range.getUpperBound() + length * upperMargin; if (lower > upper) { lower = lower / 2.0 + upper / 2.0; upper = lower; } return new Range(lower, upper); }
/** * Returns the range of values the renderer requires to display all the items from the specified * dataset. * * @param dataset the dataset (<code>null</code> permitted). * @return The range (<code>null</code> if the dataset is <code>null</code> or empty). */ public Range findRangeBounds(XYDataset dataset) { if (dataset == null) { return null; } Range r = DatasetUtilities.findRangeBounds(dataset, false); if (r == null) { return null; } double offset = 0; // TODO getSeriesShape(n).getBounds().height / 2; return new Range(r.getLowerBound() + offset, r.getUpperBound() + offset); }
/** A test for bug 3072674. */ @Test public void test3072674() { DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset(); dataset.add(1.0, Double.NaN, "R1", "C1"); assertEquals(1.0, dataset.getRangeLowerBound(true), EPSILON); assertEquals(1.0, dataset.getRangeUpperBound(true), EPSILON); Range r = dataset.getRangeBounds(true); assertEquals(1.0, r.getLowerBound(), EPSILON); assertEquals(1.0, r.getUpperBound(), EPSILON); }
/** * Sets the range for the axis, if requested, sends an {@link AxisChangeEvent} to all registered * listeners. As a side-effect, the auto-range flag is set to <code>false</code> (optional). * * @param range the range (<code>null</code> not permitted). * @param turnOffAutoRange a flag that controls whether or not the auto range is turned off. * @param notify a flag that controls whether or not listeners are notified. */ public void setRange(Range range, boolean turnOffAutoRange, boolean notify) { long upper = Math.round(range.getUpperBound()); long lower = Math.round(range.getLowerBound()); this.first = createInstance(this.autoRangeTimePeriodClass, new Date(lower), this.timeZone, this.locale); this.last = createInstance(this.autoRangeTimePeriodClass, new Date(upper), this.timeZone, this.locale); super.setRange( new Range(this.first.getFirstMillisecond(), this.last.getLastMillisecond() + 1.0), turnOffAutoRange, notify); }
/** * Returns the range of the values in the dataset's domain, including or excluding the interval * around each x-value as specified. * * @param includeInterval a flag that determines whether or not the x-interval should be taken * into account. * @return The range. */ @Override public Range getDomainBounds(boolean includeInterval) { // first get the range without the interval, then expand it for the // interval width Range range = DatasetUtilities.findDomainBounds(this.dataset, false); if (includeInterval && range != null) { double lowerAdj = getIntervalWidth() * getIntervalPositionFactor(); double upperAdj = getIntervalWidth() - lowerAdj; range = new Range(range.getLowerBound() - lowerAdj, range.getUpperBound() + upperAdj); } return range; }
/** * Returns the range of values the renderer requires to display all the items from the specified * dataset. * * @param dataset the dataset (<code>null</code> permitted). * @return The range (<code>null</code> if the dataset is <code>null</code> or empty). * @see #findDomainBounds(XYDataset) */ public Range findRangeBounds(XYDataset dataset) { if (dataset != null) { Range r = DatasetUtilities.findRangeBounds(dataset, false); if (r == null) { return null; } else { return new Range( r.getLowerBound() + this.yOffset, r.getUpperBound() + this.blockHeight + this.yOffset); } } else { return null; } }
/** Replaces the dataset and checks that it has changed as expected. */ public void testReplaceDataset() { // create a dataset... XYSeries series1 = new XYSeries("Series 1"); series1.add(10.0, 10.0); series1.add(20.0, 20.0); series1.add(30.0, 30.0); XYDataset dataset = new XYSeriesCollection(series1); LocalListener l = new LocalListener(); this.chart.addChangeListener(l); XYPlot plot = (XYPlot) this.chart.getPlot(); plot.setDataset(dataset); assertEquals(true, l.flag); ValueAxis axis = plot.getRangeAxis(); Range range = axis.getRange(); assertTrue( "Expecting the lower bound of the range to be around 10: " + range.getLowerBound(), range.getLowerBound() <= 10); assertTrue( "Expecting the upper bound of the range to be around 30: " + range.getUpperBound(), range.getUpperBound() >= 30); }
/** Returns a peak list with the top peaks defined by the parameter "threshold" */ PeakList getTopThresholdPeakList(int threshold) { PeakList selectedPeakList = (PeakList) peakListSelector.getSelectedItem(); if (selectedPeakList == null) return null; SimplePeakList newList = new SimplePeakList(selectedPeakList.getName(), selectedPeakList.getRawDataFiles()); Vector<PeakListRow> peakRows = new Vector<PeakListRow>(); Range<Double> mzRange = selectedPeakList.getRowsMZRange(); Range<Double> rtRange = selectedPeakList.getRowsRTRange(); PeakThresholdMode selectedPeakOption = (PeakThresholdMode) thresholdCombo.getSelectedItem(); if (selectedPeakOption == PeakThresholdMode.TOP_PEAKS_AREA) { XYPlot xyPlot = masterFrame.getPlot().getXYPlot(); org.jfree.data.Range yAxis = xyPlot.getRangeAxis().getRange(); org.jfree.data.Range xAxis = xyPlot.getDomainAxis().getRange(); rtRange = Range.closed(xAxis.getLowerBound(), xAxis.getUpperBound()); mzRange = Range.closed(yAxis.getLowerBound(), yAxis.getUpperBound()); } for (PeakListRow peakRow : selectedPeakList.getRows()) { if (mzRange.contains(peakRow.getAverageMZ()) && rtRange.contains(peakRow.getAverageRT())) { peakRows.add(peakRow); } } Collections.sort( peakRows, new PeakListRowSorter(SortingProperty.Intensity, SortingDirection.Descending)); if (threshold > peakRows.size()) threshold = peakRows.size(); for (int i = 0; i < threshold; i++) { newList.addRow(peakRows.elementAt(i)); } return newList; }
public double java2DToValue(double java2DValue, Rectangle2D area, RectangleEdge edge) { Range range = getRange(); double axisMin = range.getLowerBound(); double axisMax = range.getUpperBound(); double min = 0.0d; double max = 0.0d; if (RectangleEdge.isTopOrBottom(edge)) { min = area.getX(); max = area.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { min = area.getMaxY(); max = area.getY(); } if (isInverted()) { return axisMax - (((java2DValue - min) / (max - min)) * (axisMax - axisMin)); } return (((java2DValue - min) / (max - min)) * (axisMax - axisMin)) + axisMin; }
private void handleAxisRangeControlChanges( PropertyChangeEvent evt, AxisRangeControl axisRangeControl, ValueAxis valueAxis, Range computedAutoRange) { final String propertyName = evt.getPropertyName(); switch (propertyName) { case AxisRangeControl.PROPERTY_NAME_AUTO_MIN_MAX: if (axisRangeControl.isAutoMinMax()) { final double min = computedAutoRange.getLowerBound(); final double max = computedAutoRange.getUpperBound(); axisRangeControl.adjustComponents(min, max, 3); } break; case AxisRangeControl.PROPERTY_NAME_MIN: valueAxis.setLowerBound(axisRangeControl.getMin()); break; case AxisRangeControl.PROPERTY_NAME_MAX: valueAxis.setUpperBound(axisRangeControl.getMax()); break; } }
/** * Translates a value from data space to Java 2D space. * * @param value the data value. * @param dataArea the data area. * @param edge the edge. * @return The Java 2D value. */ public double valueToJava2D(double value, Rectangle2D dataArea, RectangleEdge edge) { Range range = getRange(); double vmin = range.getLowerBound(); double vmax = range.getUpperBound(); double vp = getCycleBound(); if ((value < vmin) || (value > vmax)) { return Double.NaN; } double jmin = 0.0; double jmax = 0.0; if (RectangleEdge.isTopOrBottom(edge)) { jmin = dataArea.getMinX(); jmax = dataArea.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { jmax = dataArea.getMinY(); jmin = dataArea.getMaxY(); } if (isInverted()) { if (value == vp) { return this.boundMappedToLastCycle ? jmin : jmax; } else if (value > vp) { return jmax - (value - vp) * (jmax - jmin) / this.period; } else { return jmin + (vp - value) * (jmax - jmin) / this.period; } } else { if (value == vp) { return this.boundMappedToLastCycle ? jmax : jmin; } else if (value >= vp) { return jmin + (value - vp) * (jmax - jmin) / this.period; } else { return jmax - (vp - value) * (jmax - jmin) / this.period; } } }
protected double estimateMaximumTickLabelWidth(Graphics2D g2, TickUnit unit) { RectangleInsets tickLabelInsets = getTickLabelInsets(); double result = tickLabelInsets.getLeft() + tickLabelInsets.getRight(); if (isVerticalTickLabels()) { FontRenderContext frc = g2.getFontRenderContext(); return result + ((double) getTickLabelFont().getLineMetrics("0", frc).getHeight()); } String lowerStr; String upperStr; FontMetrics fm = g2.getFontMetrics(getTickLabelFont()); Range range = getRange(); double lower = range.getLowerBound(); double upper = range.getUpperBound(); NumberFormat formatter = getNumberFormatOverride(); if (formatter != null) { lowerStr = formatter.format(lower); upperStr = formatter.format(upper); } else { lowerStr = unit.valueToString(lower); upperStr = unit.valueToString(upper); } return result + Math.max((double) fm.stringWidth(lowerStr), (double) fm.stringWidth(upperStr)); }
public static Image houghLineDetector(Image original, double epsilon, double threshold) { // Apply border detector Image borderImage = MaskUtils.applyMasks(original, MaskFactory.buildSobelMasks(), SynthetizationType.ABS); borderImage = ThresholdUtils.global(borderImage, Image.MAX_VAL / 2, 1); double D = Math.max(borderImage.getWidth(), borderImage.getHeight()); Range roRange = new Range(-Math.sqrt(2) * D, Math.sqrt(2) * D); Range thetaRange = new Range(-90, 90); int roSize = (int) (Math.abs(roRange.getLength())); int thetaSize = (int) (Math.abs(thetaRange.getLength())); int[][] A = new int[roSize][thetaSize]; // Step 3 for (int x = 0; x < borderImage.getWidth(); x++) { for (int y = 0; y < borderImage.getHeight(); y++) { if (isWhite(borderImage, x, y)) { // Iterates theta (j) from 1 to m for (int theta = 0; theta < thetaSize; theta++) { double thetaValue = thetaRange.getLowerBound() + theta; double thetaTerm = x * Math.cos(thetaValue * Math.PI / 180) - y * Math.sin(thetaValue * Math.PI / 180); // Iterates ro (i) from 1 to n for (int ro = 0; ro < roSize; ro++) { double roValue = roRange.getLowerBound() + ro; double total = roValue - thetaTerm; // If verifies the normal equation of the line, add // 1 to the acumulator // Step 4 if (Math.abs(total) < epsilon) { // The maximum values from this vector, gives // the most voted positions. A[ro][theta] += 1; } } } } } } // Step 5 Set<BucketForLines> allBuckets = new HashSet<BucketForLines>(); for (int ro = 0; ro < roSize; ro++) { for (int theta = 0; theta < thetaSize; theta++) { BucketForLines newBucket = new BucketForLines(ro, theta, A[ro][theta]); allBuckets.add(newBucket); } } // Generates a descending sorted list. List<BucketForLines> allBucketsAsList = new ArrayList<BucketForLines>(allBuckets); Collections.sort(allBucketsAsList); Image houghed = original.clone(); // Gets the max vote number int maxVotes = allBucketsAsList.get(0).votes; if (maxVotes > 1) { for (BucketForLines b : allBucketsAsList) { // Only for those with max votes if (b.votes < maxVotes * threshold) { break; } double roValue = roRange.getLowerBound() + b.ro; double thetaValue = thetaRange.getLowerBound() + b.theta; for (int x = 0; x < borderImage.getWidth(); x++) { for (int y = 0; y < borderImage.getHeight(); y++) { double thetaTerm = x * Math.cos(thetaValue * Math.PI / 180) - y * Math.sin(thetaValue * Math.PI / 180); double total = roValue - thetaTerm; // Step 6 if (Math.abs(total) < epsilon) { paintRed(houghed, x, y); } } } } } return houghed; }
public static Image houghCircleDetector( Image original, double epsilon, double threshold, int rMin, int rMax) { // Apply border detector Image borderImage = MaskUtils.applyMasks(original, MaskFactory.buildSobelMasks(), SynthetizationType.ABS); borderImage = ThresholdUtils.global(borderImage, Image.MAX_VAL / 2, 1); Range aRange = new Range(rMin, borderImage.getWidth() - rMin); Range bRange = new Range(rMin, borderImage.getHeight() - rMin); Range rRange = new Range(rMin, rMax); int aSize = (int) (Math.abs(aRange.getLength())); int bSize = (int) (Math.abs(bRange.getLength())); int rSize = (int) (Math.abs(rRange.getLength())); int[][][] A = new int[aSize][bSize][rSize]; for (int r = 0; r < rSize; r += 2) { double rValue = rRange.getLowerBound() + r; double rTerm = Math.pow(rValue, 2); for (int a = 0; a < aSize; a += 2) { double aValue = aRange.getLowerBound() + a; for (int b = 0; b < bSize; b += 2) { double bValue = bRange.getLowerBound() + b; for (int x = 0; x < borderImage.getWidth(); x += 2) { double aTerm = Math.pow(x - aValue, 2); for (int y = 0; y < borderImage.getHeight(); y += 2) { if (isWhite(borderImage, x, y)) { double bTerm = Math.pow(y - bValue, 2); double total = rTerm - aTerm - bTerm; if (Math.abs(total) < epsilon) { A[a][b][r] += 1; } } } } } } } System.out.println("Voted"); Set<BucketForCircles> allBuckets = new HashSet<BucketForCircles>(); for (int a = 0; a < aSize; a += 2) { for (int b = 0; b < bSize; b += 2) { for (int r = 0; r < rSize; r += 2) { if (A[a][b][r] > 0) { BucketForCircles newBucket = new BucketForCircles(a, b, r, A[a][b][r]); allBuckets.add(newBucket); } } } } Image houghed = original.clone(); if (allBuckets.isEmpty()) { System.out.println("Empty Buckets"); return houghed; } List<BucketForCircles> allBucketsAsList = new ArrayList<BucketForCircles>(allBuckets); Collections.sort(allBucketsAsList); int maxHits = allBucketsAsList.get(0).votes; System.out.println("maxHits:" + maxHits); if (maxHits > 2) for (BucketForCircles b : allBucketsAsList) { if (b.votes < maxHits * threshold) { break; } int aValue = rMin + b.a; int bValue = (int) bRange.getLowerBound() + b.b; int rValue = (int) rRange.getLowerBound() + b.r; System.out.println("Circle: (" + aValue + "," + bValue + "," + rValue + ")"); drawCircle(houghed, aValue, bValue, rValue); } return houghed; }
/** * 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 <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()); }