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
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.
14 package org
.tianocore
.frameworkwizard
.far
;
16 import java
.util
.ArrayList
;
17 import java
.util
.Iterator
;
18 import java
.util
.List
;
20 import org
.tianocore
.frameworkwizard
.packaging
.PackageIdentification
;
22 public class AggregationOperation
{
24 public static synchronized List
<PackageIdentification
> union(List
<PackageIdentification
> list1
,
25 List
<PackageIdentification
> list2
) {
26 List
<PackageIdentification
> result
= new ArrayList
<PackageIdentification
>();
28 Iterator
<PackageIdentification
> iter
= list2
.iterator();
29 while (iter
.hasNext()) {
30 PackageIdentification item
= iter
.next();
31 if (!belongs(item
, result
)) {
38 public static synchronized List
<PackageIdentification
> intersection(List
<PackageIdentification
> list1
,
39 List
<PackageIdentification
> list2
) {
40 List
<PackageIdentification
> result
= new ArrayList
<PackageIdentification
>();
41 Iterator
<PackageIdentification
> iter
= list1
.iterator();
42 while (iter
.hasNext()) {
43 PackageIdentification item
= iter
.next();
44 if (belongs(item
, list2
)) {
51 public static synchronized List
<PackageIdentification
> minus(List
<PackageIdentification
> list1
,
52 List
<PackageIdentification
> list2
) {
53 List
<PackageIdentification
> result
= new ArrayList
<PackageIdentification
>();
54 Iterator
<PackageIdentification
> iter
= list1
.iterator();
55 while (iter
.hasNext()) {
56 PackageIdentification item
= iter
.next();
57 if (!belongs(item
, list2
)) {
64 public static synchronized boolean belongs(PackageIdentification o
, List
<PackageIdentification
> list
) {
65 Iterator
<PackageIdentification
> iter
= list
.iterator();
66 while (iter
.hasNext()) {
67 if (iter
.next().equalsWithGuid(o
)) {
74 public static synchronized List
<PackageIdentification
> getExistedItems(PackageIdentification o
,
75 List
<PackageIdentification
> list
) {
76 List
<PackageIdentification
> result
= new ArrayList
<PackageIdentification
>();
77 Iterator
<PackageIdentification
> iter
= list
.iterator();
78 while (iter
.hasNext()) {
79 PackageIdentification item
= iter
.next();
80 if (item
.equalsWithGuid(o
)) {