1 /*******************************************************************************
2 * Copyright (c) 2017 Ericsson
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
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.internal
.tmf
.core
.markers
;
15 import java
.util
.ArrayList
;
16 import java
.util
.List
;
18 import com
.google
.common
.collect
.Range
;
19 import com
.google
.common
.collect
.RangeSet
;
22 * Model element for configurable sub-marker.
24 public abstract class SubMarker
extends Marker
{
27 * Private constructor.
34 private SubMarker(String name
, String color
) {
39 * Subclass for sub-marker evenly split into segments of equal length.
42 public static class SplitMarker
extends SubMarker
{
44 private final String fLabel
;
45 private final String fId
;
46 private final Range
<Long
> fRange
;
47 private final RangeSet
<Long
> fIndexRange
;
65 public SplitMarker(String name
, String label
, String id
, String color
, Range
<Long
> range
, RangeSet
<Long
> indexRange
) {
70 fIndexRange
= indexRange
;
76 public String
getLabel() {
83 public String
getId() {
90 public Range
<Long
> getRange() {
95 * @return the index range
97 public RangeSet
<Long
> getIndexRange() {
103 * Subclass for a sub-marker divided into segments of specified weighted lengths.
106 public static class WeightedMarker
extends SubMarker
{
108 private final List
<MarkerSegment
> fSegments
;
109 private long fTotalLength
= 0;
117 public WeightedMarker(String name
) {
119 fSegments
= new ArrayList
<>();
123 * @return the segments
125 public List
<MarkerSegment
> getSegments() {
135 public void addSegment(MarkerSegment segment
) {
136 fSegments
.add(segment
);
137 fTotalLength
+= segment
.getLength();
141 * Get the total length of all segments
143 * @return the total length
145 public long getTotalLength() {
This page took 0.036223 seconds and 5 git commands to generate.