コード例 #1
0
ファイル: Plot.java プロジェクト: HiroshiFuu/androidplot
 /**
  * @param series
  * @return A List of {@link SeriesAndFormatter} instances that reference series.
  */
 protected List<SeriesAndFormatter<SeriesType, FormatterType>> getSeries(SeriesType series) {
   List<SeriesAndFormatter<SeriesType, FormatterType>> results =
       new ArrayList<SeriesAndFormatter<SeriesType, FormatterType>>();
   for (SeriesAndFormatter<SeriesType, FormatterType> thisPair : getSeriesRegistry()) {
     if (thisPair.getSeries() == series) {
       results.add(thisPair);
     }
   }
   return results;
 }
コード例 #2
0
ファイル: Plot.java プロジェクト: HiroshiFuu/androidplot
 /**
  * @param series
  * @param rendererClass
  * @return The {@link SeriesAndFormatter} that matches the series and rendererClass params, or
  *     null if one is not found.
  */
 protected SeriesAndFormatter<SeriesType, FormatterType> getSeries(
     SeriesType series, Class<? extends RendererType> rendererClass) {
   for (SeriesAndFormatter<SeriesType, FormatterType> thisPair : getSeriesRegistry()) {
     if (thisPair.getSeries() == series
         && thisPair.getFormatter().getRendererClass() == rendererClass) {
       return thisPair;
     }
   }
   return null;
 }
コード例 #3
0
ファイル: Plot.java プロジェクト: HiroshiFuu/androidplot
  /**
   * Remove a series for a specific Renderer only. Use {@link #removeSeries(Series)} to remove the
   * series from the plot completely.
   *
   * @param series
   * @param rendererClass
   * @return The SeriesAndFormatterPair that was removed or null if nothing was removed.
   */
  public synchronized SeriesAndFormatter<SeriesType, FormatterType> removeSeries(
      SeriesType series, Class<? extends RendererType> rendererClass) {

    List<SeriesAndFormatter<SeriesType, FormatterType>> results = getSeries(series);
    SeriesAndFormatter<SeriesType, FormatterType> result = null;
    for (SeriesAndFormatter<SeriesType, FormatterType> thisPair : results) {
      if (thisPair.getFormatter().getRendererClass() == rendererClass) {
        result = thisPair;
        getSeriesRegistry().remove(result);
        break;
      }
    }

    // if series implements PlotListener and is not assigned to any other renderers remove it as a
    // listener:
    if (series instanceof PlotListener && results.size() == 1) {
      removeListener((PlotListener) series);
    }

    return result;
  }