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;
36 @param version Version
38 public ModuleIdentification(String guid
, String version
){
44 @param version Version
45 @param packageId Package Identification
47 public ModuleIdentification(String guid
, String version
, PackageIdentification packageId
){
49 this.packageId
= packageId
;
55 @param version Version
57 public ModuleIdentification(String name
, String guid
, String version
){
58 super(name
, guid
, version
);
64 @param version Version
65 @param packageId PackageIdentification
67 public ModuleIdentification(String name
, String guid
, String version
, PackageIdentification packageId
){
68 super(name
, guid
, version
);
69 this.packageId
= packageId
;
73 @return boolean is this module is library
75 public boolean isLibrary() {
82 public void setLibrary(boolean isLibrary
) {
83 this.isLibrary
= isLibrary
;
89 public File
getMsaFile() {
94 @return Module relative path to package
96 public String
getModuleRelativePath() {
97 if (msaFile
.getParent().length() == packageId
.getPackageDir().length()) {
100 return msaFile
.getParent().substring(packageId
.getPackageDir().length() + 1);
104 @param msaFile Set Msa File
106 public void setMsaFile(File msaFile
) {
107 this.msaFile
= msaFile
;
110 public boolean equals(Object obj
) {
111 if (obj
instanceof ModuleIdentification
) {
112 ModuleIdentification id
= (ModuleIdentification
)obj
;
113 if (guid
.equalsIgnoreCase(id
.getGuid()) && packageId
.equals(id
.getPackage())) {
114 if (version
== null || id
.version
== null) {
117 else if (version
.trim().equalsIgnoreCase("") || id
.version
.trim().equalsIgnoreCase("")){
120 else if (version
.equalsIgnoreCase(id
.version
)) {
127 return super.equals(obj
);
131 public String
toString() {
132 if (version
== null || version
.trim().equalsIgnoreCase("")) {
133 return "Module [" + name
+ "] in " + packageId
;
136 return "Module [" + name
+ " " + version
+ "] in " + packageId
;
141 @param packageId set package identification
143 public void setPackage(PackageIdentification packageId
) {
144 this.packageId
= packageId
;
148 @return get package identification
150 public PackageIdentification
getPackage() {
155 @return get module type
157 public String
getModuleType() {
162 @param moduleType set module type
164 public void setModuleType(String moduleType
) {
165 this.moduleType
= moduleType
;
168 public String
getName() {