Java Code Examples for org.jfree.chart.axis.CategoryLabelPositions#hashCode()

The following examples show how to use org.jfree.chart.axis.CategoryLabelPositions#hashCode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CategoryLabelPositionsTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Two objects that are equal are required to return the same hashCode.
 */
public void testHashCode() {
    CategoryLabelPositions p1 = new CategoryLabelPositions(
            new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
            new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
            new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
            new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER));
    CategoryLabelPositions p2 = new CategoryLabelPositions(
            new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
            new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
            new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
            new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER));
    assertTrue(p1.equals(p2));
    int h1 = p1.hashCode();
    int h2 = p2.hashCode();
    assertEquals(h1, h2);
}
 
Example 2
Source File: CategoryLabelPositionsTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashCode() {
    CategoryLabelPositions p1 = new CategoryLabelPositions(
        new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER) 
    );
    CategoryLabelPositions p2 = new CategoryLabelPositions(
        new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER) 
    );
    assertTrue(p1.equals(p2));
    int h1 = p1.hashCode();
    int h2 = p2.hashCode();
    assertEquals(h1, h2);
}