Package org.jfree.data.general

Examples of org.jfree.data.general.DefaultHeatMapDataset


    /**
     * Some general tests.
     */
    public void testGeneral() {
        DefaultHeatMapDataset d = new DefaultHeatMapDataset(10, 5, 0.0, 9.0,
                0.0, 5.0);
        assertEquals(10, d.getXSampleCount());
        assertEquals(5, d.getYSampleCount());
        assertEquals(0.0, d.getMinimumXValue(), EPSILON);
        assertEquals(9.0, d.getMaximumXValue(), EPSILON);
        assertEquals(0.0, d.getMinimumYValue(), EPSILON);
        assertEquals(5.0, d.getMaximumYValue(), EPSILON);
        assertEquals(0.0, d.getZValue(0, 0), EPSILON);
        d.addChangeListener(this);
        d.setZValue(0, 0, 1.0, false);
        assertEquals(1.0, d.getZValue(0, 0), EPSILON);
        assertNull(this.lastEvent);
        d.setZValue(1, 2, 2.0);
        assertEquals(2.0, d.getZValue(1, 2), EPSILON);
        assertNotNull(this.lastEvent);
    }
View Full Code Here


    /**
     * Some tests for the equals() method.
     */
    public void testEquals() {
        DefaultHeatMapDataset d1 = new DefaultHeatMapDataset(5, 10, 1.0, 2.0,
                3.0, 4.0);
        DefaultHeatMapDataset d2 = new DefaultHeatMapDataset(5, 10, 1.0, 2.0,
                3.0, 4.0);
        assertEquals(d1, d2);

        d1 = new DefaultHeatMapDataset(6, 10, 1.0, 2.0, 3.0, 4.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 10, 1.0, 2.0, 3.0, 4.0);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHeatMapDataset(6, 11, 1.0, 2.0, 3.0, 4.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 11, 1.0, 2.0, 3.0, 4.0);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHeatMapDataset(6, 11, 2.0, 2.0, 3.0, 4.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 11, 2.0, 2.0, 3.0, 4.0);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 3.0, 4.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 3.0, 4.0);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 4.0, 4.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 4.0, 4.0);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 4.0, 5.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 4.0, 5.0);
        assertTrue(d1.equals(d2));

        d1.setZValue(1, 2, 3.0);
        assertFalse(d1.equals(d2));
        d2.setZValue(1, 2, 3.0);
        assertTrue(d1.equals(d2));

        d1.setZValue(0, 0, Double.NEGATIVE_INFINITY);
        assertFalse(d1.equals(d2));
        d2.setZValue(0, 0, Double.NEGATIVE_INFINITY);
        assertTrue(d1.equals(d2));

        d1.setZValue(0, 1, Double.POSITIVE_INFINITY);
        assertFalse(d1.equals(d2));
        d2.setZValue(0, 1, Double.POSITIVE_INFINITY);
        assertTrue(d1.equals(d2));

        d1.setZValue(0, 2, Double.NaN);
        assertFalse(d1.equals(d2));
        d2.setZValue(0, 2, Double.NaN);
        assertTrue(d1.equals(d2));
    }
View Full Code Here

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        DefaultHeatMapDataset d1 = new DefaultHeatMapDataset(2, 3, -1.0, 4.0,
                -2.0, 5.0);
        d1.setZValue(0, 0, 10.0);
        d1.setZValue(0, 1, Double.NEGATIVE_INFINITY);
        d1.setZValue(0, 2, Double.POSITIVE_INFINITY);
        d1.setZValue(1, 0, Double.NaN);
        DefaultHeatMapDataset d2 = null;
        try {
            d2 = (DefaultHeatMapDataset) d1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(d1 != d2);
        assertTrue(d1.getClass() == d2.getClass());
        assertTrue(d1.equals(d2));

        // simple check for independence
        d1.setZValue(0, 0, 11.0);
        assertFalse(d1.equals(d2));
        d2.setZValue(0, 0, 11.0);
        assertTrue(d1.equals(d2));
    }
View Full Code Here

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {
        DefaultHeatMapDataset d1 = new DefaultHeatMapDataset(2, 3, -1.0, 4.0,
                -2.0, 5.0);
        d1.setZValue(0, 0, 10.0);
        d1.setZValue(0, 1, Double.NEGATIVE_INFINITY);
        d1.setZValue(0, 2, Double.POSITIVE_INFINITY);
        d1.setZValue(1, 0, Double.NaN);

        DefaultHeatMapDataset d2 = null;

        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(d1);
View Full Code Here

    /**
     * Some general tests.
     */
    public void testGeneral() {
        DefaultHeatMapDataset d = new DefaultHeatMapDataset(10, 5, 0.0, 9.0,
                0.0, 5.0);
        assertEquals(10, d.getXSampleCount());
        assertEquals(5, d.getYSampleCount());
        assertEquals(0.0, d.getMinimumXValue(), EPSILON);
        assertEquals(9.0, d.getMaximumXValue(), EPSILON);
        assertEquals(0.0, d.getMinimumYValue(), EPSILON);
        assertEquals(5.0, d.getMaximumYValue(), EPSILON);
        assertEquals(0.0, d.getZValue(0, 0), EPSILON);
        d.addChangeListener(this);
        d.setZValue(0, 0, 1.0, false);
        assertEquals(1.0, d.getZValue(0, 0), EPSILON);
        assertNull(this.lastEvent);
        d.setZValue(1, 2, 2.0);
        assertEquals(2.0, d.getZValue(1, 2), EPSILON);
        assertNotNull(this.lastEvent);
    }
View Full Code Here

    /**
     * Some tests for the equals() method.
     */
    public void testEquals() {
        DefaultHeatMapDataset d1 = new DefaultHeatMapDataset(5, 10, 1.0, 2.0,
                3.0, 4.0);
        DefaultHeatMapDataset d2 = new DefaultHeatMapDataset(5, 10, 1.0, 2.0,
                3.0, 4.0);
        assertEquals(d1, d2);

        d1 = new DefaultHeatMapDataset(6, 10, 1.0, 2.0, 3.0, 4.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 10, 1.0, 2.0, 3.0, 4.0);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHeatMapDataset(6, 11, 1.0, 2.0, 3.0, 4.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 11, 1.0, 2.0, 3.0, 4.0);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHeatMapDataset(6, 11, 2.0, 2.0, 3.0, 4.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 11, 2.0, 2.0, 3.0, 4.0);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 3.0, 4.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 3.0, 4.0);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 4.0, 4.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 4.0, 4.0);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 4.0, 5.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 4.0, 5.0);
        assertTrue(d1.equals(d2));

        d1.setZValue(1, 2, 3.0);
        assertFalse(d1.equals(d2));
        d2.setZValue(1, 2, 3.0);
        assertTrue(d1.equals(d2));

        d1.setZValue(0, 0, Double.NEGATIVE_INFINITY);
        assertFalse(d1.equals(d2));
        d2.setZValue(0, 0, Double.NEGATIVE_INFINITY);
        assertTrue(d1.equals(d2));

        d1.setZValue(0, 1, Double.POSITIVE_INFINITY);
        assertFalse(d1.equals(d2));
        d2.setZValue(0, 1, Double.POSITIVE_INFINITY);
        assertTrue(d1.equals(d2));

        d1.setZValue(0, 2, Double.NaN);
        assertFalse(d1.equals(d2));
        d2.setZValue(0, 2, Double.NaN);
        assertTrue(d1.equals(d2));
    }
View Full Code Here

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        DefaultHeatMapDataset d1 = new DefaultHeatMapDataset(2, 3, -1.0, 4.0,
                -2.0, 5.0);
        d1.setZValue(0, 0, 10.0);
        d1.setZValue(0, 1, Double.NEGATIVE_INFINITY);
        d1.setZValue(0, 2, Double.POSITIVE_INFINITY);
        d1.setZValue(1, 0, Double.NaN);
        DefaultHeatMapDataset d2 = null;
        try {
            d2 = (DefaultHeatMapDataset) d1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(d1 != d2);
        assertTrue(d1.getClass() == d2.getClass());
        assertTrue(d1.equals(d2));

        // simple check for independence
        d1.setZValue(0, 0, 11.0);
        assertFalse(d1.equals(d2));
        d2.setZValue(0, 0, 11.0);
        assertTrue(d1.equals(d2));
    }
View Full Code Here

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {
        DefaultHeatMapDataset d1 = new DefaultHeatMapDataset(2, 3, -1.0, 4.0,
                -2.0, 5.0);
        d1.setZValue(0, 0, 10.0);
        d1.setZValue(0, 1, Double.NEGATIVE_INFINITY);
        d1.setZValue(0, 2, Double.POSITIVE_INFINITY);
        d1.setZValue(1, 0, Double.NaN);

        DefaultHeatMapDataset d2 = null;

        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(d1);
View Full Code Here

    /**
     * Some general tests.
     */
    public void testGeneral() {
        DefaultHeatMapDataset d = new DefaultHeatMapDataset(10, 5, 0.0, 9.0,
                0.0, 5.0);
        assertEquals(10, d.getXSampleCount());
        assertEquals(5, d.getYSampleCount());
        assertEquals(0.0, d.getMinimumXValue(), EPSILON);
        assertEquals(9.0, d.getMaximumXValue(), EPSILON);
        assertEquals(0.0, d.getMinimumYValue(), EPSILON);
        assertEquals(5.0, d.getMaximumYValue(), EPSILON);
        assertEquals(0.0, d.getZValue(0, 0), EPSILON);
        d.addChangeListener(this);
        d.setZValue(0, 0, 1.0, false);
        assertEquals(1.0, d.getZValue(0, 0), EPSILON);
        assertNull(this.lastEvent);
        d.setZValue(1, 2, 2.0);
        assertEquals(2.0, d.getZValue(1, 2), EPSILON);
        assertNotNull(this.lastEvent);
    }
View Full Code Here

    /**
     * Some tests for the equals() method.
     */
    public void testEquals() {
        DefaultHeatMapDataset d1 = new DefaultHeatMapDataset(5, 10, 1.0, 2.0,
                3.0, 4.0);
        DefaultHeatMapDataset d2 = new DefaultHeatMapDataset(5, 10, 1.0, 2.0,
                3.0, 4.0);
        assertEquals(d1, d2);

        d1 = new DefaultHeatMapDataset(6, 10, 1.0, 2.0, 3.0, 4.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 10, 1.0, 2.0, 3.0, 4.0);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHeatMapDataset(6, 11, 1.0, 2.0, 3.0, 4.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 11, 1.0, 2.0, 3.0, 4.0);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHeatMapDataset(6, 11, 2.0, 2.0, 3.0, 4.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 11, 2.0, 2.0, 3.0, 4.0);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 3.0, 4.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 3.0, 4.0);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 4.0, 4.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 4.0, 4.0);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 4.0, 5.0);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHeatMapDataset(6, 11, 2.0, 3.0, 4.0, 5.0);
        assertTrue(d1.equals(d2));

        d1.setZValue(1, 2, 3.0);
        assertFalse(d1.equals(d2));
        d2.setZValue(1, 2, 3.0);
        assertTrue(d1.equals(d2));

        d1.setZValue(0, 0, Double.NEGATIVE_INFINITY);
        assertFalse(d1.equals(d2));
        d2.setZValue(0, 0, Double.NEGATIVE_INFINITY);
        assertTrue(d1.equals(d2));

        d1.setZValue(0, 1, Double.POSITIVE_INFINITY);
        assertFalse(d1.equals(d2));
        d2.setZValue(0, 1, Double.POSITIVE_INFINITY);
        assertTrue(d1.equals(d2));

        d1.setZValue(0, 2, Double.NaN);
        assertFalse(d1.equals(d2));
        d2.setZValue(0, 2, Double.NaN);
        assertTrue(d1.equals(d2));
    }
View Full Code Here

TOP

Related Classes of org.jfree.data.general.DefaultHeatMapDataset

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.