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

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

Introduction

In this page you can find the example usage for org.jfree.data.xy XIntervalSeries 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.XIntervalSeriesTest.java

/**
 * Simple test for the indexOf() method.
 *///from  w  ww. j  av  a 2  s  . c  o m
@Test
public void testIndexOf() {
    XIntervalSeries s1 = new XIntervalSeries("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 Double(1.0)));
}

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

/**
 * A check for the indexOf() method for an unsorted series.
 *//*from   w ww . ja v  a2s  . c  o  m*/
@Test
public void testIndexOf2() {
    XIntervalSeries s1 = new XIntervalSeries("Series 1", false, true);
    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 Double(1.0)));
    assertEquals(1, s1.indexOf(new Double(3.0)));
    assertEquals(2, s1.indexOf(new Double(2.0)));
}