tmf: Bug 460842: Introduce tmf remote plug-ins and feature
[deliverable/tracecompass.git] / org.eclipse.tracecompass.lttng2.control.ui / src / org / eclipse / tracecompass / internal / lttng2 / control / ui / views / service / LttngVersion.java
1 /**********************************************************************
2 * Copyright (c) 2013, 2014 Ericsson
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
11 * Jonathan Rajotte - Machine interface support and new information
12 **********************************************************************/
13
14 package org.eclipse.tracecompass.internal.lttng2.control.ui.views.service;
15
16 import org.osgi.framework.Version;
17
18 /**
19 * A version implementation with a special compareTo implementation to bypass
20 * problems of older implementation of org.osgi.framework.Version.
21 *
22 * @author Bernd Hufmann
23 */
24 public class LttngVersion extends Version {
25
26 private final String fLicense;
27 private final String fCommit;
28 private final String fName;
29 private final String fDescription;
30 private final String fUrl;
31 private final String fFullVersion;
32
33 /**
34 * Constructor
35 *
36 * @param version
37 * The version string
38 */
39 public LttngVersion(String version) {
40 super(version);
41 fLicense = ""; //$NON-NLS-1$
42 fCommit = ""; //$NON-NLS-1$
43 fName = ""; //$NON-NLS-1$
44 fDescription = ""; //$NON-NLS-1$
45 fUrl = ""; //$NON-NLS-1$
46 fFullVersion = ""; //$NON-NLS-1$
47 }
48
49 /**
50 * @param major
51 * major version number
52 * @param minor
53 * minor version number
54 * @param micro
55 * micro version number
56 * @param license
57 * licence text of LTTng
58 * @param commit
59 * current git commit information about LTTng
60 * @param name
61 * name of the version
62 * @param description
63 * description of the version
64 * @param url
65 * url to website
66 * @param fullVersion
67 * complete string representation of the version
68 */
69 public LttngVersion(int major, int minor, int micro, String license, String commit, String name, String description, String url, String fullVersion) {
70 super(major, minor, micro);
71 fLicense = license;
72 fCommit = commit;
73 fName = name;
74 fDescription = description;
75 fUrl = url;
76 fFullVersion = fullVersion;
77 }
78
79 /**
80 * Special compareTo method to fix problem of older implementations of
81 * org.osgi.framework.Version where {@code Version.compareTo} takes an
82 * {@code Object} instead a {@code Version} as argument.
83 *
84 * @param other
85 * - Other version to compare
86 * @return a negative integer, zero, or a positive integer if this version
87 * is less than, equal to, or greater than the specified
88 * {@code LttngVersion} object.
89 */
90 public int compareTo(LttngVersion other) {
91 if (other == this) { // quicktest
92 return 0;
93 }
94 int result = getMajor() - other.getMajor();
95 if (result != 0) {
96 return result;
97 }
98
99 result = getMinor() - other.getMinor();
100 if (result != 0) {
101 return result;
102 }
103
104 result = getMicro() - other.getMicro();
105 if (result != 0) {
106 return result;
107 }
108 return getQualifier().compareTo(other.getQualifier());
109 }
110
111 /**
112 * @return String representing the lttng license
113 */
114 public String getLicense() {
115 return fLicense;
116 }
117
118 /**
119 * @return commit id of lttng
120 */
121 public String getCommit() {
122 return fCommit;
123 }
124
125 /**
126 * @return name of lttng version
127 */
128 public String getName() {
129 return fName;
130 }
131
132 /**
133 * @return full description of lttng
134 */
135 public String getDescription() {
136 return fDescription;
137 }
138
139 /**
140 * @return url of lttng
141 */
142 public String getUrl() {
143 return fUrl;
144 }
145
146 /**
147 * @return the full_version
148 */
149 public String getFullVersion() {
150 return fFullVersion;
151 }
152 }
This page took 0.03444 seconds and 5 git commands to generate.