]>
Commit | Line | Data |
---|---|---|
79cb6fdb | 1 | /** @file\r |
2 | \r | |
3 | The file is used to save basic information\r | |
4 | \r | |
5 | Copyright (c) 2006, Intel Corporation\r | |
6 | All rights reserved. This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | package org.tianocore.frameworkwizard.common.Identifications;\r | |
17 | \r | |
18 | public class Identification {\r | |
19 | \r | |
2003a22e | 20 | ///\r |
21 | /// Define class members\r | |
22 | ///\r | |
79cb6fdb | 23 | private String name;\r |
2003a22e | 24 | \r |
79cb6fdb | 25 | private String guid;\r |
2003a22e | 26 | \r |
79cb6fdb | 27 | private String version;\r |
2003a22e | 28 | \r |
79cb6fdb | 29 | private String path;\r |
2003a22e | 30 | \r |
79cb6fdb | 31 | public Identification(String name, String guid, String version) {\r |
32 | this.name = name;\r | |
33 | this.guid = guid;\r | |
34 | this.version = version;\r | |
35 | }\r | |
2003a22e | 36 | \r |
79cb6fdb | 37 | public Identification() {\r |
2003a22e | 38 | \r |
79cb6fdb | 39 | }\r |
2003a22e | 40 | \r |
79cb6fdb | 41 | public Identification(String name, String guid, String version, String path) {\r |
2003a22e | 42 | this.name = name;\r |
79cb6fdb | 43 | this.guid = guid;\r |
44 | this.version = version;\r | |
45 | this.path = path;\r | |
46 | }\r | |
2003a22e | 47 | \r |
79cb6fdb | 48 | public boolean equals(Object obj) {\r |
2003a22e | 49 | if (obj instanceof Identification) {\r |
50 | Identification id = (Identification) obj;\r | |
51 | if (path.equals(id.path)) {\r | |
2003a22e | 52 | return true;\r |
53 | }\r | |
54 | return false;\r | |
55 | } else {\r | |
56 | return super.equals(obj);\r | |
57 | }\r | |
58 | }\r | |
59 | \r | |
5a24e806 | 60 | public boolean equalsWithGuid(Object obj) {\r |
2003a22e | 61 | if (obj instanceof Identification) {\r |
62 | Identification id = (Identification) obj;\r | |
63 | if (guid.equalsIgnoreCase(id.guid)) {\r | |
64 | if (version == null || id.version == null) {\r | |
65 | return true;\r | |
66 | } else if (version.trim().equalsIgnoreCase("") || id.version.trim().equalsIgnoreCase("")) {\r | |
67 | return true;\r | |
68 | } else if (version.equalsIgnoreCase(id.version)) {\r | |
69 | return true;\r | |
70 | }\r | |
71 | }\r | |
72 | return false;\r | |
73 | } else {\r | |
74 | return super.equals(obj);\r | |
75 | }\r | |
76 | }\r | |
77 | \r | |
79cb6fdb | 78 | public void setName(String name) {\r |
79 | this.name = name;\r | |
80 | }\r | |
81 | \r | |
82 | public void setGuid(String guid) {\r | |
83 | this.guid = guid;\r | |
84 | }\r | |
85 | \r | |
86 | public void setVersion(String version) {\r | |
87 | this.version = version;\r | |
88 | }\r | |
2003a22e | 89 | \r |
90 | public void setPath(String path) {\r | |
91 | this.path = path;\r | |
92 | }\r | |
79cb6fdb | 93 | \r |
94 | public String getGuid() {\r | |
95 | return guid;\r | |
96 | }\r | |
97 | \r | |
98 | public String getName() {\r | |
99 | return name;\r | |
100 | }\r | |
101 | \r | |
102 | public String getVersion() {\r | |
103 | return version;\r | |
104 | }\r | |
105 | \r | |
2003a22e | 106 | public String getPath() {\r |
107 | return path;\r | |
108 | }\r | |
109 | \r | |
110 | public int hashCode() {\r | |
111 | return guid.toLowerCase().hashCode();\r | |
112 | }\r | |
79cb6fdb | 113 | }\r |