+ /**
+ * Adds a new event aspect to this type of trace. Since this trace type is
+ * used to build custom traces that mimic the behavior of real traces, the
+ * required aspects may be missing and this method allows to add them. This
+ * method should be called before calling
+ * {@link #initTrace(IResource, String, Class)} otherwise the additional
+ * aspects will not be picked up when generating the aspects.
+ *
+ * @param aspect
+ * The aspect to have
+ */
+ public void addEventAspect(ITmfEventAspect<?> aspect) {
+ fAdditionalAspects.add(aspect);
+ }
+
+ /**
+ * Add an additional new module
+ *
+ * @param module
+ * The new module
+ */
+ public void addAnalysisModule(IAnalysisModule module) {
+ fAdditionalModules.add(module);
+ }
+
+ @Override
+ public Iterable<@NonNull IAnalysisModule> getAnalysisModules() {
+ @NonNull Iterable<IAnalysisModule> modules = super.getAnalysisModules();
+ return checkNotNull(Iterables.concat(modules, fAdditionalModules));
+ }
+
+ @Override
+ public @Nullable IAnalysisModule getAnalysisModule(@Nullable String analysisId) {
+ Iterable<@NonNull IAnalysisModule> modules = getAnalysisModules();
+ Optional<IAnalysisModule> opt = StreamSupport.stream(modules.spliterator(), false).filter(analysis -> analysis.getId().equals(analysisId)).findFirst();
+ return opt.isPresent() ? opt.get() : null;
+ }