1.1 --- a/src/net/fortuna/ical4j/model/PropertyList.java Thu Feb 12 18:02:00 2015 +0100 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,156 +0,0 @@ 1.4 -/** 1.5 - * Copyright (c) 2012, Ben Fortuna 1.6 - * All rights reserved. 1.7 - * 1.8 - * Redistribution and use in source and binary forms, with or without 1.9 - * modification, are permitted provided that the following conditions 1.10 - * are met: 1.11 - * 1.12 - * o Redistributions of source code must retain the above copyright 1.13 - * notice, this list of conditions and the following disclaimer. 1.14 - * 1.15 - * o Redistributions in binary form must reproduce the above copyright 1.16 - * notice, this list of conditions and the following disclaimer in the 1.17 - * documentation and/or other materials provided with the distribution. 1.18 - * 1.19 - * o Neither the name of Ben Fortuna nor the names of any other contributors 1.20 - * may be used to endorse or promote products derived from this software 1.21 - * without specific prior written permission. 1.22 - * 1.23 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1.24 - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1.25 - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1.26 - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 1.27 - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 1.28 - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 1.29 - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 1.30 - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 1.31 - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 1.32 - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 1.33 - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.34 - */ 1.35 -package net.fortuna.ical4j.model; 1.36 - 1.37 -import java.io.IOException; 1.38 -import java.io.Serializable; 1.39 -import java.net.URISyntaxException; 1.40 -import java.text.ParseException; 1.41 -import java.util.ArrayList; 1.42 -import java.util.Iterator; 1.43 - 1.44 -/** 1.45 - * $Id$ [Apr 5, 2004] 1.46 - * 1.47 - * Defines a list of iCalendar properties. 1.48 - * @author Ben Fortuna 1.49 - */ 1.50 -public class PropertyList extends ArrayList implements Serializable { 1.51 - 1.52 - private static final long serialVersionUID = -8875923766224921031L; 1.53 - 1.54 - /** 1.55 - * Default constructor. 1.56 - */ 1.57 - public PropertyList() { 1.58 - } 1.59 - 1.60 - /** 1.61 - * Creates a new instance with the specified initial capacity. 1.62 - * @param initialCapacity the initial capacity of the list 1.63 - */ 1.64 - public PropertyList(final int initialCapacity) { 1.65 - super(initialCapacity); 1.66 - } 1.67 - 1.68 - /** 1.69 - * Creates a deep copy of the specified property list. 1.70 - * @param properties a property list 1.71 - * @throws ParseException where property data cannot be parsed 1.72 - * @throws IOException where property data cannot be read 1.73 - * @throws URISyntaxException where a property contains an invalid URI 1.74 - */ 1.75 - public PropertyList(PropertyList properties) throws ParseException, IOException, URISyntaxException { 1.76 - super(); 1.77 - for (final Iterator i = properties.iterator(); i.hasNext();) { 1.78 - final Property p = (Property) i.next(); 1.79 - add(p.copy()); 1.80 - } 1.81 - } 1.82 - 1.83 - /** 1.84 - * {@inheritDoc} 1.85 - */ 1.86 - public final String toString() { 1.87 - final StringBuffer buffer = new StringBuffer(); 1.88 - for (final Iterator i = iterator(); i.hasNext();) { 1.89 - buffer.append(i.next().toString()); 1.90 - } 1.91 - return buffer.toString(); 1.92 - } 1.93 - 1.94 - /** 1.95 - * Returns the first property of specified name. 1.96 - * @param aName name of property to return 1.97 - * @return a property or null if no matching property found 1.98 - */ 1.99 - public final Property getProperty(final String aName) { 1.100 - for (final Iterator i = iterator(); i.hasNext();) { 1.101 - final Property p = (Property) i.next(); 1.102 - if (p.getName().equalsIgnoreCase(aName)) { 1.103 - return p; 1.104 - } 1.105 - } 1.106 - return null; 1.107 - } 1.108 - 1.109 - /** 1.110 - * Returns a list of properties with the specified name. 1.111 - * @param name name of properties to return 1.112 - * @return a property list 1.113 - */ 1.114 - public final PropertyList getProperties(final String name) { 1.115 - final PropertyList list = new PropertyList(); 1.116 - for (final Iterator i = iterator(); i.hasNext();) { 1.117 - final Property p = (Property) i.next(); 1.118 - if (p.getName().equalsIgnoreCase(name)) { 1.119 - list.add(p); 1.120 - } 1.121 - } 1.122 - return list; 1.123 - } 1.124 - 1.125 - /** 1.126 - * Add a property to the list. 1.127 - * @param property the property to add 1.128 - * @return true 1.129 - * @see java.util.List#add(java.lang.Object) 1.130 - */ 1.131 - public final boolean add(final Property property) { 1.132 - return add((Object) property); 1.133 - } 1.134 - 1.135 - /** 1.136 - * Overrides superclass to throw an <code>IllegalArgumentException</code> where argument is not a 1.137 - * <code>net.fortuna.ical4j.model.Property</code>. 1.138 - * @param property a property to add 1.139 - * @return true if the property is added, otherwise false 1.140 - * @see java.util.List#add(Object) 1.141 - */ 1.142 - public final boolean add(final Object property) { 1.143 - if (!(property instanceof Property)) { 1.144 - throw new IllegalArgumentException("Argument not a " 1.145 - + Property.class.getName()); 1.146 - } 1.147 - return super.add(property); 1.148 - } 1.149 - 1.150 - /** 1.151 - * Remove a property from the list. 1.152 - * @param property the property to remove 1.153 - * @return true if the list contained the specified property 1.154 - * @see java.util.List#remove(java.lang.Object) 1.155 - */ 1.156 - public final boolean remove(final Property property) { 1.157 - return remove((Object) property); 1.158 - } 1.159 -}