Example usage for org.jfree.data.xy VectorSeries indexOf

List of usage examples for org.jfree.data.xy VectorSeries indexOf

Introduction

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

Prototype

public int indexOf(Comparable x) 

Source Link

Document

Returns the index of the item with the specified x-value, or a negative index if the series does not contain an item with that x-value.

Usage

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

/**
 * Simple test for the indexOf() method.
 *//*from   w  w w.j av a  2  s .  co m*/
@Test
public void testIndexOf() {
    VectorSeries s1 = new VectorSeries("Series 1");
    s1.add(1.0, 1.0, 1.0, 2.0);
    s1.add(2.0, 2.0, 2.0, 3.0);
    s1.add(3.0, 3.0, 3.0, 4.0);
    assertEquals(0, s1.indexOf(new XYCoordinate(1.0, 1.0)));
}

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

/**
 * A check for the indexOf() method for an unsorted series.
 *//*from  ww w.  j  av  a2s .  com*/
@Test
public void testIndexOf2() {
    VectorSeries s1 = new VectorSeries("Series 1");
    s1.add(1.0, 1.0, 1.0, 2.0);
    s1.add(3.0, 3.0, 3.0, 3.0);
    s1.add(2.0, 2.0, 2.0, 2.0);
    assertEquals(0, s1.indexOf(new XYCoordinate(1.0, 1.0)));
    assertEquals(1, s1.indexOf(new XYCoordinate(3.0, 3.0)));
    assertEquals(2, s1.indexOf(new XYCoordinate(2.0, 2.0)));
}