Debian Codegraph @

bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/BasicVersion.java

raw
1 /*******************************************************************************
2 * Copyright (c) 2009, 2010 Cloudsmith Inc. and others.
3 *
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
8 *
9 * SPDX-License-Identifier: EPL-2.0
10 *
11 * Contributors:
12 * Cloudsmith Inc. - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.equinox.internal.p2.metadata;
15
16 import org.eclipse.equinox.p2.metadata.Version;
17
18 /**
19 * The abstract BasicVersion class adds the methods necessary to to compare and serialize
20 * versions in version ranges. The class is not intended as public API.
21 */
22 public abstract class BasicVersion extends Version {
23 private static final long serialVersionUID = -2983093417537485027L;
24
25 /**
26 * Returns the OSGi major component of this version identifier.
27 *
28 * @return The major component.
29 * @throws UnsupportedOperationException if the first element in the
30 * vector is not a number.
31 * @see #isOSGiCompatible()
32 */
33 public abstract int getMajor();
34
35 /**
36 * Returns the OSGi micro component of this version identifier.
37 *
38 * @return The micro component.
39 * @throws UnsupportedOperationException if the third element in the
40 * vector is not a number.
41 * @see #isOSGiCompatible()
42 */
43 public abstract int getMicro();
44
45 /**
46 * Returns the OSGi minor component of this version identifier.
47 *
48 * @return The minor component.
49 * @throws UnsupportedOperationException if the second element in the
50 * vector is not a number.
51 * @see #isOSGiCompatible()
52 */
53 public abstract int getMinor();
54
55 /**
56 * Returns the OSGi qualifier component of this version identifier.
57 *
58 * @return The qualifier component or <code>null</code> if not set.
59 * @throws UnsupportedOperationException if the fourth element in the
60 * vector is set to something other then a string.
61 * @see #isOSGiCompatible()
62 */
63 public abstract String getQualifier();
64
65 /**
66 * Appends the original for this version onto the <code>sb</code> StringBuffer
67 * if present.
68 * @param sb The buffer that will receive the raw string format
69 * @param rangeSafe Set to <code>true</code> if range delimiters should be escaped
70 */
71 public abstract void originalToString(StringBuffer sb, boolean rangeSafe);
72
73 /**
74 * Appends the raw format for this version onto the <code>sb</code> StringBuffer.
75 * @param sb The buffer that will receive the raw string format
76 * @param rangeSafe Set to <code>true</code> if range delimiters should be escaped
77 */
78 public abstract void rawToString(StringBuffer sb, boolean rangeSafe);
79
80 /**
81 * This method is package protected since it violates the immutable
82 * contract.
83 * @return The raw vector. Must be treated as read-only
84 */
85 abstract Comparable<?>[] getVector();
86 }