Example usage for org.jfree.data.time TimePeriodValues getDataItem

List of usage examples for org.jfree.data.time TimePeriodValues getDataItem

Introduction

In this page you can find the example usage for org.jfree.data.time TimePeriodValues getDataItem.

Prototype

public TimePeriodValue getDataItem(int index) 

Source Link

Document

Returns one data item for the series.

Usage

From source file:org.jfree.data.time.TimePeriodValuesCollection.java

/**
 * Returns the starting X value for the specified series and item.
 *
 * @param series  the series (zero-based index).
 * @param item  the item (zero-based index).
 *
 * @return The starting X value for the specified series and item.
 *//* ww  w  .j av  a2 s.  c  o  m*/
@Override
public Number getStartX(int series, int item) {
    TimePeriodValues ts = (TimePeriodValues) this.data.get(series);
    TimePeriodValue dp = ts.getDataItem(item);
    return new Long(dp.getPeriod().getStart().getTime());
}

From source file:org.jfree.data.time.TimePeriodValuesCollection.java

/**
 * Returns the ending X value for the specified series and item.
 *
 * @param series  the series (zero-based index).
 * @param item  the item (zero-based index).
 *
 * @return The ending X value for the specified series and item.
 *///ww w . j  a v  a 2s  .com
@Override
public Number getEndX(int series, int item) {
    TimePeriodValues ts = (TimePeriodValues) this.data.get(series);
    TimePeriodValue dp = ts.getDataItem(item);
    return new Long(dp.getPeriod().getEnd().getTime());
}

From source file:org.jfree.data.time.TimePeriodValuesCollection.java

/**
 * Returns the y-value for the specified series and item.
 *
 * @param series  the series (zero-based index).
 * @param item  the item (zero-based index).
 *
 * @return The y-value for the specified series and item.
 *///from  w  w  w.java 2 s .  c  o  m
@Override
public Number getY(int series, int item) {
    TimePeriodValues ts = (TimePeriodValues) this.data.get(series);
    TimePeriodValue dp = ts.getDataItem(item);
    return dp.getValue();
}

From source file:org.jfree.data.time.TimePeriodValuesCollection.java

/**
 * Returns the x-value for the specified series and item.
 *
 * @param series  the series (zero-based index).
 * @param item  the item (zero-based index).
 *
 * @return The x-value for the specified series and item.
 *///from  w ww  . j av  a  2 s .  c o  m
@Override
public Number getX(int series, int item) {
    TimePeriodValues ts = (TimePeriodValues) this.data.get(series);
    TimePeriodValue dp = ts.getDataItem(item);
    TimePeriod period = dp.getPeriod();
    return new Long(getX(period));
}

From source file:org.jfree.data.time.TimePeriodValues.java

/**
 * Tests the series for equality with another object.
 *
 * @param obj  the object (<code>null</code> permitted).
 *
 * @return <code>true</code> or <code>false</code>.
 *///from  w w w.j  a v a  2s.c  om
public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof TimePeriodValues)) {
        return false;
    }
    if (!super.equals(obj)) {
        return false;
    }
    TimePeriodValues that = (TimePeriodValues) obj;
    if (!ObjectUtilities.equal(this.getDomainDescription(), that.getDomainDescription())) {
        return false;
    }
    if (!ObjectUtilities.equal(this.getRangeDescription(), that.getRangeDescription())) {
        return false;
    }
    int count = getItemCount();
    if (count != that.getItemCount()) {
        return false;
    }
    for (int i = 0; i < count; i++) {
        if (!getDataItem(i).equals(that.getDataItem(i))) {
            return false;
        }
    }
    return true;
}

From source file:org.jfree.data.time.TimePeriodValues.java

/**
 * Tests the series for equality with another object.
 *
 * @param obj  the object (<code>null</code> permitted).
 *
 * @return <code>true</code> or <code>false</code>.
 *///from   w  ww  . j a  v  a 2  s .c  om
@Override
public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof TimePeriodValues)) {
        return false;
    }
    if (!super.equals(obj)) {
        return false;
    }
    TimePeriodValues that = (TimePeriodValues) obj;
    if (!ObjectUtilities.equal(this.getDomainDescription(), that.getDomainDescription())) {
        return false;
    }
    if (!ObjectUtilities.equal(this.getRangeDescription(), that.getRangeDescription())) {
        return false;
    }
    int count = getItemCount();
    if (count != that.getItemCount()) {
        return false;
    }
    for (int i = 0; i < count; i++) {
        if (!getDataItem(i).equals(that.getDataItem(i))) {
            return false;
        }
    }
    return true;
}