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

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

Introduction

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

/**
 * Simple test for the indexOf() method.
 *///w  ww  . ja va 2s.  c o  m
@Test
public void testIndexOf() {
    XYIntervalSeries s1 = new XYIntervalSeries("Series 1");
    s1.add(1.0, 1.0, 1.0, 2.0, 1.9, 2.1);
    s1.add(2.0, 2.0, 2.0, 3.0, 2.9, 3.1);
    s1.add(3.0, 3.0, 3.0, 4.0, 3.9, 4.1);
    assertEquals(0, s1.indexOf(new Double(1.0)));
}

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

/**
 * A check for the indexOf() method for an unsorted series.
 *///from  w w  w .  j  a v  a2s.c om
@Test
public void testIndexOf2() {
    XYIntervalSeries s1 = new XYIntervalSeries("Series 1", false, true);
    s1.add(1.0, 1.0, 1.0, 2.0, 1.9, 2.1);
    s1.add(3.0, 3.0, 3.0, 3.0, 2.9, 3.1);
    s1.add(2.0, 2.0, 2.0, 2.0, 1.9, 2.1);
    assertEquals(0, s1.indexOf(new Double(1.0)));
    assertEquals(1, s1.indexOf(new Double(3.0)));
    assertEquals(2, s1.indexOf(new Double(2.0)));
}