RSSConfig.java (1834B)
1 /* 2 * Copyright (C) 2010 A. Horn 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 17 package org.mcsoxford.rss; 18 19 /** 20 * Immutable data structure to configure the RSS parser and loader modules. On 21 * large data sets, well-chosen configuration values can reduce memory 22 * consumption and increase performance. 23 * 24 * @author Mr Horn 25 */ 26 public final class RSSConfig { 27 28 /** 29 * Average number of RSS item <category> elements which serves as the 30 * initial capacity of the List implementation. 31 */ 32 final byte categoryAvg; 33 34 /** 35 * Average number of RSS item <media:thumbnail> elements which serves as 36 * the initial capacity of the List implementation. 37 */ 38 final byte thumbnailAvg; 39 40 /** 41 * Instantiate an RSS configuration with the specified parameters. 42 * 43 * @param categoryAvg average number of RSS item <category> elements in 44 * a typical RSS feed 45 * @param thumbnailAvg average number of RSS item <metia:thumbnail> 46 * elements in a typical RSS feed 47 */ 48 public RSSConfig(byte categoryAvg, byte thumbnailAvg) { 49 this.categoryAvg = categoryAvg; 50 this.thumbnailAvg = thumbnailAvg; 51 } 52 53 /** 54 * Instantiate an RSS configuration with default values. 55 */ 56 public RSSConfig() { 57 this.categoryAvg = 3; 58 this.thumbnailAvg = 2; 59 } 60 61 } 62