]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/AggregationOperation.java
Changed spelling to manifest
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / far / AggregationOperation.java
CommitLineData
5a24e806 1/** @file\r
2\r
3 Copyright (c) 2006, Intel Corporation\r
4 All rights reserved. This program and the accompanying materials\r
5 are licensed and made available under the terms and conditions of the BSD License\r
6 which accompanies this distribution. The full text of the license may be found at\r
7 http://opensource.org/licenses/bsd-license.php\r
8 \r
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11 \r
12 **/\r
13\r
14package org.tianocore.frameworkwizard.far;\r
15\r
16import java.util.ArrayList;\r
17import java.util.Iterator;\r
18import java.util.List;\r
19\r
20import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
21\r
22public class AggregationOperation {\r
23\r
24 public static synchronized List<PackageIdentification> union(List<PackageIdentification> list1,\r
25 List<PackageIdentification> list2) {\r
26 List<PackageIdentification> result = new ArrayList<PackageIdentification>();\r
27 result.addAll(list1);\r
28 Iterator<PackageIdentification> iter = list2.iterator();\r
29 while (iter.hasNext()) {\r
30 PackageIdentification item = iter.next();\r
31 if (!belongs(item, result)) {\r
32 result.add(item);\r
33 }\r
34 }\r
35 return result;\r
36 }\r
37\r
38 public static synchronized List<PackageIdentification> intersection(List<PackageIdentification> list1,\r
39 List<PackageIdentification> list2) {\r
40 List<PackageIdentification> result = new ArrayList<PackageIdentification>();\r
41 Iterator<PackageIdentification> iter = list1.iterator();\r
42 while (iter.hasNext()) {\r
43 PackageIdentification item = iter.next();\r
44 if (belongs(item, list2)) {\r
45 result.add(item);\r
46 }\r
47 }\r
48 return result;\r
49 }\r
50\r
51 public static synchronized List<PackageIdentification> minus(List<PackageIdentification> list1,\r
52 List<PackageIdentification> list2) {\r
53 List<PackageIdentification> result = new ArrayList<PackageIdentification>();\r
54 Iterator<PackageIdentification> iter = list1.iterator();\r
55 while (iter.hasNext()) {\r
56 PackageIdentification item = iter.next();\r
57 if (!belongs(item, list2)) {\r
58 result.add(item);\r
59 }\r
60 }\r
61 return result;\r
62 }\r
63\r
64 public static synchronized boolean belongs(PackageIdentification o, List<PackageIdentification> list) {\r
65 Iterator<PackageIdentification> iter = list.iterator();\r
66 while (iter.hasNext()) {\r
67 if (iter.next().equalsWithGuid(o)) {\r
68 return true;\r
69 }\r
70 }\r
71 return false;\r
72 }\r
73\r
74 public static synchronized List<PackageIdentification> getExistedItems(PackageIdentification o,\r
75 List<PackageIdentification> list) {\r
76 List<PackageIdentification> result = new ArrayList<PackageIdentification>();\r
77 Iterator<PackageIdentification> iter = list.iterator();\r
78 while (iter.hasNext()) {\r
79 PackageIdentification item = iter.next();\r
80 if (item.equalsWithGuid(o)) {\r
81 result.add(item);\r
82 }\r
83 }\r
84 return result;\r
85 }\r
86}\r