ctf: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / org.eclipse.tracecompass.lttng2.control.ui / src / org / eclipse / tracecompass / internal / lttng2 / control / ui / views / service / LttngVersion.java
CommitLineData
3f1e748c 1/**********************************************************************
0df4af5f 2 * Copyright (c) 2013, 2014 Ericsson
3f1e748c
BH
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 * Contributors:
10 * Bernd Hufmann - Initial API and implementation
0df4af5f 11 * Jonathan Rajotte - Machine interface support and new information
3f1e748c 12 **********************************************************************/
0df4af5f 13
9bc60be7 14package org.eclipse.tracecompass.internal.lttng2.control.ui.views.service;
3f1e748c 15
364dcfaf 16import org.eclipse.jdt.annotation.NonNull;
3f1e748c
BH
17import org.osgi.framework.Version;
18
19/**
0df4af5f
JRJ
20 * A version implementation with a special compareTo implementation to bypass
21 * problems of older implementation of org.osgi.framework.Version.
3f1e748c
BH
22 *
23 * @author Bernd Hufmann
24 */
25public class LttngVersion extends Version {
26
364dcfaf
BH
27 /** A null version */
28 public static final @NonNull LttngVersion NULL_VERSION = new LttngVersion(Version.emptyVersion.toString());
29
0df4af5f
JRJ
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;
36
3f1e748c
BH
37 /**
38 * Constructor
39 *
40 * @param version
0df4af5f 41 * The version string
3f1e748c
BH
42 */
43 public LttngVersion(String version) {
44 super(version);
0df4af5f
JRJ
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$
51 }
52
53 /**
54 * @param major
55 * major version number
56 * @param minor
57 * minor version number
58 * @param micro
59 * micro version number
60 * @param license
61 * licence text of LTTng
62 * @param commit
63 * current git commit information about LTTng
64 * @param name
65 * name of the version
66 * @param description
67 * description of the version
68 * @param url
69 * url to website
70 * @param fullVersion
71 * complete string representation of the version
72 */
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);
75 fLicense = license;
76 fCommit = commit;
77 fName = name;
78 fDescription = description;
79 fUrl = url;
80 fFullVersion = fullVersion;
3f1e748c
BH
81 }
82
83 /**
0df4af5f
JRJ
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.
3f1e748c
BH
87 *
88 * @param other
0df4af5f 89 * - Other version to compare
3f1e748c
BH
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.
93 */
94 public int compareTo(LttngVersion other) {
95 if (other == this) { // quicktest
96 return 0;
97 }
3f1e748c
BH
98 int result = getMajor() - other.getMajor();
99 if (result != 0) {
100 return result;
101 }
102
103 result = getMinor() - other.getMinor();
104 if (result != 0) {
105 return result;
106 }
107
108 result = getMicro() - other.getMicro();
109 if (result != 0) {
110 return result;
111 }
112 return getQualifier().compareTo(other.getQualifier());
113 }
0df4af5f
JRJ
114
115 /**
116 * @return String representing the lttng license
117 */
118 public String getLicense() {
119 return fLicense;
120 }
121
122 /**
123 * @return commit id of lttng
124 */
125 public String getCommit() {
126 return fCommit;
127 }
128
129 /**
130 * @return name of lttng version
131 */
132 public String getName() {
133 return fName;
134 }
135
136 /**
137 * @return full description of lttng
138 */
139 public String getDescription() {
140 return fDescription;
141 }
142
143 /**
144 * @return url of lttng
145 */
146 public String getUrl() {
147 return fUrl;
148 }
149
150 /**
151 * @return the full_version
152 */
153 public String getFullVersion() {
154 return fFullVersion;
155 }
3f1e748c 156}
This page took 0.061505 seconds and 5 git commands to generate.