List of usage examples for org.jfree.data.statistics SimpleHistogramBin SimpleHistogramBin
public SimpleHistogramBin(double lowerBound, double upperBound)
From source file:org.jfree.data.statistics.SimpleHistogramBinTest.java
/** * Some checks for the accepts() method. *//*from ww w.j av a 2 s .co m*/ @Test public void testAccepts() { SimpleHistogramBin bin1 = new SimpleHistogramBin(1.0, 2.0); assertFalse(bin1.accepts(0.0)); assertTrue(bin1.accepts(1.0)); assertTrue(bin1.accepts(1.5)); assertTrue(bin1.accepts(2.0)); assertFalse(bin1.accepts(2.1)); assertFalse(bin1.accepts(Double.NaN)); SimpleHistogramBin bin2 = new SimpleHistogramBin(1.0, 2.0, false, false); assertFalse(bin2.accepts(0.0)); assertFalse(bin2.accepts(1.0)); assertTrue(bin2.accepts(1.5)); assertFalse(bin2.accepts(2.0)); assertFalse(bin2.accepts(2.1)); assertFalse(bin2.accepts(Double.NaN)); }
From source file:org.jfree.data.statistics.SimpleHistogramDatasetTest.java
/** * Ensure that the equals() method can distinguish all fields. *//*from w w w . j av a 2s. c om*/ @Test public void testEquals() { SimpleHistogramDataset d1 = new SimpleHistogramDataset("Dataset 1"); SimpleHistogramDataset d2 = new SimpleHistogramDataset("Dataset 1"); assertTrue(d1.equals(d2)); d1.addBin(new SimpleHistogramBin(1.0, 2.0)); assertFalse(d1.equals(d2)); d2.addBin(new SimpleHistogramBin(1.0, 2.0)); assertTrue(d1.equals(d2)); }
From source file:org.jfree.data.statistics.SimpleHistogramBinTest.java
/** * Some checks for the overlapsWith() method. *//*from ww w. ja va 2 s . c o m*/ @Test public void testOverlapsWidth() { SimpleHistogramBin b1 = new SimpleHistogramBin(1.0, 2.0); SimpleHistogramBin b2 = new SimpleHistogramBin(2.0, 3.0); SimpleHistogramBin b3 = new SimpleHistogramBin(3.0, 4.0); SimpleHistogramBin b4 = new SimpleHistogramBin(0.0, 5.0); SimpleHistogramBin b5 = new SimpleHistogramBin(2.0, 3.0, false, true); SimpleHistogramBin b6 = new SimpleHistogramBin(2.0, 3.0, true, false); assertTrue(b1.overlapsWith(b2)); assertTrue(b2.overlapsWith(b1)); assertFalse(b1.overlapsWith(b3)); assertFalse(b3.overlapsWith(b1)); assertTrue(b1.overlapsWith(b4)); assertTrue(b4.overlapsWith(b1)); assertFalse(b1.overlapsWith(b5)); assertFalse(b5.overlapsWith(b1)); assertTrue(b1.overlapsWith(b6)); assertTrue(b6.overlapsWith(b1)); }
From source file:org.jfree.data.statistics.SimpleHistogramDatasetTest.java
/** * Some checks for the clone() method.//from w w w.jav a 2s. com */ @Test public void testCloning() throws CloneNotSupportedException { SimpleHistogramDataset d1 = new SimpleHistogramDataset("Dataset 1"); SimpleHistogramDataset d2 = (SimpleHistogramDataset) d1.clone(); assertTrue(d1 != d2); assertTrue(d1.getClass() == d2.getClass()); assertTrue(d1.equals(d2)); // check that clone is independent of the original d2.addBin(new SimpleHistogramBin(2.0, 3.0)); d2.addObservation(2.3); assertFalse(d1.equals(d2)); }
From source file:org.jfree.data.statistics.SimpleHistogramDatasetTest.java
/** * Some checks for the clearObservations() method. *///from w ww . j av a 2s . c om @Test public void testClearObservations() { SimpleHistogramDataset d1 = new SimpleHistogramDataset("D1"); d1.clearObservations(); assertEquals(0, d1.getItemCount(0)); d1.addBin(new SimpleHistogramBin(0.0, 1.0)); d1.addObservation(0.5); assertEquals(1.0, d1.getYValue(0, 0), EPSILON); }
From source file:org.jfree.data.statistics.SimpleHistogramBinTest.java
/** * Ensure that the equals() method can distinguish all fields. */// w w w . j av a 2 s .c o m @Test public void testEquals() { SimpleHistogramBin b1 = new SimpleHistogramBin(1.0, 2.0); SimpleHistogramBin b2 = new SimpleHistogramBin(1.0, 2.0); assertTrue(b1.equals(b2)); assertTrue(b2.equals(b1)); b1 = new SimpleHistogramBin(1.1, 2.0, true, true); assertFalse(b1.equals(b2)); b2 = new SimpleHistogramBin(1.1, 2.0, true, true); assertTrue(b1.equals(b2)); b1 = new SimpleHistogramBin(1.1, 2.2, true, true); assertFalse(b1.equals(b2)); b2 = new SimpleHistogramBin(1.1, 2.2, true, true); assertTrue(b1.equals(b2)); b1 = new SimpleHistogramBin(1.1, 2.2, false, true); assertFalse(b1.equals(b2)); b2 = new SimpleHistogramBin(1.1, 2.2, false, true); assertTrue(b1.equals(b2)); b1 = new SimpleHistogramBin(1.1, 2.2, false, false); assertFalse(b1.equals(b2)); b2 = new SimpleHistogramBin(1.1, 2.2, false, false); assertTrue(b1.equals(b2)); b1.setItemCount(99); assertFalse(b1.equals(b2)); b2.setItemCount(99); assertTrue(b1.equals(b2)); }
From source file:org.jfree.data.statistics.SimpleHistogramDatasetTest.java
/** * Some checks for the removeAllBins() method. *//*from www. j a v a2 s . c om*/ @Test public void testRemoveAllBins() { SimpleHistogramDataset d1 = new SimpleHistogramDataset("D1"); d1.addBin(new SimpleHistogramBin(0.0, 1.0)); d1.addObservation(0.5); d1.addBin(new SimpleHistogramBin(2.0, 3.0)); assertEquals(2, d1.getItemCount(0)); d1.removeAllBins(); assertEquals(0, d1.getItemCount(0)); }