2 This file is to define ModuleIdentification class.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 package org
.tianocore
.build
.id
;
19 This class is used to identify a module with Module Guid, Module Version,
20 Package Guid, Package Version.
24 public class ModuleIdentification
extends Identification
{
26 private PackageIdentification packageId
;
30 private String moduleType
;
32 private boolean isLibrary
= false;
34 private boolean isBinary
= false;
36 private String constructor
= "";
38 private String destructor
= "";
42 @param version Version
44 public ModuleIdentification(String guid
, String version
){
50 @param version Version
51 @param packageId Package Identification
53 public ModuleIdentification(String guid
, String version
, PackageIdentification packageId
){
55 this.packageId
= packageId
;
61 @param version Version
63 public ModuleIdentification(String name
, String guid
, String version
){
64 super(name
, guid
, version
);
70 @param version Version
71 @param packageId PackageIdentification
73 public ModuleIdentification(String name
, String guid
, String version
, PackageIdentification packageId
){
74 super(name
, guid
, version
);
75 this.packageId
= packageId
;
79 @return boolean is this module is library
81 public boolean isLibrary() {
88 public void setLibrary(boolean isLibrary
) {
89 this.isLibrary
= isLibrary
;
93 @return boolean is this module is binary
95 public boolean isBinary() {
102 public void setBinary(boolean isBinary
) {
103 this.isBinary
= isBinary
;
109 public File
getMsaFile() {
114 @return Module relative path to package
116 public String
getModuleRelativePath() {
117 if (msaFile
.getParent().length() == packageId
.getPackageDir().length()) {
120 return msaFile
.getParent().substring(packageId
.getPackageDir().length() + 1);
124 @param msaFile Set Msa File
126 public void setMsaFile(File msaFile
) {
127 this.msaFile
= msaFile
;
130 public boolean equals(Object obj
) {
131 if (obj
instanceof ModuleIdentification
) {
132 ModuleIdentification id
= (ModuleIdentification
)obj
;
133 if (guid
.equalsIgnoreCase(id
.getGuid()) && packageId
.equals(id
.getPackage())) {
134 if (version
== null || id
.version
== null) {
137 else if (version
.trim().equalsIgnoreCase("") || id
.version
.trim().equalsIgnoreCase("")){
140 else if (version
.equalsIgnoreCase(id
.version
)) {
147 return super.equals(obj
);
151 public String
toString() {
153 String versionString
;
154 String packageString
;
156 if (name
!= null && name
!= "") {
159 if (guid
!= null && guid
!= "") {
162 nameString
= "UNKNOWN";
166 if (version
!= null) {
167 versionString
= version
;
172 if (packageId
!= null) {
173 packageString
= packageId
.toString();
175 packageString
= "Package [UNKNOWN]";
178 return "Module [" + nameString
+ versionString
+ "] in " + packageString
;
182 @param packageId set package identification
184 public void setPackage(PackageIdentification packageId
) {
185 this.packageId
= packageId
;
189 @return get package identification
191 public PackageIdentification
getPackage() {
196 @return get module type
198 public String
getModuleType() {
203 @param moduleType set module type
205 public void setModuleType(String moduleType
) {
206 this.moduleType
= moduleType
;
210 @return String The module name
212 public String
getName() {
219 public boolean hasConstructor() {
220 return constructor
!= "";
226 public boolean hasDestructor() {
227 return destructor
!= "";
231 Set the constructor function name if this module is a library
235 public void setConstructor(String name
) {
242 Set the destructor function name if this module is a library
246 public void setDestructor(String name
) {