Example usage for org.jfree.data.xy MatrixSeries MatrixSeries

List of usage examples for org.jfree.data.xy MatrixSeries MatrixSeries

Introduction

In this page you can find the example usage for org.jfree.data.xy MatrixSeries MatrixSeries.

Prototype

public MatrixSeries(String name, int rows, int columns) 

Source Link

Document

Constructs a new matrix series.

Usage

From source file:org.jfree.data.xy.MatrixSeriesTest.java

/**
 * Confirm that the equals method can distinguish all the required fields.
 *///ww w. jav a  2s.  com
@Test
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));
}

From source file:org.jfree.data.xy.MatrixSeriesCollectionTest.java

/**
 * Confirm that the equals method can distinguish all the required fields.
 *///from  w ww .  ja  v a  2s. c o  m
@Test
public void testEquals() {
    MatrixSeries s1 = new MatrixSeries("Series", 2, 3);
    s1.update(0, 0, 1.1);
    MatrixSeriesCollection c1 = new MatrixSeriesCollection();
    c1.addSeries(s1);
    MatrixSeries s2 = new MatrixSeries("Series", 2, 3);
    s2.update(0, 0, 1.1);
    MatrixSeriesCollection c2 = new MatrixSeriesCollection();
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));
    assertTrue(c2.equals(c1));

    c1.addSeries(new MatrixSeries("Empty Series", 1, 1));
    assertFalse(c1.equals(c2));

    c2.addSeries(new MatrixSeries("Empty Series", 1, 1));
    assertTrue(c1.equals(c2));
}

From source file:org.jfree.data.xy.junit.MatrixSeriesCollectionTest.java

/**
 * Confirm that the equals method can distinguish all the required fields.
 *//*from   www.  j  a v a2 s . c o m*/
public void testEquals() {
    MatrixSeries s1 = new MatrixSeries("Series", 2, 3);
    s1.update(0, 0, 1.1);
    MatrixSeriesCollection c1 = new MatrixSeriesCollection();
    c1.addSeries(s1);
    MatrixSeries s2 = new MatrixSeries("Series", 2, 3);
    s2.update(0, 0, 1.1);
    MatrixSeriesCollection c2 = new MatrixSeriesCollection();
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));
    assertTrue(c2.equals(c1));

    c1.addSeries(new MatrixSeries("Empty Series", 1, 1));
    assertFalse(c1.equals(c2));

    c2.addSeries(new MatrixSeries("Empty Series", 1, 1));
    assertTrue(c1.equals(c2));
}

From source file:org.jfree.data.xy.MatrixSeriesCollectionTest.java

/**
 * Confirm that cloning works./*from  w  ww.j  a v a2s  .c om*/
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    MatrixSeries s1 = new MatrixSeries("Series", 2, 3);
    s1.update(0, 0, 1.1);
    MatrixSeriesCollection c1 = new MatrixSeriesCollection();
    c1.addSeries(s1);
    MatrixSeriesCollection c2 = (MatrixSeriesCollection) c1.clone();

    assertTrue(c1 != c2);
    assertTrue(c1.getClass() == c2.getClass());
    assertTrue(c1.equals(c2));

    // check independence
    s1.setDescription("XYZ");
    assertFalse(c1.equals(c2));
}

From source file:org.jfree.data.xy.MatrixSeriesTest.java

/**
 * Confirm that cloning works./* w ww  . j av  a 2s.  c o  m*/
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    MatrixSeries m1 = new MatrixSeries("Test", 8, 3);
    m1.update(0, 0, 11.0);
    m1.update(7, 2, 22.0);
    MatrixSeries m2 = (MatrixSeries) m1.clone();
    assertTrue(m1 != m2);
    assertTrue(m1.getClass() == m2.getClass());
    assertTrue(m1.equals(m2));
}

From source file:org.jfree.data.xy.junit.MatrixSeriesCollectionTest.java

/**
 * Confirm that cloning works./*from   w  w  w  .  j  a v a2  s  .c o  m*/
 */
public void testCloning() {
    MatrixSeries s1 = new MatrixSeries("Series", 2, 3);
    s1.update(0, 0, 1.1);
    MatrixSeriesCollection c1 = new MatrixSeriesCollection();
    c1.addSeries(s1);
    MatrixSeriesCollection c2 = null;
    try {
        c2 = (MatrixSeriesCollection) c1.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    assertTrue(c1 != c2);
    assertTrue(c1.getClass() == c2.getClass());
    assertTrue(c1.equals(c2));

    // check independence
    s1.setDescription("XYZ");
    assertFalse(c1.equals(c2));
}

From source file:org.jfree.data.xy.MatrixSeriesTest.java

/**
 * Serialize an instance, restore it, and check for equality.
 *//*from  w  ww . ja va 2 s .  c o m*/
@Test
public void testSerialization() {
    MatrixSeries m1 = new MatrixSeries("Test", 8, 3);
    m1.update(0, 0, 11.0);
    m1.update(7, 2, 22.0);
    MatrixSeries m2 = (MatrixSeries) TestUtilities.serialised(m1);
    assertEquals(m1, m2);
}

From source file:org.jfree.data.xy.MatrixSeriesCollectionTest.java

/**
 * Serialize an instance, restore it, and check for equality.
 *///from  w  w w .  j a v a 2 s.c  o  m
@Test
public void testSerialization() {
    MatrixSeries s1 = new MatrixSeries("Series", 2, 3);
    s1.update(0, 0, 1.1);
    MatrixSeriesCollection c1 = new MatrixSeriesCollection();
    c1.addSeries(s1);
    MatrixSeriesCollection c2 = (MatrixSeriesCollection) TestUtilities.serialised(c1);
    assertEquals(c1, c2);
}

From source file:org.jfree.data.xy.MatrixSeriesTest.java

/**
 * Tests the getItemColumn() method./*from   w w  w . ja v a  2 s  .c  o m*/
 */
@Test
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));
}

From source file:org.jfree.data.xy.MatrixSeriesTest.java

/**
 * Tests the getItemRow() method.//from  w  ww. j ava  2  s .  c om
 */
@Test
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));
}