KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > jayasoft > ivy > conflict > FixedConflictManager


1 /*
2  * This file is subject to the license found in LICENCE.TXT in the root directory of the project.
3  *
4  * #SNAPSHOT#
5  */

6 package fr.jayasoft.ivy.conflict;
7
8 import java.util.ArrayList JavaDoc;
9 import java.util.Arrays JavaDoc;
10 import java.util.Collection JavaDoc;
11 import java.util.Iterator JavaDoc;
12
13 import fr.jayasoft.ivy.IvyNode;
14
15 public class FixedConflictManager extends AbstractConflictManager {
16     private Collection JavaDoc _revs;
17     public FixedConflictManager(String JavaDoc[] revs) {
18         _revs = Arrays.asList(revs);
19         setName("fixed"+_revs);
20     }
21     public Collection JavaDoc resolveConflicts(IvyNode parent, Collection JavaDoc conflicts) {
22         Collection JavaDoc resolved = new ArrayList JavaDoc(conflicts.size());
23         for (Iterator JavaDoc iter = conflicts.iterator(); iter.hasNext();) {
24             IvyNode node = (IvyNode)iter.next();
25             String JavaDoc revision = node.getResolvedId().getRevision();
26             if (_revs.contains(revision)) {
27                 resolved.add(node);
28             }
29         }
30         return resolved;
31     }
32
33     public Collection JavaDoc getRevs() {
34         return _revs;
35     }
36     
37 }
38
Popular Tags