Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tracecompass-dev] TmfTreeXYCompositeDataProvider is useful, but internal API

Hi Trace Compass devs,

I have been looking at updating our IDataProviderFactorys to work with Trace Server.

While doing so I saw that many of the standard Trace Compass data provider factories return a TmfTreeXYCompositeDataProvider to handle multiple traces together. At the moment we simply don't support experiments/multiple-traces for our own data providers.

Returning a TmfTreeXYCompositeDataProvider gets us that multi-trace support very easily, but the TmfTreeXYCompositeDataProvider is not API itself. Is there an API compliant way to use this code?

If not, is this something that can be made API, or perhaps a factory that allows an instance of it to be returned without directly making it an API? If this is something of interest I'll create a gerrit/bugzilla.

I was thinking something like the following added to IDataProviderFactory (or somewhere more suitable?):


/**
 * Return a composite {@link ITmfTreeXYDataProvider} from a list of traces.
 *
 * @param traces
 *            A list of traces from which to generate a provider.
 * @param title
 *            Chart's title
 * @param id
 *            the provider's ID
 * @return null if none of the traces returns a provider, the provider if
 *         the lists only return one, else a
 *         {@link TmfTreeXYCompositeDataProvider} encapsulating the
 *         providers
 * @since 8.2
 */
public static @Nullable ITmfTreeXYDataProvider<@NonNull ITmfTreeDataModel> createCompositDataProvider(Collection<ITmfTrace> traces, String title, String id) {
    return createCompositDataProvider(traces, title, id, null);
}

/**
 *
 * Return a composite data provider from a list of traces.
 *
 * @param traces
 *            A list of traces from which to generate a provider.
 * @param title
 *            Chart's title
 * @param id
 *            the provider's ID
 * @param secondaryId
 *            The provider's secondaryId
 * @return null if none of the traces returns a provider, the provider if
 *         the lists only return one, else a composite data provider
 *         encapsulating the providers
 * @since 8.2
 */
public static @Nullable ITmfTreeDataProvider<@NonNull ITmfTreeDataModel> createCompositDataProvider(Collection<ITmfTrace> traces, String title, String id, @Nullable String secondaryId) {
    return TmfTreeXYCompositeDataProvider.create(traces, title, id, secondaryId);
}


WDYT?

Jonah
~~~
Jonah Graham
Kichwa Coders
www.kichwacoders.com

Back to the top