KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > chaperon > build > conflict > ConflictList


1 /*
2  * Copyright (C) Chaperon. All rights reserved.
3  * -------------------------------------------------------------------------
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE file.
7  */

8
9 package net.sourceforge.chaperon.build.conflict;
10
11 import java.util.Vector JavaDoc;
12
13 /**
14  * The class represents a collection of conflicts.
15  *
16  * @author <a HREF="mailto:stephan@apache.org">Stephan Michels </a>
17  * @version CVS $Id: ConflictList.java,v 1.3 2003/12/09 19:55:52 benedikta Exp $
18  */

19 public class ConflictList
20 {
21   private Vector JavaDoc list = new Vector JavaDoc();
22
23   /**
24    * Add a conflict to this list
25    *
26    * @param conflict Conflict, which should be apped
27    */

28   public void addConflict(Conflict conflict)
29   {
30     list.addElement(conflict);
31   }
32
33   /**
34    * Return a conflict giving by an index
35    *
36    * @param index Index of conflict
37    *
38    * @return Conflict.
39    */

40   public Conflict getConflict(int index)
41   {
42     return (Conflict)list.elementAt(index);
43   }
44
45   /**
46    * Returns the count of conflicts in the list
47    *
48    * @return Count of conflict n this list
49    */

50   public int getConflictCount()
51   {
52     return list.size();
53   }
54
55   /**
56    * Return a string representation of this list.
57    *
58    * @return String representation of this list.
59    */

60   public String JavaDoc toString()
61   {
62     StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
63
64     for (int i = 0; i<list.size(); i++)
65     {
66       buffer.append(getConflict(i));
67       buffer.append("\n");
68     }
69
70     return buffer.toString();
71   }
72 }
73
Popular Tags