Lines 13-18
Link Here
|
13 |
import java.util.ArrayList; |
13 |
import java.util.ArrayList; |
14 |
import java.util.StringTokenizer; |
14 |
import java.util.StringTokenizer; |
15 |
|
15 |
|
|
|
16 |
import org.osgi.framework.Version; |
17 |
|
16 |
public class VersionedIdentifier { |
18 |
public class VersionedIdentifier { |
17 |
private String identifier = ""; //$NON-NLS-1$ |
19 |
private String identifier = ""; //$NON-NLS-1$ |
18 |
private int major = 0; |
20 |
private int major = 0; |
Lines 22-52
Link Here
|
22 |
private String version; |
24 |
private String version; |
23 |
|
25 |
|
24 |
private static final String VER_SEPARATOR = "."; //$NON-NLS-1$ |
26 |
private static final String VER_SEPARATOR = "."; //$NON-NLS-1$ |
25 |
private static final String ID_SEPARATOR = "_"; //$NON-NLS-1$ |
|
|
26 |
|
27 |
|
27 |
public static final int LESS_THAN = -1; |
28 |
public static final int LESS_THAN = -1; |
28 |
public static final int EQUAL = 0; |
29 |
public static final int EQUAL = 0; |
29 |
public static final int EQUIVALENT = 1; |
30 |
public static final int EQUIVALENT = 1; |
30 |
public static final int COMPATIBLE = 2; |
31 |
public static final int COMPATIBLE = 2; |
31 |
public static final int GREATER_THAN = 3; |
32 |
public static final int GREATER_THAN = 3; |
32 |
|
|
|
33 |
public VersionedIdentifier(String s) { |
34 |
if (s == null || (s = s.trim()).equals("")) //$NON-NLS-1$ |
35 |
return; |
36 |
|
37 |
int loc = s.lastIndexOf(ID_SEPARATOR); |
38 |
if (loc != -1) { |
39 |
this.identifier = s.substring(0, loc); |
40 |
version = s.substring(loc + 1); |
41 |
if(version==null) |
42 |
version = "0.0.0"; //$NON-NLS-1$ |
43 |
parseVersion(version); |
44 |
} else |
45 |
this.identifier = s; |
46 |
} |
47 |
|
33 |
|
48 |
public VersionedIdentifier(String id, String version) { |
34 |
public VersionedIdentifier(String id, String version) { |
49 |
this(id+ID_SEPARATOR+ (version==null?"0.0.0":version) ); //$NON-NLS-1$ |
35 |
this.identifier = id; |
50 |
this.version = version; |
36 |
this.version = version; |
51 |
} |
37 |
} |
52 |
|
38 |
|