+++ /dev/null
-/** @file\r
-\r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.frameworkwizard.far;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
-\r
-public class AggregationOperation {\r
-\r
- public static synchronized List<PackageIdentification> union(List<PackageIdentification> list1,\r
- List<PackageIdentification> list2) {\r
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();\r
- result.addAll(list1);\r
- Iterator<PackageIdentification> iter = list2.iterator();\r
- while (iter.hasNext()) {\r
- PackageIdentification item = iter.next();\r
- if (!belongs(item, result)) {\r
- result.add(item);\r
- }\r
- }\r
- return result;\r
- }\r
-\r
- public static synchronized List<PackageIdentification> intersection(List<PackageIdentification> list1,\r
- List<PackageIdentification> list2) {\r
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();\r
- Iterator<PackageIdentification> iter = list1.iterator();\r
- while (iter.hasNext()) {\r
- PackageIdentification item = iter.next();\r
- if (belongs(item, list2)) {\r
- result.add(item);\r
- }\r
- }\r
- return result;\r
- }\r
-\r
- public static synchronized List<PackageIdentification> minus(List<PackageIdentification> list1,\r
- List<PackageIdentification> list2) {\r
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();\r
- Iterator<PackageIdentification> iter = list1.iterator();\r
- while (iter.hasNext()) {\r
- PackageIdentification item = iter.next();\r
- if (!belongs(item, list2)) {\r
- result.add(item);\r
- }\r
- }\r
- return result;\r
- }\r
-\r
- public static synchronized boolean belongs(PackageIdentification o, List<PackageIdentification> list) {\r
- Iterator<PackageIdentification> iter = list.iterator();\r
- while (iter.hasNext()) {\r
- if (iter.next().equalsWithGuid(o)) {\r
- return true;\r
- }\r
- }\r
- return false;\r
- }\r
-\r
- public static synchronized List<PackageIdentification> getExistedItems(PackageIdentification o,\r
- List<PackageIdentification> list) {\r
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();\r
- Iterator<PackageIdentification> iter = list.iterator();\r
- while (iter.hasNext()) {\r
- PackageIdentification item = iter.next();\r
- if (item.equalsWithGuid(o)) {\r
- result.add(item);\r
- }\r
- }\r
- return result;\r
- }\r
-}\r