/** * Retrieves the {@link Series} object with the given wickedChartsId from the given {@link * Options} object. Returns null if a Series with the given ID does not exist. */ public static Series<?> getSeriesWithWickedChartsId( final Options options, final int wickedChartsId) { for (Series<?> series : options.getSeries()) { if (series.getWickedChartsId() == wickedChartsId) { return series; } } return null; }
/** * Returns the (0-based) index of the series with the given wickedChartsId or null. * * @param options the options in which to search * @param wickedChartsId the wickedChartsId of the series * @return the index of the series with the given id. Returns 0 if no series was found. */ public static int getSeriesIndex(final Options options, final int wickedChartsId) { int index = 0; if (options.getSeries() == null) { throw new IllegalStateException("The given Options object does not contain any series!"); } for (Series<?> series : options.getSeries()) { if (series.getWickedChartsId() == wickedChartsId) { return index; } index++; } return 0; }