]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/GenBuild/org/tianocore/build/id/Identification.java
8315358b2f3e130e393f8a5ed58f288b467280a8
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / id / Identification.java
1 /** @file
2 This file is to define Identification class.
3
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
9
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.
12 **/
13
14 package org.tianocore.build.id;
15
16 import org.tianocore.build.global.GlobalData;
17
18 public class Identification {
19
20 String name;
21
22 String guid;
23
24 String version;
25
26 String type; // Optional
27
28 Identification(String name, String guid, String version){
29 this.name = name;
30 this.guid = guid;
31 this.version = version;
32 }
33
34 Identification(String guid, String version){
35 this.guid = guid;
36 this.version = version;
37 }
38
39 public boolean equals(Object obj) {
40 if (obj instanceof Identification) {
41 Identification id = (Identification)obj;
42 if ( guid.equalsIgnoreCase(id.guid)) {
43 if (version == null || id.version == null) {
44 return true;
45 }
46 else if (version.trim().equalsIgnoreCase("") || id.version.trim().equalsIgnoreCase("")){
47 return true;
48 }
49 else if (version.equalsIgnoreCase(id.version)) {
50 return true;
51 }
52 }
53 return false;
54 }
55 else {
56 return super.equals(obj);
57 }
58 }
59
60 public void setName(String name) {
61 this.name = name;
62 }
63
64 public void setGuid(String guid) {
65 this.guid = guid;
66 }
67
68 public void setVersion(String version) {
69 this.version = version;
70 }
71
72 public String getGuid() {
73 return guid;
74 }
75
76 public String getName() {
77 return name;
78 }
79
80 public String getVersion() {
81 return version;
82 }
83
84 public int hashCode(){
85 return guid.toLowerCase().hashCode();
86 }
87 }