/** * Check that the equals() method can distinguish all fields. */ public void testEquals() { AxisSpace a1 = new AxisSpace(); AxisSpace a2 = new AxisSpace(); assertEquals(a1, a2); a1.setTop(1.11); assertFalse(a1.equals(a2)); a2.setTop(1.11); assertTrue(a1.equals(a2)); a1.setBottom(2.22); assertFalse(a1.equals(a2)); a2.setBottom(2.22); assertTrue(a1.equals(a2)); a1.setLeft(3.33); assertFalse(a1.equals(a2)); a2.setLeft(3.33); assertTrue(a1.equals(a2)); a1.setRight(4.44); assertFalse(a1.equals(a2)); a2.setRight(4.44); assertTrue(a1.equals(a2)); }
public XYPlot getRocPlot() { if (rocPlot == null) { NumberAxis xAxis = new NumberAxis(); xAxis.setAutoRange(false); xAxis.setRange(0,1); xAxis.setTickUnit(new NumberTickUnit(0.2)); xAxis.setLabel(_("False positive rate")); NumberAxis yAxis = new NumberAxis(); yAxis.setAutoRange(false); yAxis.setRange(0,1); yAxis.setTickUnit(new NumberTickUnit(0.2)); yAxis.setLabel(_("True positive rate")); rocPlot = new XYPlot(null, xAxis, yAxis, getPlotRenderer()); AxisSpace axisSpace = new AxisSpace(); axisSpace.setBottom(AXIS_SPACE_SIZE); axisSpace.setLeft(AXIS_SPACE_SIZE); rocPlot.setFixedDomainAxisSpace(axisSpace); rocPlot.setFixedRangeAxisSpace(axisSpace); } return rocPlot; }
/** * Sets the size (width or height, depending on the orientation of the plot) for the domain * axis of each subplot. * * @param space the space. */ protected void setFixedRangeAxisSpaceForSubplots(AxisSpace space) { Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { XYPlot plot = (XYPlot) iterator.next(); plot.setFixedRangeAxisSpace(space); } }
/** * Sets the size (width or height, depending on the orientation of the plot) for the domain * axis of each subplot. * * @param space the space. */ protected void setFixedDomainAxisSpaceForSubplots(AxisSpace space) { Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { CategoryPlot plot = (CategoryPlot) iterator.next(); plot.setFixedDomainAxisSpace(space); } }
/** * Sets the space (width or height, depending on the orientation of the plot) for the domain * axis of each subplot. * * @param space the space. */ protected void setFixedDomainAxisSpaceForSubplots(AxisSpace space) { Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { XYPlot plot = (XYPlot) iterator.next(); plot.setFixedDomainAxisSpace(space); } }
/** * Sets the size (width or height, depending on the orientation of the plot) for the range * axis of each subplot. * * @param space the space (<code>null</code> permitted). */ protected void setFixedRangeAxisSpaceForSubplots(AxisSpace space) { Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { CategoryPlot plot = (CategoryPlot) iterator.next(); plot.setFixedRangeAxisSpace(space); } }
/** * Calculates the space required for the axes. * * @param g2 the graphics device. * @param plotArea the plot area. * * @return The space required for the axes. */ protected AxisSpace calculateAxisSpace(Graphics2D g2, Rectangle2D plotArea) { AxisSpace space = new AxisSpace(); space = calculateRangeAxisSpace(g2, plotArea, space); space = calculateDomainAxisSpace(g2, plotArea, space); return space; }
/** * Two objects that are equal are required to return the same hashCode. */ public void testHashCode() { AxisSpace s1 = new AxisSpace(); AxisSpace s2 = new AxisSpace(); assertTrue(s1.equals(s2)); int h1 = s1.hashCode(); int h2 = s2.hashCode(); assertEquals(h1, h2); }
/** * Sets the size (width or height, depending on the orientation of the * plot) for the domain axis of each subplot. * * @param space the space. */ protected void setFixedRangeAxisSpaceForSubplots(AxisSpace space) { Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { XYPlot plot = (XYPlot) iterator.next(); plot.setFixedRangeAxisSpace(space); } }
/** * Sets the size (width or height, depending on the orientation of the * plot) for the domain axis of each subplot. * * @param space the space. */ protected void setFixedDomainAxisSpaceForSubplots(AxisSpace space) { Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { CategoryPlot plot = (CategoryPlot) iterator.next(); plot.setFixedDomainAxisSpace(space); } }
/** * Sets the space (width or height, depending on the orientation of the * plot) for the domain axis of each subplot. * * @param space the space. */ protected void setFixedDomainAxisSpaceForSubplots(AxisSpace space) { Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { XYPlot plot = (XYPlot) iterator.next(); plot.setFixedDomainAxisSpace(space); } }
/** * Sets the size (width or height, depending on the orientation of the * plot) for the range axis of each subplot. * * @param space the space (<code>null</code> permitted). */ protected void setFixedRangeAxisSpaceForSubplots(AxisSpace space) { Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { CategoryPlot plot = (CategoryPlot) iterator.next(); plot.setFixedRangeAxisSpace(space); } }
/** * Some more cloning checks. */ @Test public void testCloning2() { AxisSpace da1 = new AxisSpace(); AxisSpace ra1 = new AxisSpace(); CategoryPlot p1 = new CategoryPlot(); p1.setFixedDomainAxisSpace(da1); p1.setFixedRangeAxisSpace(ra1); CategoryPlot p2; try { p2 = (CategoryPlot) p1.clone(); } catch (CloneNotSupportedException e) { fail("Cloning failed."); return; } assertTrue(p1 != p2); assertTrue(p1.getClass() == p2.getClass()); assertTrue(p1.equals(p2)); da1.setBottom(99.0); assertFalse(p1.equals(p2)); p2.getFixedDomainAxisSpace().setBottom(99.0); assertTrue(p1.equals(p2)); ra1.setBottom(11.0); assertFalse(p1.equals(p2)); p2.getFixedRangeAxisSpace().setBottom(11.0); assertTrue(p1.equals(p2)); }
/** * Sets the fixed range axis space and sends a {@link PlotChangeEvent} to * all registered listeners. * * @param space the space (<code>null</code> permitted). */ @Override public void setFixedRangeAxisSpace(AxisSpace space) { super.setFixedRangeAxisSpace(space); setFixedRangeAxisSpaceForSubplots(space); fireChangeEvent(); }
/** * Sets the size (width or height, depending on the orientation of the * plot) for the domain axis of each subplot. * * @param space the space. */ protected void setFixedRangeAxisSpaceForSubplots(AxisSpace space) { Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { XYPlot plot = (XYPlot) iterator.next(); plot.setFixedRangeAxisSpace(space, false); } }
/** * Calculates the space required for all the axes in the plot. * * @param g2 the graphics device. * @param plotArea the plot area. * * @return The required space. */ protected AxisSpace calculateAxisSpace(Graphics2D g2, Rectangle2D plotArea) { AxisSpace space = new AxisSpace(); space = calculateRangeAxisSpace(g2, plotArea, space); Rectangle2D revPlotArea = space.shrink(plotArea, null); space = calculateDomainAxisSpace(g2, revPlotArea, space); return space; }
/** * Sets the size (width or height, depending on the orientation of the * plot) for the domain axis of each subplot. * * @param space the space. */ protected void setFixedDomainAxisSpaceForSubplots(AxisSpace space) { Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { CategoryPlot plot = (CategoryPlot) iterator.next(); plot.setFixedDomainAxisSpace(space, false); } }
/** * Sets the space (width or height, depending on the orientation of the * plot) for the domain axis of each subplot. * * @param space the space. */ protected void setFixedDomainAxisSpaceForSubplots(AxisSpace space) { Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { XYPlot plot = (XYPlot) iterator.next(); plot.setFixedDomainAxisSpace(space, false); } }
/** * Sets the size (width or height, depending on the orientation of the * plot) for the range axis of each subplot. * * @param space the space (<code>null</code> permitted). */ protected void setFixedRangeAxisSpaceForSubplots(AxisSpace space) { Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { CategoryPlot plot = (CategoryPlot) iterator.next(); plot.setFixedRangeAxisSpace(space, false); } }
/** * Sets the fixed range axis space and sends a {@link PlotChangeEvent} to * all registered listeners. * * @param space the space ({@code null} permitted). */ @Override public void setFixedRangeAxisSpace(AxisSpace space) { super.setFixedRangeAxisSpace(space); setFixedRangeAxisSpaceForSubplots(space); fireChangeEvent(); }
/** * Sets the size (width or height, depending on the orientation of the * plot) for the range axis of each subplot. * * @param space the space ({@code null} permitted). */ protected void setFixedRangeAxisSpaceForSubplots(AxisSpace space) { Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { CategoryPlot plot = (CategoryPlot) iterator.next(); plot.setFixedRangeAxisSpace(space, false); } }