]>
Commit | Line | Data |
---|---|---|
5f42a4ba | 1 | /** @file\r |
2 | This file is to define Identification class.\r | |
3 | \r | |
4 | Copyright (c) 2006, Intel Corporation\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | **/\r | |
13 | \r | |
a29c47e0 | 14 | package org.tianocore.build.id;\r |
15 | \r | |
16 | import org.tianocore.build.global.GlobalData;\r | |
17 | \r | |
18 | public class Identification {\r | |
19 | \r | |
20 | String name;\r | |
21 | \r | |
22 | String guid;\r | |
23 | \r | |
24 | String version;\r | |
25 | \r | |
26 | String type; // Optional\r | |
27 | \r | |
28 | Identification(String name, String guid, String version){\r | |
29 | this.name = name;\r | |
30 | this.guid = guid;\r | |
31 | this.version = version;\r | |
32 | }\r | |
33 | \r | |
34 | Identification(String guid, String version){\r | |
35 | this.guid = guid;\r | |
36 | this.version = version;\r | |
37 | }\r | |
38 | \r | |
39 | public boolean equals(Object obj) {\r | |
40 | if (obj instanceof Identification) {\r | |
41 | Identification id = (Identification)obj;\r | |
42 | if ( guid.equalsIgnoreCase(id.guid)) {\r | |
43 | if (version == null || id.version == null) {\r | |
44 | return true;\r | |
45 | }\r | |
46 | else if (version.trim().equalsIgnoreCase("") || id.version.trim().equalsIgnoreCase("")){\r | |
47 | return true;\r | |
48 | }\r | |
49 | else if (version.equalsIgnoreCase(id.version)) {\r | |
50 | return true;\r | |
51 | }\r | |
52 | }\r | |
53 | return false;\r | |
54 | }\r | |
55 | else {\r | |
56 | return super.equals(obj);\r | |
57 | }\r | |
58 | }\r | |
59 | \r | |
60 | public void setName(String name) {\r | |
61 | this.name = name;\r | |
62 | }\r | |
63 | \r | |
64 | public void setGuid(String guid) {\r | |
65 | this.guid = guid;\r | |
66 | }\r | |
67 | \r | |
68 | public void setVersion(String version) {\r | |
69 | this.version = version;\r | |
70 | }\r | |
71 | \r | |
72 | public String getGuid() {\r | |
73 | return guid;\r | |
74 | }\r | |
75 | \r | |
76 | public String getName() {\r | |
77 | return name;\r | |
78 | }\r | |
79 | \r | |
80 | public String getVersion() {\r | |
81 | return version;\r | |
82 | }\r | |
83 | \r | |
84 | public int hashCode(){\r | |
85 | return guid.toLowerCase().hashCode();\r | |
86 | }\r | |
87 | }\r |