]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/Identification.java
bc296474e671382fea0dda5dbd1a632dd8f7b981
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / common / Identifications / Identification.java
1 /** @file
2
3 The file is used to save basic information
4
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 package org.tianocore.frameworkwizard.common.Identifications;
17
18 public class Identification {
19
20 ///
21 /// Define class members
22 ///
23 private String name;
24
25 private String guid;
26
27 private String version;
28
29 private String path;
30
31 public Identification(String name, String guid, String version) {
32 this.name = name;
33 this.guid = guid;
34 this.version = version;
35 }
36
37 public Identification() {
38
39 }
40
41 public Identification(String name, String guid, String version, String path) {
42 this.name = name;
43 this.guid = guid;
44 this.version = version;
45 this.path = path;
46 }
47
48 public boolean equals(Object obj) {
49 if (obj instanceof Identification) {
50 Identification id = (Identification) obj;
51 if (path.equals(id.path)) {
52 //if ( name.equals(id.name) && guid.equals(id.guid) && version.equals(id.version)) {
53 return true;
54 }
55 return false;
56 } else {
57 return super.equals(obj);
58 }
59 }
60
61 public boolean equalsWithGuid(Object obj) {
62 if (obj instanceof Identification) {
63 Identification id = (Identification) obj;
64 if (guid.equalsIgnoreCase(id.guid)) {
65 if (version == null || id.version == null) {
66 return true;
67 } else if (version.trim().equalsIgnoreCase("") || id.version.trim().equalsIgnoreCase("")) {
68 return true;
69 } else if (version.equalsIgnoreCase(id.version)) {
70 return true;
71 }
72 }
73 return false;
74 } else {
75 return super.equals(obj);
76 }
77 }
78
79 public void setName(String name) {
80 this.name = name;
81 }
82
83 public void setGuid(String guid) {
84 this.guid = guid;
85 }
86
87 public void setVersion(String version) {
88 this.version = version;
89 }
90
91 public void setPath(String path) {
92 this.path = path;
93 }
94
95 public String getGuid() {
96 return guid;
97 }
98
99 public String getName() {
100 return name;
101 }
102
103 public String getVersion() {
104 return version;
105 }
106
107 public String getPath() {
108 return path;
109 }
110
111 public int hashCode() {
112 return guid.toLowerCase().hashCode();
113 }
114 }