Package org.jfree.data.xy

Examples of org.jfree.data.xy.MatrixSeries


    /**
     * Tests the getItemColumn() method.
     */
    public void testGetItemColumn() {
        MatrixSeries m = new MatrixSeries("Test", 3, 2);
        assertEquals(0, m.getItemColumn(0));
        assertEquals(1, m.getItemColumn(1));
        assertEquals(0, m.getItemColumn(2));
        assertEquals(1, m.getItemColumn(3));
        assertEquals(0, m.getItemColumn(4));
        assertEquals(1, m.getItemColumn(5));
    }
View Full Code Here


    /**
     * Tests the getItemRow() method.
     */
    public void testGetItemRow() {
        MatrixSeries m = new MatrixSeries("Test", 3, 2);
        assertEquals(0, m.getItemRow(0));
        assertEquals(0, m.getItemRow(1));
        assertEquals(1, m.getItemRow(2));
        assertEquals(1, m.getItemRow(3));
        assertEquals(2, m.getItemRow(4));
        assertEquals(2, m.getItemRow(5));
    }
View Full Code Here

    /**
     * Tests the getItem() method.
     */
    public void testGetItem() {
        MatrixSeries m = new MatrixSeries("Test", 3, 2);
        m.update(0, 0, 0.0);
        m.update(0, 1, 1.0);
        m.update(1, 0, 2.0);
        m.update(1, 1, 3.0);
        m.update(2, 0, 4.0);
        m.update(2, 1, 5.0);
        assertEquals(0.0, m.getItem(0).doubleValue(), 0.001);
        assertEquals(1.0, m.getItem(1).doubleValue(), 0.001);
        assertEquals(2.0, m.getItem(2).doubleValue(), 0.001);
        assertEquals(3.0, m.getItem(3).doubleValue(), 0.001);
        assertEquals(4.0, m.getItem(4).doubleValue(), 0.001);
        assertEquals(5.0, m.getItem(5).doubleValue(), 0.001);
    }
View Full Code Here

    /**
     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {

        MatrixSeries m1 = new MatrixSeries("Test", 8, 3);
        m1.update(0, 0, 11.0);
        m1.update(7, 2, 22.0);
        MatrixSeries m2 = new MatrixSeries("Test", 8, 3);
        m2.update(0, 0, 11.0);
        m2.update(7, 2, 22.0);
        assertTrue(m1.equals(m2));
        assertTrue(m2.equals(m1));

        m1 = new MatrixSeries("Test 2", 8, 3);
        assertFalse(m1.equals(m2));
        m2 = new MatrixSeries("Test 2", 8, 3);
        assertTrue(m1.equals(m2));

        m1 = new MatrixSeries("Test 2", 10, 3);
        assertFalse(m1.equals(m2));
        m2 = new MatrixSeries("Test 2", 10, 3);
        assertTrue(m1.equals(m2));

        m1 = new MatrixSeries("Test 2", 10, 5);
        assertFalse(m1.equals(m2));
        m2 = new MatrixSeries("Test 2", 10, 5);
        assertTrue(m1.equals(m2));

        m1.update(0, 0, 99);
        assertFalse(m1.equals(m2));
        m2.update(0, 0, 99);
        assertTrue(m1.equals(m2));
    }
View Full Code Here

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        MatrixSeries m1 = new MatrixSeries("Test", 8, 3);
        m1.update(0, 0, 11.0);
        m1.update(7, 2, 22.0);
        MatrixSeries m2 = null;
        try {
            m2 = (MatrixSeries) m1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(m1 != m2);
        assertTrue(m1.getClass() == m2.getClass());
        assertTrue(m1.equals(m2));
    }
View Full Code Here

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {
        MatrixSeries m1 = new MatrixSeries("Test", 8, 3);
        m1.update(0, 0, 11.0);
        m1.update(7, 2, 22.0);
        MatrixSeries m2 = null;
        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(m1);
            out.close();
View Full Code Here

    /**
     * Tests the getItemColumn() method.
     */
    public void testGetItemColumn() {
        MatrixSeries m = new MatrixSeries("Test", 3, 2);
        assertEquals(0, m.getItemColumn(0));
        assertEquals(1, m.getItemColumn(1));
        assertEquals(0, m.getItemColumn(2));
        assertEquals(1, m.getItemColumn(3));
        assertEquals(0, m.getItemColumn(4));
        assertEquals(1, m.getItemColumn(5));
    }
View Full Code Here

    /**
     * Tests the getItemRow() method.
     */
    public void testGetItemRow() {
        MatrixSeries m = new MatrixSeries("Test", 3, 2);
        assertEquals(0, m.getItemRow(0));
        assertEquals(0, m.getItemRow(1));
        assertEquals(1, m.getItemRow(2));
        assertEquals(1, m.getItemRow(3));
        assertEquals(2, m.getItemRow(4));
        assertEquals(2, m.getItemRow(5));
    }
View Full Code Here

    /**
     * Tests the getItem() method.
     */
    public void testGetItem() {
        MatrixSeries m = new MatrixSeries("Test", 3, 2);
        m.update(0, 0, 0.0);
        m.update(0, 1, 1.0);
        m.update(1, 0, 2.0);
        m.update(1, 1, 3.0);
        m.update(2, 0, 4.0);
        m.update(2, 1, 5.0);
        assertEquals(0.0, m.getItem(0).doubleValue(), 0.001);
        assertEquals(1.0, m.getItem(1).doubleValue(), 0.001);
        assertEquals(2.0, m.getItem(2).doubleValue(), 0.001);
        assertEquals(3.0, m.getItem(3).doubleValue(), 0.001);
        assertEquals(4.0, m.getItem(4).doubleValue(), 0.001);
        assertEquals(5.0, m.getItem(5).doubleValue(), 0.001);
    }
View Full Code Here

    /**
     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {
       
        MatrixSeries m1 = new MatrixSeries("Test", 8, 3);
        m1.update(0, 0, 11.0);
        m1.update(7, 2, 22.0);
        MatrixSeries m2 = new MatrixSeries("Test", 8, 3);
        m2.update(0, 0, 11.0);
        m2.update(7, 2, 22.0);
        assertTrue(m1.equals(m2));
        assertTrue(m2.equals(m1));

        m1 = new MatrixSeries("Test 2", 8, 3);
        assertFalse(m1.equals(m2));
        m2 = new MatrixSeries("Test 2", 8, 3);
        assertTrue(m1.equals(m2));

        m1 = new MatrixSeries("Test 2", 10, 3);
        assertFalse(m1.equals(m2));
        m2 = new MatrixSeries("Test 2", 10, 3);
        assertTrue(m1.equals(m2));

        m1 = new MatrixSeries("Test 2", 10, 5);
        assertFalse(m1.equals(m2));
        m2 = new MatrixSeries("Test 2", 10, 5);
        assertTrue(m1.equals(m2));

    }
View Full Code Here

TOP

Related Classes of org.jfree.data.xy.MatrixSeries

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.