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 String constructor
= "";
36 private String destructor
= "";
40 @param version Version
42 public ModuleIdentification(String guid
, String version
){
48 @param version Version
49 @param packageId Package Identification
51 public ModuleIdentification(String guid
, String version
, PackageIdentification packageId
){
53 this.packageId
= packageId
;
59 @param version Version
61 public ModuleIdentification(String name
, String guid
, String version
){
62 super(name
, guid
, version
);
68 @param version Version
69 @param packageId PackageIdentification
71 public ModuleIdentification(String name
, String guid
, String version
, PackageIdentification packageId
){
72 super(name
, guid
, version
);
73 this.packageId
= packageId
;
77 @return boolean is this module is library
79 public boolean isLibrary() {
86 public void setLibrary(boolean isLibrary
) {
87 this.isLibrary
= isLibrary
;
93 public File
getMsaFile() {
98 @return Module relative path to package
100 public String
getModuleRelativePath() {
101 if (msaFile
.getParent().length() == packageId
.getPackageDir().length()) {
104 return msaFile
.getParent().substring(packageId
.getPackageDir().length() + 1);
108 @param msaFile Set Msa File
110 public void setMsaFile(File msaFile
) {
111 this.msaFile
= msaFile
;
114 public boolean equals(Object obj
) {
115 if (obj
instanceof ModuleIdentification
) {
116 ModuleIdentification id
= (ModuleIdentification
)obj
;
117 if (guid
.equalsIgnoreCase(id
.getGuid()) && packageId
.equals(id
.getPackage())) {
118 if (version
== null || id
.version
== null) {
121 else if (version
.trim().equalsIgnoreCase("") || id
.version
.trim().equalsIgnoreCase("")){
124 else if (version
.equalsIgnoreCase(id
.version
)) {
131 return super.equals(obj
);
135 public String
toString() {
137 String versionString
;
138 String packageString
;
140 if (name
!= null && name
!= "") {
143 if (guid
!= null && guid
!= "") {
146 nameString
= "UNKNOWN";
150 if (version
!= null) {
151 versionString
= version
;
156 if (packageId
!= null) {
157 packageString
= packageId
.toString();
159 packageString
= "Package [UNKNOWN]";
162 return "Module [" + nameString
+ versionString
+ "] in " + packageString
;
166 @param packageId set package identification
168 public void setPackage(PackageIdentification packageId
) {
169 this.packageId
= packageId
;
173 @return get package identification
175 public PackageIdentification
getPackage() {
180 @return get module type
182 public String
getModuleType() {
187 @param moduleType set module type
189 public void setModuleType(String moduleType
) {
190 this.moduleType
= moduleType
;
193 public String
getName() {
197 public boolean hasConstructor() {
198 return constructor
!= "";
201 public boolean hasDestructor() {
202 return destructor
!= "";
205 public void setConstructor(String name
) {
211 public void setDestructor(String name
) {