Example usage for org.jfree.data.xy XYSeriesCollection equals

List of usage examples for org.jfree.data.xy XYSeriesCollection equals

Introduction

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

Prototype

@Override
public boolean equals(Object obj) 

Source Link

Document

Tests this collection for equality with an arbitrary object.

Usage

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

/**
 * Confirm that the equals method can distinguish all the required fields.
 *///from  w ww  .  j av  a2s .c om
public void testEquals() {
    XYSeries s1 = new XYSeries("Series");
    s1.add(1.0, 1.1);
    XYSeriesCollection c1 = new XYSeriesCollection();
    c1.addSeries(s1);
    XYSeries s2 = new XYSeries("Series");
    s2.add(1.0, 1.1);
    XYSeriesCollection c2 = new XYSeriesCollection();
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));
    assertTrue(c2.equals(c1));

    c1.addSeries(new XYSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new XYSeries("Empty Series"));
    assertTrue(c1.equals(c2));

    c1.setIntervalWidth(5.0);
    assertFalse(c1.equals(c2));
    c2.setIntervalWidth(5.0);
    assertTrue(c1.equals(c2));

    c1.setIntervalPositionFactor(0.75);
    assertFalse(c1.equals(c2));
    c2.setIntervalPositionFactor(0.75);
    assertTrue(c1.equals(c2));

    c1.setAutoWidth(true);
    assertFalse(c1.equals(c2));
    c2.setAutoWidth(true);
    assertTrue(c1.equals(c2));

}

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

/**
 * Confirm that cloning works./* ww  w . jav  a 2 s. co m*/
 */
public void testCloning() {
    XYSeries s1 = new XYSeries("Series");
    s1.add(1.0, 1.1);
    XYSeriesCollection c1 = new XYSeriesCollection();
    c1.addSeries(s1);
    XYSeriesCollection c2 = null;
    try {
        c2 = (XYSeriesCollection) 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.XYSeriesCollectionTest.java

/**
 * Confirm that cloning works./*  w w w.  j  ava2  s . c o  m*/
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    XYSeries s1 = new XYSeries("Series");
    s1.add(1.0, 1.1);
    XYSeriesCollection c1 = new XYSeriesCollection();
    c1.addSeries(s1);
    XYSeriesCollection c2 = (XYSeriesCollection) c1.clone();
    assertNotSame(c1, c2);
    assertSame(c1.getClass(), c2.getClass());
    assertEquals(c1, c2);

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

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

/**
 * Confirm that cloning works./*from   w w w  .  ja v a2  s . com*/
 */
public void testCloning() {
    XYSeries s1 = new XYSeries("Series");
    s1.add(1.0, 1.1);
    XYSeriesCollection c1 = new XYSeriesCollection();
    c1.addSeries(s1);
    XYSeriesCollection c2 = null;
    try {
        c2 = (XYSeriesCollection) c1.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
        assertTrue(false);
        return;
    }
    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.XYSeriesCollectionTest.java

/**
 * Confirm that the equals method can distinguish all the required fields.
 *///from   w  ww.j  a  v  a 2  s  . co m
@Test
public void testEquals() {
    XYSeries s1 = new XYSeries("Series");
    s1.add(1.0, 1.1);
    XYSeriesCollection c1 = new XYSeriesCollection();
    c1.addSeries(s1);
    XYSeries s2 = new XYSeries("Series");
    s2.add(1.0, 1.1);
    XYSeriesCollection c2 = new XYSeriesCollection();
    c2.addSeries(s2);
    assertEquals(c1, c2);
    assertEquals(c2, c1);

    c1.addSeries(new XYSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new XYSeries("Empty Series"));
    assertEquals(c1, c2);

    c1.setIntervalWidth(5.0);
    assertFalse(c1.equals(c2));
    c2.setIntervalWidth(5.0);
    assertEquals(c1, c2);

    c1.setIntervalPositionFactor(0.75);
    assertFalse(c1.equals(c2));
    c2.setIntervalPositionFactor(0.75);
    assertEquals(c1, c2);

    c1.setAutoWidth(true);
    assertFalse(c1.equals(c2));
    c2.setAutoWidth(true);
    assertEquals(c1, c2);

}