author | dadubrow |
Wed, 25 Aug 2010 15:37:23 -0500 | |
changeset 1885 | 988b4ab1b8c1 |
parent 1884 | 94c9fe3693ea |
permissions | -rw-r--r-- |
1810 | 1 |
/* |
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: |
|
15 |
* |
|
16 |
*/ |
|
17 |
package com.nokia.carbide.internal.discovery.ui.wizard; |
|
18 |
||
19 |
import org.eclipse.equinox.p2.metadata.IInstallableUnit; |
|
20 |
import org.eclipse.equinox.p2.metadata.Version; |
|
21 |
||
22 |
class FeatureInfo { |
|
23 |
private String id; |
|
24 |
private Version version; |
|
25 |
||
26 |
public FeatureInfo(IInstallableUnit iu) { |
|
27 |
this(iu.getId(), iu.getVersion()); |
|
28 |
} |
|
29 |
||
30 |
public FeatureInfo(String id, Version version) { |
|
31 |
this.id = id; |
|
32 |
this.version = version; |
|
33 |
} |
|
34 |
||
35 |
public String getId() { |
|
36 |
return id; |
|
37 |
} |
|
38 |
||
39 |
public Version getVersion() { |
|
40 |
return version; |
|
41 |
} |
|
42 |
||
43 |
@Override |
|
44 |
public int hashCode() { |
|
45 |
final int prime = 31; |
|
46 |
int result = 1; |
|
47 |
result = prime * result + ((id == null) ? 0 : id.hashCode()); |
|
48 |
result = prime * result + ((version == null) ? 0 : version.toString().hashCode()); |
|
49 |
return result; |
|
50 |
} |
|
51 |
||
52 |
@Override |
|
53 |
public boolean equals(Object obj) { |
|
54 |
if (this == obj) |
|
55 |
return true; |
|
56 |
if (obj == null) |
|
57 |
return false; |
|
58 |
if (getClass() != obj.getClass()) |
|
59 |
return false; |
|
60 |
FeatureInfo other = (FeatureInfo) obj; |
|
61 |
if (id == null) { |
|
62 |
if (other.id != null) |
|
63 |
return false; |
|
64 |
} else if (!id.equals(other.id)) |
|
65 |
return false; |
|
66 |
if (version == null) { |
|
67 |
if (other.version != null) |
|
68 |
return false; |
|
69 |
} else if (!version.toString().equals(other.version.toString())) |
|
70 |
return false; |
|
71 |
return true; |
|
72 |
} |
|
1884
94c9fe3693ea
Filter initial features from export wizard + sort wizards by feature id + version
dadubrow
parents:
1810
diff
changeset
|
73 |
|
94c9fe3693ea
Filter initial features from export wizard + sort wizards by feature id + version
dadubrow
parents:
1810
diff
changeset
|
74 |
@Override |
94c9fe3693ea
Filter initial features from export wizard + sort wizards by feature id + version
dadubrow
parents:
1810
diff
changeset
|
75 |
public String toString() { |
1885 | 76 |
return getId() + " " + getVersion().toString(); //$NON-NLS-1$ |
1884
94c9fe3693ea
Filter initial features from export wizard + sort wizards by feature id + version
dadubrow
parents:
1810
diff
changeset
|
77 |
} |
1810 | 78 |
} |