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
;
18 import org
.tianocore
.build
.global
.GlobalData
;
20 public class ModuleIdentification
extends Identification
{
22 private PackageIdentification packageId
;
26 private String moduleType
;
28 private boolean isLibrary
= false;
30 public ModuleIdentification(String guid
, String version
){
34 public ModuleIdentification(String guid
, String version
, PackageIdentification packageId
){
36 this.packageId
= packageId
;
39 public ModuleIdentification(String name
, String guid
, String version
){
40 super(name
, guid
, version
);
43 public ModuleIdentification(String name
, String guid
, String version
, PackageIdentification packageId
){
44 super(name
, guid
, version
);
45 this.packageId
= packageId
;
48 public boolean isLibrary() {
52 public void setLibrary(boolean isLibrary
) {
53 this.isLibrary
= isLibrary
;
56 public File
getMsaFile() {
61 public String
getModuleRelativePath() {
63 if (msaFile
.getParent().length() == packageId
.getPackageDir().length()) {
66 return msaFile
.getParent().substring(packageId
.getPackageDir().length() + 1);
69 private void prepareMsaFile(){
70 if (msaFile
== null) {
71 GlobalData
.refreshModuleIdentification(this);
75 public void setMsaFile(File msaFile
) {
76 this.msaFile
= msaFile
;
79 public boolean equals(Object obj
) {
80 if (obj
instanceof ModuleIdentification
) {
81 ModuleIdentification id
= (ModuleIdentification
)obj
;
82 if (guid
.equalsIgnoreCase(id
.getGuid()) && packageId
.equals(id
.getPackage())) {
83 if (version
== null || id
.version
== null) {
86 else if (version
.trim().equalsIgnoreCase("") || id
.version
.trim().equalsIgnoreCase("")){
89 else if (version
.equalsIgnoreCase(id
.version
)) {
96 return super.equals(obj
);
100 public String
toString(){
102 GlobalData
.refreshModuleIdentification(this);
104 if (version
== null || version
.trim().equalsIgnoreCase("")) {
105 return "Module [" + name
+ "] in " + packageId
;
108 return "Module [" + name
+ " " + version
+ "] in " + packageId
;
112 public void setPackage(PackageIdentification packageId
) {
113 this.packageId
= packageId
;
116 public PackageIdentification
getPackage() {
120 public String
getModuleType() {
121 if (moduleType
== null) {
122 GlobalData
.refreshModuleIdentification(this);
127 public void setModuleType(String moduleType
) {
128 this.moduleType
= moduleType
;
131 public String
getName() {
133 GlobalData
.refreshModuleIdentification(this);