KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > excalibur > source > impl > validity > AbstractAggregatedValidity


1 /*
2  * Copyright 2002-2004 The Apache Software Foundation
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12  * implied.
13  *
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.excalibur.source.impl.validity;
18
19 import java.util.ArrayList JavaDoc;
20 import java.util.Collections JavaDoc;
21 import java.util.Iterator JavaDoc;
22 import java.util.List JavaDoc;
23
24 import org.apache.excalibur.source.SourceValidity;
25
26 /**
27  * The base class for the aggregation implementations
28  *
29  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
30  * @version CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:17 $
31  */

32 public abstract class AbstractAggregatedValidity
33     implements SourceValidity
34 {
35     final ArrayList JavaDoc m_list = new ArrayList JavaDoc();
36
37     public void add( final SourceValidity validity )
38     {
39         m_list.add( validity );
40     }
41
42     public String JavaDoc toString()
43     {
44         final StringBuffer JavaDoc sb = new StringBuffer JavaDoc( "SourceValidity " );
45         for( final Iterator JavaDoc i = m_list.iterator(); i.hasNext(); )
46         {
47             sb.append( i.next() );
48             if( i.hasNext() ) sb.append( ':' );
49         }
50         return sb.toString();
51     }
52     
53     public List JavaDoc getValidities()
54     {
55         return Collections.unmodifiableList(m_list);
56     }
57     
58     SourceValidity getValidity(final int index)
59     {
60         return (SourceValidity) m_list.get(index);
61     }
62     
63 }
64
Popular Tags