878ddf1f |
1 | /** @file\r |
2 | Java class FpdModuleIdentification is used to present a module identification\r |
3 | from BaseName, GUID, Version, PackageName, and ARCH. \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 |
a29c47e0 |
14 | package org.tianocore.build.id;\r |
15 | \r |
878ddf1f |
16 | \r |
17 | /**\r |
01413f0c |
18 | This class is used to identify a module with Module Guid, Module Version, \r |
19 | Package Guid, Package Version and Arch. \r |
878ddf1f |
20 | \r |
21 | @since GenBuild 1.0\r |
01413f0c |
22 | **/\r |
878ddf1f |
23 | public class FpdModuleIdentification {\r |
24 | \r |
25 | private String arch;\r |
26 | \r |
a29c47e0 |
27 | private String fvBinding = "NULL"; // Optional\r |
878ddf1f |
28 | \r |
a29c47e0 |
29 | private ModuleIdentification module;\r |
878ddf1f |
30 | \r |
01413f0c |
31 | /**\r |
32 | Constructor Method. \r |
33 | \r |
34 | @param arch Build Arch\r |
35 | @param fvBinding Belong to what FVs\r |
36 | @param module ModuleIdentification\r |
37 | **/\r |
38 | public FpdModuleIdentification(String arch, String fvBinding, ModuleIdentification module){\r |
878ddf1f |
39 | this.arch = arch;\r |
a29c47e0 |
40 | this.fvBinding = fvBinding;\r |
a29c47e0 |
41 | this.module = module;\r |
878ddf1f |
42 | }\r |
43 | \r |
01413f0c |
44 | /**\r |
45 | Constructor Method. \r |
46 | \r |
47 | @param arch Build Arch\r |
48 | @param module ModuleIdentification\r |
49 | **/\r |
a29c47e0 |
50 | public FpdModuleIdentification(ModuleIdentification module, String arch){\r |
51 | this.arch = arch;\r |
52 | this.module = module;\r |
53 | }\r |
878ddf1f |
54 | /**\r |
55 | Override java.lang.Object#equals. \r |
56 | \r |
57 | <p>Currently, use BaseName and ARCH to identify a module. It will enhance\r |
58 | in the next version. </p>\r |
59 | \r |
60 | @see java.lang.Object#equals(java.lang.Object)\r |
61 | **/\r |
62 | public boolean equals(Object obj) {\r |
63 | if (obj instanceof FpdModuleIdentification) {\r |
64 | FpdModuleIdentification moduleIdObj = (FpdModuleIdentification)obj;\r |
a29c47e0 |
65 | if ( module.equals(moduleIdObj.module) && arch.equalsIgnoreCase(moduleIdObj.arch)) {\r |
878ddf1f |
66 | return true;\r |
67 | }\r |
878ddf1f |
68 | return false;\r |
69 | }\r |
70 | else {\r |
a29c47e0 |
71 | return false;\r |
878ddf1f |
72 | }\r |
73 | }\r |
878ddf1f |
74 | \r |
01413f0c |
75 | /**\r |
76 | @param fvBinding\r |
77 | **/\r |
878ddf1f |
78 | public void setFvBinding(String fvBinding) {\r |
79 | this.fvBinding = fvBinding;\r |
80 | }\r |
81 | \r |
01413f0c |
82 | /* (non-Javadoc)\r |
83 | @see java.lang.Object#toString()\r |
84 | **/\r |
878ddf1f |
85 | public String toString(){\r |
a29c47e0 |
86 | return arch + ":" + module;\r |
878ddf1f |
87 | }\r |
88 | \r |
01413f0c |
89 | /**\r |
90 | @return String fvBinding\r |
91 | **/\r |
a29c47e0 |
92 | public String getFvBinding() {\r |
93 | return fvBinding;\r |
878ddf1f |
94 | }\r |
95 | \r |
01413f0c |
96 | /**\r |
97 | @return ModuleIdentification module ID\r |
98 | **/\r |
a29c47e0 |
99 | public ModuleIdentification getModule() {\r |
100 | return module;\r |
878ddf1f |
101 | }\r |
102 | \r |
01413f0c |
103 | /**\r |
104 | @param module Module Identification\r |
105 | **/\r |
a29c47e0 |
106 | public void setModule(ModuleIdentification module) {\r |
107 | this.module = module;\r |
878ddf1f |
108 | }\r |
109 | \r |
01413f0c |
110 | /**\r |
111 | @return String arch\r |
112 | **/\r |
878ddf1f |
113 | public String getArch() {\r |
114 | return arch;\r |
115 | }\r |
116 | \r |
01413f0c |
117 | /**\r |
118 | @param arch build ARCH\r |
119 | **/\r |
a29c47e0 |
120 | public void setArch(String arch) {\r |
121 | this.arch = arch;\r |
878ddf1f |
122 | }\r |
a29c47e0 |
123 | \r |
01413f0c |
124 | /* (non-Javadoc)\r |
125 | @see java.lang.Object#hashCode()\r |
126 | **/\r |
a29c47e0 |
127 | public int hashCode(){\r |
128 | return module.hashCode();\r |
878ddf1f |
129 | }\r |
130 | }\r |