3068df843a49e171d3f07778481f54ec6b58a88f
[deliverable/tracecompass.git] / statesystem / org.eclipse.tracecompass.segmentstore.core / src / org / eclipse / tracecompass / segmentstore / core / segment / interfaces / SegmentAspects.java
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 *******************************************************************************/
9
10 package org.eclipse.tracecompass.segmentstore.core.segment.interfaces;
11
12 import org.eclipse.jdt.annotation.Nullable;
13 import org.eclipse.tracecompass.segmentstore.core.ISegment;
14
15 /**
16 * Interface to return some fields of a segment depending on the interfaces it
17 * implements
18 *
19 * @since 1.2
20 */
21 public final class SegmentAspects {
22
23 private SegmentAspects() {
24
25 }
26
27 /**
28 * Get the name aspect of a segment. If the segment is a
29 * {@link INamedSegment}, the aspect will return its name. Otherwise, it is
30 * <code>null</code>
31 *
32 * @param segment
33 * The segment to get the aspect of
34 * @return The name of a {@link INamedSegment}, <code>null</code> otherwise
35 */
36 public static @Nullable String getName(ISegment segment) {
37 if (segment instanceof INamedSegment) {
38 return ((INamedSegment) segment).getName();
39 }
40 return null;
41 }
42
43 }
This page took 0.030428 seconds and 4 git commands to generate.