Enhance MsaOwner.java
[mirror_edk2.git] / Tools / Java / Source / MigrationTools / org / tianocore / migration / Guid.java
1 /** @file
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 **/
13 package org.tianocore.migration;
14
15 import java.util.regex.*;
16
17 import org.tianocore.UsageTypes;
18
19 public class Guid {
20 Guid (String r8, String t, String n, String r9, String gv, String p) {
21 r8name = r8;
22 type = t;
23 name = n;
24 r9name = r9;
25 guidvalue = gv;
26 pack = p;
27 }
28 Guid (String[] linecontext, String t) {
29 r8name = linecontext[1];
30 type = t;
31 name = linecontext[0];
32 r9name = linecontext[2];
33 guidvalue = linecontext[3];
34 pack = linecontext[4];
35 }
36 public String r8name;
37 public String type;
38 public String name;
39 public String r9name;
40 public String guidvalue;
41 public String pack;
42
43 public static Pattern ptnguid = Pattern.compile("g\\w*Guid");
44
45 public static String register(Matcher mtr, ModuleInfo mi, Database db) {
46 String type = null;
47 String temp = null;
48
49 temp = mtr.group();
50 if (MigrationTool.db.hasGuid(temp)) { // only changed guids registered, because both changed and not changed guids are included in database
51 type = MigrationTool.db.getGuidType(temp);
52 if (type.matches("Protocol")) {
53 mi.addProtocol(temp, UsageTypes.ALWAYS_CONSUMED);
54 //mi.protocols.add(temp);
55 } else if (type.matches("Ppi")) {
56 mi.addPpi(temp, UsageTypes.ALWAYS_CONSUMED);
57 //mi.ppis.add(temp);
58 } else if (type.matches("Guid")) {
59 mi.addGuid(temp, UsageTypes.ALWAYS_CONSUMED);
60 //mi.guids.add(temp);
61 }
62 return temp;
63 }
64 return null;
65 }
66 }