6f41e48977e015f01c77c216d9ab10b91315d922
1 /*******************************************************************************
2 * Copyright (c) 2015, 2016 EfficiOS Inc., Alexandre Montplaisir
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 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.internal
.provisional
.analysis
.lami
.core
.aspect
;
12 import java
.util
.Comparator
;
14 import org
.eclipse
.jdt
.annotation
.NonNull
;
15 import org
.eclipse
.jdt
.annotation
.Nullable
;
16 import org
.eclipse
.tracecompass
.internal
.provisional
.analysis
.lami
.core
.module
.LamiTableEntry
;
17 import org
.eclipse
.tracecompass
.internal
.provisional
.analysis
.lami
.core
.types
.LamiData
;
18 import org
.eclipse
.tracecompass
.internal
.provisional
.analysis
.lami
.core
.types
.LamiInteger
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.timestamp
.TmfTimestampFormat
;
22 * Aspect for timestamps
24 * @author Alexandre Montplaisir
26 public class LamiTimestampAspect
extends LamiTableEntryAspect
{
28 private final int fColIndex
;
33 * @param timestampName
34 * Name of the timestamp
38 public LamiTimestampAspect(String timestampName
, int colIndex
) {
39 super(timestampName
, null);
44 public boolean isContinuous() {
49 public boolean isTimeStamp() {
54 public @Nullable String
resolveString(LamiTableEntry entry
) {
55 LamiData data
= entry
.getValue(fColIndex
);
56 if (data
instanceof LamiInteger
) {
57 LamiInteger range
= (LamiInteger
) data
;
58 return TmfTimestampFormat
.getDefaulTimeFormat().format(range
.getValue());
60 return data
.toString();
64 public @Nullable Double
resolveDouble(@NonNull LamiTableEntry entry
) {
65 LamiData data
= entry
.getValue(fColIndex
);
66 if (data
instanceof LamiInteger
) {
67 LamiInteger range
= (LamiInteger
) data
;
68 return Double
.valueOf(range
.getValue());
74 public Comparator
<LamiTableEntry
> getComparator() {
76 Double dO1
= resolveDouble(o1
);
77 Double dO2
= resolveDouble(o2
);
78 if (dO1
== null || dO2
== null) {
82 return dO1
.compareTo(dO2
);
This page took 0.03577 seconds and 4 git commands to generate.