View Javadoc

1   /*
2    * Copyright 2007 Sebastien Brunot (sbrunot@gmail.com)
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *   http://www.apache.org/licenses/LICENSE-2.0
9    *   
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package net.sourceforge.buildmonitor.utils;
17  
18  import java.util.ArrayList;
19  import java.util.List;
20  
21  /**
22   * An RSS feed document.
23   * @author sbrunot
24   *
25   */
26  public class RssFeedDocument
27  {
28  	//////////////////////////////
29  	// Attributes
30  	//////////////////////////////
31  
32  	private List<RssFeedItem> items = new ArrayList<RssFeedItem>();
33  	
34  	//////////////////////////////
35  	// Constructor
36  	//////////////////////////////
37  	
38  	public RssFeedDocument()
39  	{
40  	}
41  
42  	//////////////////////////////
43  	// Public method
44  	//////////////////////////////
45  
46  	/**
47  	 * Get the Nth item of the document.
48  	 * @param theIndexOfTheItemInTheDocument index of the item in the document (index of the first item is 0).
49  	 * @return the theIndexOfTheItemInTheDocument th item in the document.
50  	 * @throws IndexOutOfBoundsException if theIndexOfTheItemInTheDocument is < 0 or >= size().
51  	 */
52  	public RssFeedItem getItem(int theIndexOfTheItemInTheDocument) throws IndexOutOfBoundsException
53  	{
54  		return this.items.get(theIndexOfTheItemInTheDocument);
55  	}
56  	
57  	/**
58  	 * Returns the size of the document (aka the number of items it contains).
59  	 * @return the size of the document (aka the number of items it contains).
60  	 */
61  	public int size()
62  	{
63  		return items.size();
64  	}
65  	
66  	/**
67  	 * Add an RSS Feed item to the document
68  	 * @param theRssFeedItemToAdd the item to add to the document
69  	 */
70  	public void add(RssFeedItem theRssFeedItemToAdd)
71  	{
72  		this.items.add(theRssFeedItemToAdd);
73  	}
74  }