tmf.xml: Move all .core and .ui packages to internal
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.analysis.xml.core / src / org / eclipse / tracecompass / internal / tmf / analysis / xml / core / pattern / stateprovider / XmlPatternLatencyStatisticsAnalysis.java
CommitLineData
5b901f94
JCK
1/*******************************************************************************
2 * Copyright (c) 2016 École Polytechnique de Montréal
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9package org.eclipse.tracecompass.internal.tmf.analysis.xml.core.pattern.stateprovider;
10
11import org.eclipse.jdt.annotation.NonNull;
12import org.eclipse.jdt.annotation.Nullable;
13import org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider;
14import org.eclipse.tracecompass.analysis.timing.core.segmentstore.statistics.AbstractSegmentStatisticsAnalysis;
6eca054d
GB
15import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.model.TmfXmlPatternSegmentBuilder;
16import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.segment.TmfXmlPatternSegment;
5b901f94 17import org.eclipse.tracecompass.segmentstore.core.ISegment;
5b901f94
JCK
18import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
19import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
20
21/**
22 * Statistic analysis for segments generated by a pattern analysis
23 *
24 * @author Jean-Christian Kouame
25 */
26public class XmlPatternLatencyStatisticsAnalysis extends AbstractSegmentStatisticsAnalysis {
27
28 private final @Nullable String fPatternAnalysisId;
29
30 /**
31 * Constructor
32 *
33 * @param patternAnalysisId
34 * The pattern analysis ID
35 */
36 public XmlPatternLatencyStatisticsAnalysis(@Nullable String patternAnalysisId) {
37 fPatternAnalysisId = patternAnalysisId;
38 }
39
40 @Override
41 protected @Nullable String getSegmentType(@NonNull ISegment segment) {
42 if (segment instanceof TmfXmlPatternSegment) {
43 TmfXmlPatternSegment patternSegment = (TmfXmlPatternSegment) segment;
44 return patternSegment.getName().substring(TmfXmlPatternSegmentBuilder.PATTERN_SEGMENT_NAME_PREFIX.length());
45 }
46 return null;
47 }
48
49 @Override
50 protected @Nullable ISegmentStoreProvider getSegmentProviderAnalysis(@NonNull ITmfTrace trace) {
51 return fPatternAnalysisId != null ? TmfTraceUtils.getAnalysisModuleOfClass(trace, XmlPatternAnalysis.class, fPatternAnalysisId) : null;
52 }
53}
This page took 0.028948 seconds and 5 git commands to generate.