1 /**********************************************************************
2 * Copyright (c) 2013, 2014 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 * Bernd Hufmann - Initial API and implementation
11 * Jonathan Rajotte - Machine interface support and new information
12 **********************************************************************/
14 package org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.service
;
16 import org
.eclipse
.jdt
.annotation
.NonNull
;
17 import org
.osgi
.framework
.Version
;
20 * A version implementation with a special compareTo implementation to bypass
21 * problems of older implementation of org.osgi.framework.Version.
23 * @author Bernd Hufmann
25 public class LttngVersion
extends Version
{
28 public static final @NonNull LttngVersion NULL_VERSION
= new LttngVersion(Version
.emptyVersion
.toString());
30 private final String fLicense
;
31 private final String fCommit
;
32 private final String fName
;
33 private final String fDescription
;
34 private final String fUrl
;
35 private final String fFullVersion
;
43 public LttngVersion(String version
) {
45 fLicense
= ""; //$NON-NLS-1$
46 fCommit
= ""; //$NON-NLS-1$
47 fName
= ""; //$NON-NLS-1$
48 fDescription
= ""; //$NON-NLS-1$
49 fUrl
= ""; //$NON-NLS-1$
50 fFullVersion
= ""; //$NON-NLS-1$
55 * major version number
57 * minor version number
59 * micro version number
61 * licence text of LTTng
63 * current git commit information about LTTng
67 * description of the version
71 * complete string representation of the version
73 public LttngVersion(int major
, int minor
, int micro
, String license
, String commit
, String name
, String description
, String url
, String fullVersion
) {
74 super(major
, minor
, micro
);
78 fDescription
= description
;
80 fFullVersion
= fullVersion
;
84 * Special compareTo method to fix problem of older implementations of
85 * org.osgi.framework.Version where {@code Version.compareTo} takes an
86 * {@code Object} instead a {@code Version} as argument.
89 * - Other version to compare
90 * @return a negative integer, zero, or a positive integer if this version
91 * is less than, equal to, or greater than the specified
92 * {@code LttngVersion} object.
94 public int compareTo(LttngVersion other
) {
95 if (other
== this) { // quicktest
98 int result
= getMajor() - other
.getMajor();
103 result
= getMinor() - other
.getMinor();
108 result
= getMicro() - other
.getMicro();
112 return getQualifier().compareTo(other
.getQualifier());
116 * @return String representing the lttng license
118 public String
getLicense() {
123 * @return commit id of lttng
125 public String
getCommit() {
130 * @return name of lttng version
132 public String
getName() {
137 * @return full description of lttng
139 public String
getDescription() {
144 * @return url of lttng
146 public String
getUrl() {
151 * @return the full_version
153 public String
getFullVersion() {