Changeset 1366
- Timestamp:
- 04/24/07 15:32:30
- Files:
-
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/data/CalendarBuilder.java (modified) (3 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/data/CalendarParserFactory.java (added)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/data/DefaultCalendarParserFactory.java (added)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/filter/PeriodRule.java (modified) (2 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/AbstractContentFactory.java (added)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/AddressList.java (modified) (5 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/ComponentFactory.java (modified) (9 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/DateList.java (modified) (11 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/DateTime.java (modified) (2 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/Dur.java (modified) (14 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/ParameterFactoryImpl.java (modified) (25 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/ParameterList.java (modified) (12 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/Period.java (modified) (18 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/PeriodList.java (modified) (11 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/PropertyFactoryImpl.java (modified) (6 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/PropertyList.java (modified) (8 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/Recur.java (modified) (3 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/UtcOffset.java (modified) (5 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/component/Observance.java (modified) (7 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/component/VFreeBusy.java (modified) (4 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/parameter/AltRep.java (modified) (2 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/parameter/Dir.java (modified) (2 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/parameter/SentBy.java (modified) (2 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Attach.java (modified) (5 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Attendee.java (modified) (2 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/DateListProperty.java (modified) (3 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/DateProperty.java (modified) (5 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/DtEnd.java (modified) (5 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/DtStart.java (modified) (6 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Due.java (modified) (3 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Geo.java (modified) (8 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Organizer.java (modified) (7 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/RDate.java (modified) (5 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/RecurrenceId.java (modified) (8 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/TzUrl.java (modified) (4 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Url.java (modified) (4 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/util/TimeZones.java (modified) (4 diffs)
- external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/util/Uris.java (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/data/CalendarBuilder.java
r1267 r1366 1 1 /* 2 * $Id: CalendarBuilder.java,v 1.2 3 2006/11/05 08:05:47fortuna Exp $2 * $Id: CalendarBuilder.java,v 1.24 2007/02/08 08:45:09 fortuna Exp $ 3 3 * 4 4 * Created: Apr 5, 2004 … … 92 92 */ 93 93 public CalendarBuilder() { 94 this( new CalendarParserImpl(), TimeZoneRegistryFactory.getInstance()95 .createRegistry());94 this(CalendarParserFactory.getInstance().createParser(), 95 TimeZoneRegistryFactory.getInstance().createRegistry()); 96 96 } 97 97 … … 109 109 */ 110 110 public CalendarBuilder(final TimeZoneRegistry registry) { 111 this( new CalendarParserImpl(), registry);111 this(CalendarParserFactory.getInstance().createParser(), registry); 112 112 } 113 113 external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/filter/PeriodRule.java
r1267 r1366 1 1 /* 2 * $Id: PeriodRule.java,v 1. 5 2006/11/05 07:59:37fortuna Exp $2 * $Id: PeriodRule.java,v 1.6 2007/01/28 04:04:04 fortuna Exp $ 3 3 * 4 4 * Created on 2/02/2006 … … 78 78 public final boolean match(final Component component) { 79 79 DtStart start = (DtStart) component.getProperty(Property.DTSTART); 80 if (start != null && period.includes(start.getDate() )) {80 if (start != null && period.includes(start.getDate(), Period.INCLUSIVE_START)) { 81 81 debug(start.getDate(), "start date"); 82 82 return true; 83 83 } 84 84 DtEnd end = (DtEnd) component.getProperty(Property.DTEND); 85 if (end != null && period.includes(end.getDate(), false)) {85 if (end != null && period.includes(end.getDate(), Period.INCLUSIVE_END)) { 86 86 debug(end.getDate(), "end date"); 87 87 return true; external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/AddressList.java
r1267 r1366 1 1 /* 2 * $Id: AddressList.java,v 1. 9 2005/09/18 10:38:41 fortuna Exp $ [23-Apr-2004]2 * $Id: AddressList.java,v 1.10 2007/02/10 08:46:31 fortuna Exp $ [23-Apr-2004] 3 3 * 4 4 * Copyright (c) 2004, Ben Fortuna … … 23 23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 26 26 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 27 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, … … 42 42 import java.util.StringTokenizer; 43 43 44 import net.fortuna.ical4j.util.CompatibilityHints; 44 45 import net.fortuna.ical4j.util.Strings; 45 46 import net.fortuna.ical4j.util.Uris; 46 47 47 48 48 /** 49 49 * Defines a list of iCalendar addresses. 50 *51 50 * @author Ben Fortuna 52 51 */ 53 52 public class AddressList implements Serializable { 54 53 55 54 private static final long serialVersionUID = 81383256078213569L; 56 55 57 56 private List addresses; 58 57 … … 65 64 66 65 /** 67 * Parses the specified string representation to create 68 * a list of addresses. 69 * @param aValue a string representation of a list of 70 * addresses 71 * @throws URISyntaxException where the specified string 72 * is not a valid representation 66 * Parses the specified string representation to create a list of addresses. 67 * @param aValue a string representation of a list of addresses 68 * @throws URISyntaxException where the specified string is not a valid representation 73 69 */ 74 70 public AddressList(final String aValue) throws URISyntaxException { … … 76 72 for (StringTokenizer t = new StringTokenizer(aValue, ","); t 77 73 .hasMoreTokens();) { 78 addresses.add(new URI(Uris.encode(Strings.unquote(t.nextToken())))); 74 75 try { 76 addresses.add(new URI(Uris.encode(Strings 77 .unquote(t.nextToken())))); 78 } 79 catch (URISyntaxException use) { 80 // ignore invalid addresses if relaxed parsing is enabled.. 81 if (!CompatibilityHints.isHintEnabled( 82 CompatibilityHints.KEY_RELAXED_PARSING)) { 83 84 throw use; 85 } 86 } 79 87 } 80 88 } external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/ComponentFactory.java
r1364 r1366 1 1 /* 2 * $Id: ComponentFactory.java,v 1.1 1 2006/03/25 10:16:01 fortuna Exp $ [05-Apr-2004]2 * $Id: ComponentFactory.java,v 1.12 2007/02/10 07:52:11 fortuna Exp $ [05-Apr-2004] 3 3 * 4 4 * Copyright (c) 2004, Ben Fortuna … … 23 23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 26 26 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 27 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, … … 48 48 49 49 /** 50 * A factory for creating iCalendar components. Note that if relaxed parsing is enabled (via 51 * specifying the systemproperty: icalj.parsing.relaxed=true) illegal component names are allowed.50 * A factory for creating iCalendar components. Note that if relaxed parsing is enabled (via specifying the system 51 * property: icalj.parsing.relaxed=true) illegal component names are allowed. 52 52 * @author Ben Fortuna 53 53 */ … … 56 56 private static ComponentFactory instance = new ComponentFactory(); 57 57 58 private boolean allowIllegalNames;59 60 58 /** 61 59 * Constructor made private to prevent instantiation. 62 60 */ 63 61 private ComponentFactory() { 64 allowIllegalNames = CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING);65 62 } 66 63 … … 72 69 } 73 70 71 /** 72 * @param name 73 * @return 74 */ 74 75 public Component createComponent(final String name) { 75 76 return createComponent(name, new PropertyList()); … … 78 79 /** 79 80 * Creates a component. 80 * 81 * @param name 82 * name of the component 83 * @param properties 84 * a list of component properties 81 * @param name name of the component 82 * @param properties a list of component properties 85 83 * @return a component 86 84 */ 87 public Component createComponent(final String name, final PropertyList properties) { 85 public Component createComponent(final String name, 86 final PropertyList properties) { 88 87 if (Component.VALARM.equals(name)) { 89 88 return new VAlarm(properties); … … 116 115 return new XComponent(name, properties); 117 116 } 118 else if (allowIllegalNames ) {117 else if (allowIllegalNames()) { 119 118 return new XComponent(name, properties); 120 119 } 121 120 else { 122 throw new IllegalArgumentException("Illegal component [" + name + "]"); 121 throw new IllegalArgumentException("Illegal component [" + name 122 + "]"); 123 123 } 124 124 } 125 125 126 126 /** 127 * Creates a component which contains sub-components. Currently the only 128 * such component is VTIMEZONE. 129 * 130 * @param name 131 * name of the component 132 * @param properties 133 * a list of component properties 134 * @param components 135 * a list of sub-components (namely standard/daylight timezones) 127 * Creates a component which contains sub-components. Currently the only such component is VTIMEZONE. 128 * @param name name of the component 129 * @param properties a list of component properties 130 * @param components a list of sub-components (namely standard/daylight timezones) 136 131 * @return a component 137 132 */ … … 146 141 } 147 142 else { 148 throw new IllegalArgumentException("Illegal component [" + name + "]"); 143 throw new IllegalArgumentException("Illegal component [" + name 144 + "]"); 149 145 } 150 146 } … … 160 156 && name.length() > Component.EXPERIMENTAL_PREFIX.length(); 161 157 } 158 159 /** 160 * @return 161 */ 162 protected boolean allowIllegalNames() { 163 return CompatibilityHints 164 .isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING); 165 } 162 166 } external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/DateList.java
r1267 r1366 1 1 /* 2 * $Id: DateList.java,v 1.1 8 2006/04/05 10:51:16fortuna Exp $ [23-Apr-2004]2 * $Id: DateList.java,v 1.19 2006/12/17 11:25:52 fortuna Exp $ [23-Apr-2004] 3 3 * 4 4 * Copyright (c) 2004, Ben Fortuna … … 54 54 55 55 private TimeZone timeZone; 56 56 57 57 private boolean utc; 58 58 … … 77 77 this(aType, null); 78 78 } 79 79 80 80 /** 81 81 * Default constructor. 82 * 82 * 83 83 * @param aType 84 84 * specifies the type of dates (either date or date-time) … … 97 97 this(aValue, aType, null); 98 98 } 99 99 100 100 /** 101 101 * Parses the specified string representation to create a list of dates. 102 * 102 * 103 103 * @param aValue 104 104 * a string representation of a list of dates … … 122 122 } 123 123 } 124 124 125 125 /** 126 126 * Constructs a new date list of the specified type containing … … 190 190 return add((Object) date); 191 191 } 192 192 193 193 /** 194 194 * Overrides superclass to throw an <code>IllegalArgumentException</code> … … 205 205 /** 206 206 * Remove a date from the list. 207 * 207 * 208 208 * @param date 209 209 * the date to remove … … 218 218 * Returns the VALUE parameter specifying the type of dates (ie. date or 219 219 * date-time) stored in this date list. 220 * 220 * 221 221 * @return Returns a Value parameter. 222 222 */ … … 228 228 * Indicates whether this list is in local or UTC format. This property will 229 229 * have no affect if the type of the list is not DATE-TIME. 230 * 230 * 231 231 * @return Returns true if in UTC format, otherwise false. 232 232 */ … … 237 237 /** 238 238 * Sets whether this list is in UTC or local time format. 239 * 239 * 240 240 * @param utc 241 241 * The utc to set. … … 248 248 } 249 249 this.timeZone = null; 250 this.utc = true;251 } 252 250 this.utc = utc; 251 } 252 253 253 /** 254 254 * Applies the specified timezone to all dates in the list. external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/DateTime.java
r1267 r1366 1 1 /* 2 * $Id: DateTime.java,v 1.1 4 2006/11/11 08:35:13fortuna Exp $2 * $Id: DateTime.java,v 1.15 2007/01/28 05:45:54 fortuna Exp $ 3 3 * 4 4 * Created on 26/06/2005 … … 181 181 } 182 182 else { 183 throw pe ;183 throw pe2; 184 184 } 185 185 } external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/Dur.java
r1267 r1366 1 1 /* 2 * $Id: Dur.java,v 1. 9 2006/05/27 13:21:25fortuna Exp $2 * $Id: Dur.java,v 1.12 2007/01/13 12:17:57 fortuna Exp $ 3 3 * 4 4 * Created on 20/06/2005 … … 36 36 package net.fortuna.ical4j.model; 37 37 38 import java.io.IOException; 38 39 import java.io.Serializable; 39 40 import java.util.Calendar; … … 45 46 46 47 /** 47 * Represents a duration of time in iCalendar. Note that according to RFC2445 48 * durations represented in weeks are mutually exclusive of other duration49 * fields.48 * Represents a duration of time in iCalendar. Note that according to RFC2445 durations represented in weeks are 49 * mutually exclusive of other duration fields. 50 * 50 51 * <pre> 51 * 4.3.6 Duration52 * 53 * Value Name: DURATION54 * 55 * Purpose: This value type is used to identify properties that contain56 * a duration of time.57 * 58 * Formal Definition: The value type is defined by the following59 * notation:60 * 61 * dur-value = (["+"] / "-") "P"(dur-date / dur-time / dur-week)62 * 63 * dur-date = dur-day [dur-time]64 * dur-time = "T"(dur-hour / dur-minute / dur-second)65 * dur-week = 1*DIGIT "W"66 * dur-hour = 1*DIGIT "H"[dur-minute]67 * dur-minute = 1*DIGIT "M"[dur-second]68 * dur-second = 1*DIGIT "S"69 * dur-day = 1*DIGIT "D"52 * 4.3.6 Duration 53 * 54 * Value Name: DURATION 55 * 56 * Purpose: This value type is used to identify properties that contain 57 * a duration of time. 58 * 59 * Formal Definition: The value type is defined by the following 60 * notation: 61 * 62 * dur-value = (["+"] / "-") "P" (dur-date / dur-time / dur-week) 63 * 64 * dur-date = dur-day [dur-time] 65 * dur-time = "T" (dur-hour / dur-minute / dur-second) 66 * dur-week = 1*DIGIT "W" 67 * dur-hour = 1*DIGIT "H" [dur-minute] 68 * dur-minute = 1*DIGIT "M" [dur-second] 69 * dur-second = 1*DIGIT "S" 70 * dur-day = 1*DIGIT "D" 70 71 * </pre> 71 * 72 * 72 73 * @author Ben Fortuna 73 74 */ 74 75 public class Dur implements Comparable, Serializable { 75 76 76 77 private static final long serialVersionUID = 5013232281547134583L; 77 78 78 79 private static final int DAYS_PER_WEEK = 7; 79 80 private static final int WEEKS_PER_YEAR = 52; 81 80 82 81 private static final int SECONDS_PER_MINUTE = 60; 83 82 84 83 private static final int MINUTES_PER_HOUR = 60; 85 84 86 85 private static final int HOURS_PER_DAY = 24; 87 86 88 87 private static final int DAYS_PER_YEAR = 365; 89 90 private Log log = LogFactory.getLog(Dur.class);88 89 private transient Log log = LogFactory.getLog(Dur.class); 91 90 92 91 private boolean negative; 93 92 94 93 private int weeks; 95 94 96 95 private int days; 97 96 98 97 private int hours; 99 98 100 99 private int minutes; 101 100 102 101 private int seconds; 103 102 104 103 /** 105 104 * Constructs a new duration instance from a string representation. … … 117 116 String prevToken = null; 118 117 119 for (StringTokenizer t = new StringTokenizer(value, "+-PWDTHMS", true); t.hasMoreTokens();) { 118 for (StringTokenizer t = new StringTokenizer(value, "+-PWDTHMS", true); t 119 .hasMoreTokens();) { 120 120 prevToken = token; 121 121 token = t.nextToken(); … … 156 156 } 157 157 } 158 158 159 159 /** 160 160 * Constructs a new duration from the specified weeks. … … 168 168 this.seconds = 0; 169 169 } 170 170 171 171 /** 172 172 * Constructs a new duration from the specified arguments. … … 176 176 * @param seconds duration in seconds 177 177 */ 178 public Dur(final int days, final int hours, final int minutes, final int seconds) { 178 public Dur(final int days, final int hours, final int minutes, 179 final int seconds) { 179 180 this.weeks = 0; 180 181 this.days = days; … … 183 184 this.seconds = seconds; 184 185 } 185 186 /** 187 * Constructs a new duration representing the time between the two 188 * specified dates. The end date may precede the start date in order 189 * to represent a negative duration. 186 187 /** 188 * Constructs a new duration representing the time between the two specified dates. The end date may precede the 189 * start date in order to represent a negative duration. 190 190 * @param start the start date of the duration 191 191 * @param end the end date of the duration 192 192 */ 193 public Dur(final Date start, final Date end) { 193 public Dur(Date start, Date end) { 194 // Negative range? (start occurs after end) 195 negative = start.compareTo(end) > 0; 196 if (negative) { 197 // Swap the dates (which eliminates the need to bother with 198 // negative after this!) 199 Date t = start; 200 start = end; 201 end = t; 202 } 203 194 204 Calendar startCal = Calendar.getInstance(); 195 205 startCal.setTime(start); 196 206 Calendar endCal = Calendar.getInstance(); 197 207 endCal.setTime(end); 198 199 int yearDelta = endCal.get(Calendar.YEAR) - startCal.get(Calendar.YEAR); 200 int weekDelta = endCal.get(Calendar.WEEK_OF_YEAR) - startCal.get(Calendar.WEEK_OF_YEAR); 201 int dayDelta = endCal.get(Calendar.DAY_OF_YEAR) - startCal.get(Calendar.DAY_OF_YEAR); 202 int hourDelta = endCal.get(Calendar.HOUR_OF_DAY) - startCal.get(Calendar.HOUR_OF_DAY); 203 int minuteDelta = endCal.get(Calendar.MINUTE) - startCal.get(Calendar.MINUTE); 204 int secondDelta = endCal.get(Calendar.SECOND) - startCal.get(Calendar.SECOND); 205 206 // test for negativity.. 207 if (yearDelta < 0 208 || (yearDelta == 0 && dayDelta < 0) 209 || (yearDelta == 0 && dayDelta == 0 && hourDelta < 0) 210 || (yearDelta == 0 && dayDelta == 0 && hourDelta == 0 && minuteDelta < 0) 211 || (yearDelta == 0 && dayDelta == 0 && hourDelta == 0 && minuteDelta == 0 && secondDelta < 0)) { 212 negative = true; 213 } 214 215 if ((dayDelta % DAYS_PER_WEEK) + hourDelta + minuteDelta + secondDelta == 0) { 216 // weeks.. 217 while (startCal.get(Calendar.YEAR) != endCal.get(Calendar.YEAR)) { 218 weekDelta = WEEKS_PER_YEAR * (endCal.get(Calendar.YEAR) - startCal.get(Calendar.YEAR)); 219 // if (weekDelta < 0) { 220 // negative = true; 221 // } 222 weeks += weekDelta; 223 startCal.add(Calendar.WEEK_OF_YEAR, weekDelta); 224 } 225 if (startCal.get(Calendar.WEEK_OF_YEAR) != endCal.get(Calendar.WEEK_OF_YEAR)) { 226 weekDelta = endCal.get(Calendar.WEEK_OF_YEAR) - startCal.get(Calendar.WEEK_OF_YEAR); 227 // if (weeks == 0 && weekDelta < 0) { 228 // negative = true; 229 // } 230 weeks += weekDelta; 231 } 232 weeks = Math.abs(weeks); 208 209 // Init our duration interval (which is in units that evolve as we 210 // compute, below) 211 int dur = 0; 212 213 // Count days to get to the right year (loop in the very rare chance 214 // that a leap year causes us to come up short) 215 int nYears = endCal.get(Calendar.YEAR) - startCal.get(Calendar.YEAR); 216 while (nYears > 0) { 217 startCal.add(Calendar.DATE, DAYS_PER_YEAR * nYears); 218 dur += DAYS_PER_YEAR * nYears; 219 nYears = endCal.get(Calendar.YEAR) - startCal.get(Calendar.YEAR); 220 } 221 222 // Count days to get to the right day 223 dur += endCal.get(Calendar.DAY_OF_YEAR) 224 - startCal.get(Calendar.DAY_OF_YEAR); 225 226 // Count hours to get to right hour 227 dur *= HOURS_PER_DAY; // days -> hours 228 dur += endCal.get(Calendar.HOUR_OF_DAY) 229 - startCal.get(Calendar.HOUR_OF_DAY); 230 231 // ... to the right minute 232 dur *= MINUTES_PER_HOUR; // hours -> minutes 233 dur += endCal.get(Calendar.MINUTE) - startCal.get(Calendar.MINUTE); 234 235 // ... and second 236 dur *= SECONDS_PER_MINUTE; // minutes -> seconds 237 dur += endCal.get(Calendar.SECOND) - startCal.get(Calendar.SECOND); 238 239 // Now unwind our units 240 seconds = dur % SECONDS_PER_MINUTE; 241 dur = dur / SECONDS_PER_MINUTE; // seconds -> minutes (drop remainder seconds) 242 minutes = dur % MINUTES_PER_HOUR; 243 dur /= MINUTES_PER_HOUR; // minutes -> hours (drop remainder minutes) 244 hours = dur % HOURS_PER_DAY; 245 dur /= HOURS_PER_DAY; // hours -> days (drop remainder hours) 246 days = dur; 247 weeks = 0; 248 249 // Special case for week-only representation 250 if (seconds == 0 && minutes == 0 && hours == 0 251 && (days % DAYS_PER_WEEK) == 0) { 252 weeks = days / DAYS_PER_WEEK; 233 253 days = 0; 234 hours = 0; 235 minutes = 0; 236 seconds = 0; 237 } 238 else { 239 // seconds.. 240 if (secondDelta > 0 && negative) { 241 startCal.add(Calendar.MINUTE, -1); 242 seconds = SECONDS_PER_MINUTE - secondDelta; 243 } 244 else if (secondDelta < 0 && !negative) { 245 startCal.add(Calendar.MINUTE, 1); 246 seconds = SECONDS_PER_MINUTE + secondDelta; 247 } 248 else { 249 seconds = Math.abs(secondDelta); 250 } 251 252 // minutes.. 253 minuteDelta = endCal.get(Calendar.MINUTE) - startCal.get(Calendar.MINUTE); 254 if (minuteDelta > 0 && negative) { 255 startCal.add(Calendar.HOUR, -1); 256 minutes = MINUTES_PER_HOUR - minuteDelta; 257 } 258 else if (minuteDelta < 0 && !negative) { 259 startCal.add(Calendar.HOUR, 1); 260 minutes = MINUTES_PER_HOUR + minuteDelta; 261 } 262 else { 263 minutes = Math.abs(minuteDelta); 264 } 265 266 // hours.. 267 hourDelta = endCal.get(Calendar.HOUR_OF_DAY) - startCal.get(Calendar.HOUR_OF_DAY); 268 if (hourDelta > 0 && negative) { 269 startCal.add(Calendar.DAY_OF_YEAR, -1); 270 hours = HOURS_PER_DAY - hourDelta; 271 } 272 else if (hourDelta < 0 && !negative) { 273 startCal.add(Calendar.DAY_OF_YEAR, 1); 274 hours = HOURS_PER_DAY + hourDelta; 275 } 276 else { 277 hours = Math.abs(hourDelta); 278 } 279 280 // days.. 281 while (startCal.get(Calendar.YEAR) != endCal.get(Calendar.YEAR)) { 282 dayDelta = DAYS_PER_YEAR * (endCal.get(Calendar.YEAR) - startCal.get(Calendar.YEAR)); 283 days += dayDelta; 284 startCal.add(Calendar.DAY_OF_YEAR, dayDelta); 285 } 286 if (startCal.get(Calendar.DAY_OF_YEAR) != endCal.get(Calendar.DAY_OF_YEAR)) { 287 days += endCal.get(Calendar.DAY_OF_YEAR) - startCal.get(Calendar.DAY_OF_YEAR); 288 } 289 days = Math.abs(days); 290 weeks = 0; 291 } 292 } 293 294 /** 295 * Returns a date representing the end of this duration from 296 * the specified start date. 254 } 255 } 256 257 /** 258 * Returns a date representing the end of this duration from the specified start date. 297 259 * @param start the date to start the duration 298 260 * @return the end of the duration as a date … … 317 279 return cal.getTime(); 318 280 } 319 281 320 282 /** 321 283 * Provides a negation of this instance. … … 328 290 return negated; 329 291 } 330 331 /* (non-Javadoc) 292 293 /* 294 * (non-Javadoc) 332 295 * @see java.lang.Object#toString() 333 296 */ … … 365 328 return b.toString(); 366 329 } 367 330 368 331 /** 369 332 * @param arg0 … … 373 336 return compareTo((Dur) arg0); 374 337 } 375 338 376 339 /** 377 340 * Compares this duration with another. … … 381 344 public final int compareTo(final Dur arg0) { 382 345 if (isNegative() != arg0.isNegative()) { 383 //return Boolean.valueOf(isNegative()).compareTo(Boolean.valueOf(arg0.isNegative()));346 // return Boolean.valueOf(isNegative()).compareTo(Boolean.valueOf(arg0.isNegative())); 384 347 // for pre-java 1.5 compatibility.. 385 348 if (isNegative()) { … … 446 409 return weeks; 447 410 } 411 412 /** 413 * @param stream 414 * @throws IOException 415 * @throws ClassNotFoundException 416 */ 417 private void readObject(java.io.ObjectInputStream stream) 418 throws IOException, ClassNotFoundException { 419 420 stream.defaultReadObject(); 421 log = LogFactory.getLog(Dur.class); 422 } 448 423 } external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/ParameterFactoryImpl.java
r1364 r1366 25 25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 28 28 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 29 29 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, … … 37 37 38 38 import java.net.URISyntaxException; 39 import java.util.HashMap;40 import java.util.Map;41 39 42 40 import net.fortuna.ical4j.model.parameter.Abbrev; … … 66 64 /** 67 65 * A factory for creating iCalendar parameters. 68 *69 66 * @author Ben Fortuna 70 67 */ 71 public final class ParameterFactoryImpl implements ParameterFactory { 68 public final class ParameterFactoryImpl extends AbstractContentFactory 69 implements ParameterFactory { 72 70 73 71 private static ParameterFactoryImpl instance = new ParameterFactoryImpl(); 74 72 75 private Map factories;76 77 73 /** 78 74 * Constructor made private to prevent instantiation. 79 75 */ 80 76 private ParameterFactoryImpl() { 81 factories = new HashMap();82 77 factories.put(Parameter.ABBREV, createAbbrevFactory()); 83 78 factories.put(Parameter.ALTREP, createAltRepFactory()); … … 124 119 private ParameterFactory createAltRepFactory() { 125 120 return new ParameterFactory() { 126 /* (non-Javadoc) 127 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 128 */ 129 public Parameter createParameter(final String name, final String value) throws URISyntaxException { 121 /* 122 * (non-Javadoc) 123 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 124 */ 125 public Parameter createParameter(final String name, 126 final String value) throws URISyntaxException { 130 127 return new AltRep(value); 131 128 } … … 138 135 private ParameterFactory createCnFactory() { 139 136 return new ParameterFactory() { 140 /* (non-Javadoc) 141 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 142 */ 143 public Parameter createParameter(final String name, final String value) 144 throws URISyntaxException { 137 /* 138 * (non-Javadoc) 139 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 140 */ 141 public Parameter createParameter(final String name, 142 final String value) throws URISyntaxException { 145 143 return new Cn(value); 146 144 } … … 153 151 private ParameterFactory createCuTypeFactory() { 154 152 return new ParameterFactory() { 155 /* (non-Javadoc) 156 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 157 */ 158 public Parameter createParameter(final String name, final String value) 159 throws URISyntaxException { 160 CuType parameter = new CuType(value); 153 /* 154 * (non-Javadoc) 155 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 156 */ 157 public Parameter createParameter(final String name, 158 final String value) throws URISyntaxException { 159 CuType parameter = new CuType(value); 161 160 if (CuType.INDIVIDUAL.equals(parameter)) { 162 161 return CuType.INDIVIDUAL; … … 184 183 private ParameterFactory createDelegatedFromFactory() { 185 184 return new ParameterFactory() { 186 /* (non-Javadoc) 187 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 188 */ 189 public Parameter createParameter(final String name, final String value) 190 throws URISyntaxException { 185 /* 186 * (non-Javadoc) 187 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 188 */ 189 public Parameter createParameter(final String name, 190 final String value) throws URISyntaxException { 191 191 return new DelegatedFrom(value); 192 192 } … … 199 199 private ParameterFactory createDelegatedToFactory() { 200 200 return new ParameterFactory() { 201 /* (non-Javadoc) 202 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 203 */ 204 public Parameter createParameter(final String name, final String value) 205 throws URISyntaxException { 201 /* 202 * (non-Javadoc) 203 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 204 */ 205 public Parameter createParameter(final String name, 206 final String value) throws URISyntaxException { 206 207 return new DelegatedTo(value); 207 208 } … … 214 215 private ParameterFactory createDirFactory() { 215 216 return new ParameterFactory() { 216 /* (non-Javadoc) 217 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 218 */ 219 public Parameter createParameter(final String name, final String value) 220 throws URISyntaxException { 217 /* 218 * (non-Javadoc) 219 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 220 */ 221 public Parameter createParameter(final String name, 222 final String value) throws URISyntaxException { 221 223 return new Dir(value); 222 224 } … … 229 231 private ParameterFactory createEncodingFactory() { 230 232 return new ParameterFactory() { 231 /* (non-Javadoc) 232 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 233 */ 234 public Parameter createParameter(final String name, final String value) 235 throws URISyntaxException { 233 /* 234 * (non-Javadoc) 235 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 236 */ 237 public Parameter createParameter(final String name, 238 final String value) throws URISyntaxException { 236 239 Encoding parameter = new Encoding(value); 237 240 if (Encoding.EIGHT_BIT.equals(parameter)) { … … 251 254 private ParameterFactory createFmtTypeFactory() { 252 255 return new ParameterFactory() { 253 /* (non-Javadoc) 254 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 255 */ 256 public Parameter createParameter(final String name, final String value) 257 throws URISyntaxException { 256 /* 257 * (non-Javadoc) 258 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 259 */ 260 public Parameter createParameter(final String name, 261 final String value) throws URISyntaxException { 258 262 return new FmtType(value); 259 263 } … … 266 270 private ParameterFactory createFbTypeFactory() { 267 271 return new ParameterFactory() { 268 /* (non-Javadoc) 269 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 270 */ 271 public Parameter createParameter(final String name, final String value) 272 throws URISyntaxException { 272 /* 273 * (non-Javadoc) 274 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 275 */ 276 public Parameter createParameter(final String name, 277 final String value) throws URISyntaxException { 273 278 FbType parameter = new FbType(value); 274 279 if (FbType.FREE.equals(parameter)) { … … 294 299 private ParameterFactory createLanguageFactory() { 295 300 return new ParameterFactory() { 296 /* (non-Javadoc) 297 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 298 */ 299 public Parameter createParameter(final String name, final String value) 300 throws URISyntaxException { 301 /* 302 * (non-Javadoc) 303 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 304 */ 305 public Parameter createParameter(final String name, 306 final String value) throws URISyntaxException { 301 307 return new Language(value); 302 308 } … … 309 315 private ParameterFactory createMemberFactory() { 310 316 return new ParameterFactory() { 311 /* (non-Javadoc) 312 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 313 */ 314 public Parameter createParameter(final String name, final String value) 315 throws URISyntaxException { 317 /* 318 * (non-Javadoc) 319 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 320 */ 321 public Parameter createParameter(final String name, 322 final String value) throws URISyntaxException { 316 323 return new Member(value); 317 324 } … … 324 331 private ParameterFactory createPartStatFactory() { 325 332 return new ParameterFactory() { 326 /* (non-Javadoc) 327 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 328 */ 329 public Parameter createParameter(final String name, final String value) 330 throws URISyntaxException { 333 /* 334 * (non-Javadoc) 335 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 336 */ 337 public Parameter createParameter(final String name, 338 final String value) throws URISyntaxException { 331 339 PartStat parameter = new PartStat(value); 332 340 if (PartStat.NEEDS_ACTION.equals(parameter)) { … … 361 369 private ParameterFactory createRangeFactory() { 362 370 return new ParameterFactory() { 363 /* (non-Javadoc) 364 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 365 */ 366 public Parameter createParameter(final String name, final String value) 367 throws URISyntaxException { 371 /* 372 * (non-Javadoc) 373 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 374 */ 375 public Parameter createParameter(final String name, 376 final String value) throws URISyntaxException { 368 377 Range parameter = new Range(value); 369 378 if (Range.THISANDFUTURE.equals(parameter)) { … … 383 392 private ParameterFactory createRelatedFactory() { 384 393 return new ParameterFactory() { 385 /* (non-Javadoc) 386 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 387 */ 388 public Parameter createParameter(final String name, final String value) 389 throws URISyntaxException { 394 /* 395 * (non-Javadoc) 396 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 397 */ 398 public Parameter createParameter(final String name, 399 final String value) throws URISyntaxException { 390 400 Related parameter = new Related(value); 391 401 if (Related.START.equals(parameter)) { … … 405 415 private ParameterFactory createRelTypeFactory() { 406 416 return new ParameterFactory() { 407 /* (non-Javadoc) 408 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 409 */ 410 public Parameter createParameter(final String name, final String value) 411 throws URISyntaxException { 417 /* 418 * (non-Javadoc) 419 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 420 */ 421 public Parameter createParameter(final String name, 422 final String value) throws URISyntaxException { 412 423 RelType parameter = new RelType(value); 413 424 if (RelType.PARENT.equals(parameter)) { … … 430 441 private ParameterFactory createRoleFactory() { 431 442 return new ParameterFactory() { 432 /* (non-Javadoc) 433 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 434 */ 435 public Parameter createParameter(final String name, final String value) 436 throws URISyntaxException { 443 /* 444 * (non-Javadoc) 445 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 446 */ 447 public Parameter createParameter(final String name, 448 final String value) throws URISyntaxException { 437 449 Role parameter = new Role(value); 438 450 if (Role.CHAIR.equals(parameter)) { … … 458 470 private ParameterFactory createRsvpFactory() { 459 471 return new ParameterFactory() { 460 /* (non-Javadoc) 461 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 462 */ 463 public Parameter createParameter(final String name, final String value) 464 throws URISyntaxException { 472 /* 473 * (non-Javadoc) 474 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 475 */ 476 public Parameter createParameter(final String name, 477 final String value) throws URISyntaxException { 465 478 Rsvp parameter = new Rsvp(value); 466 479 if (Rsvp.TRUE.equals(parameter)) { … … 480 493 private ParameterFactory createSentByFactory() { 481 494 return new ParameterFactory() { 482 /* (non-Javadoc) 483 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 484 */ 485 public Parameter createParameter(final String name, final String value) 486 throws URISyntaxException { 495 /* 496 * (non-Javadoc) 497 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 498 */ 499 public Parameter createParameter(final String name, 500 final String value) throws URISyntaxException { 487 501 return new SentBy(value); 488 502 } … … 510 524 private ParameterFactory createTzIdFactory() { 511 525 return new ParameterFactory() { 512 /* (non-Javadoc) 513 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 514 */ 515 public Parameter createParameter(final String name, final String value) 516 throws URISyntaxException { 526 /* 527 * (non-Javadoc) 528 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 529 */ 530 public Parameter createParameter(final String name, 531 final String value) throws URISyntaxException { 517 532 return new TzId(value); 518 533 } … … 525 540 private ParameterFactory createValueFactory() { 526 541 return new ParameterFactory() { 527 /* (non-Javadoc) 528 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 529 */ 530 public Parameter createParameter(final String name, final String value) 531 throws URISyntaxException { 542 /* 543 * (non-Javadoc) 544 * @see net.fortuna.ical4j.model.ParameterFactory#createParameter(java.lang.String, java.lang.String) 545 */ 546 public Parameter createParameter(final String name, 547 final String value) throws URISyntaxException { 532 548 Value parameter = new Value(value); 533 549 if (Value.BINARY.equals(parameter)) { … … 587 603 /** 588 604 * Creates a parameter. 589 * 590 * @param name 591 * name of the parameter 592 * @param value 593 * a parameter value 605 * @param name name of the parameter 606 * @param value a parameter value 594 607 * @return a component 595 * @throws URISyntaxException thrown when the specified string 596 * is not a valid representation of a URI for selectedparameters608 * @throws URISyntaxException thrown when the specified string is not a valid representation of a URI for selected 609 * parameters 597 610 */ 598 611 public Parameter createParameter(final String name, final String value) … … 605 618 return new XParameter(name, value); 606 619 } 620 else if (allowIllegalNames()) { 621 return new XParameter(name, value); 622 } 607 623 else { 608 throw new IllegalArgumentException("Invalid parameter name: " + name); 624 throw new IllegalArgumentException("Invalid parameter name: " 625 + name); 609 626 } 610 627 } external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/ParameterList.java
r1267 r1366 1 1 /* 2 * $Id: ParameterList.java,v 1.1 2 2006/10/22 12:45:28fortuna Exp $ [Apr 5, 2004]2 * $Id: ParameterList.java,v 1.13 2007/01/28 02:07:14 fortuna Exp $ [Apr 5, 2004] 3 3 * 4 4 * Copyright (c) 2004, Ben Fortuna … … 23 23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 26 26 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 27 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, … … 45 45 46 46 /** 47 * Defines a list of iCalendar parameters. A parameter list may be specified as 48 * unmodifiable at instantiation - useful for constant properties that you don't 49 * want modified. 50 * 47 * Defines a list of iCalendar parameters. A parameter list may be specified as unmodifiable at instantiation - useful 48 * for constant properties that you don't want modified. 51 49 * @author Ben Fortuna 52 50 */ 53 51 public class ParameterList implements Serializable { 54 52 55 53 private static final long serialVersionUID = -1913059830016450169L; 56 54 … … 63 61 this(false); 64 62 } 65 63 66 64 /** 67 65 * Constructor. … … 75 73 } 76 74 } 77 78 /** 79 * Creates a deep copy of the specified parameter list. That is, 80 * copies of all parameters in the specified list are added to 81 * this list. 75 76 /** 77 * Creates a deep copy of the specified parameter list. That is, copies of all parameters in the specified list are 78 * added to this list. 82 79 * @param list a parameter list to copy parameters from 83 80 * @throws URISyntaxException 84 81 */ 85 public ParameterList(final ParameterList list, final boolean unmodifiable) throws URISyntaxException { 82 public ParameterList(final ParameterList list, final boolean unmodifiable) 83 throws URISyntaxException { 86 84 parameters = new ArrayList(); 87 85 for (Iterator i = list.iterator(); i.hasNext();) { 88 86 Parameter parameter = (Parameter) i.next(); 89 parameters.add(ParameterFactoryImpl.getInstance().createParameter(parameter.getName(), parameter.getValue())); 87 parameters.add(ParameterFactoryImpl.getInstance().createParameter( 88 parameter.getName(), parameter.getValue())); 90 89 } 91 90 if (unmodifiable) { … … 112 111 /** 113 112 * Returns the first parameter with the specified name. 114 * 115 * @param aName 116 * name of the parameter 113 * @param aName name of the parameter 117 114 * @return the first matching parameter or null if no matching parameters 118 115 */ … … 122 119 Parameter p = (Parameter) i.next(); 123 120 124 if (aName.equals (p.getName())) {121 if (aName.equalsIgnoreCase(p.getName())) { 125 122 return p; 126 123 } … … 132 129 /** 133 130 * Returns a list of parameters with the specified name. 134 * @param name 135 * name of parameters to return 131 * @param name name of parameters to return 136 132 * @return a parameter list 137 133 */ … … 142 138 Parameter p = (Parameter) i.next(); 143 139 144 if (p.getName().equals (name)) {140 if (p.getName().equalsIgnoreCase(name)) { 145 141 list.add(p); 146 142 } … … 150 146 151 147 /** 152 * Add a parameter to the list. Note that this method will not remove existing 153 * parameters of the same type. To achieve this use { @link ParameterList#replace(Parameter) } 148 * Add a parameter to the list. Note that this method will not remove existing parameters of the same type. To 149 * achieve this use { 150 * @link ParameterList#replace(Parameter) } 154 151 * @param parameter the parameter to add 155 152 * @return true … … 159 156 return parameters.add(parameter); 160 157 } 161 158 162 159 /** 163 160 * Replace any parameters of the same type with the one specified. 164 * @param parameter parameter to add to this list in place of all others with 165 * the same name 161 * @param parameter parameter to add to this list in place of all others with the same name 166 162 * @return true if successfully added to this list 167 163 */ 168 164 public final boolean replace(final Parameter parameter) { 169 for (Iterator i = getParameters(parameter.getName()).iterator(); i.hasNext();) { 165 for (Iterator i = getParameters(parameter.getName()).iterator(); i 166 .hasNext();) { 170 167 remove((Parameter) i.next()); 171 168 } … … 208 205 209 206 /** 210 * Uses {@link ObjectUtils} to test equality. 211 * Two parameter lists are equals if and only if 212 * they contain the same set of parameters. 207 * Uses {@link ObjectUtils} to test equality. Two parameter lists are equals if and only if they contain the same 208 * set of parameters. 213 209 * @see java.lang.Object#equals(java.lang.Object) 214 210 */ external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/Period.java
r1267 r1366 1 1 /* 2 * $Id: Period.java,v 1.1 3 2006/10/22 12:45:27fortuna Exp $ [Apr 14, 2004]2 * $Id: Period.java,v 1.15 2007/01/28 04:04:04 fortuna Exp $ [Apr 14, 2004] 3 3 * 4 4 * Copyright (c) 2005, Ben Fortuna … … 47 47 * rely on the returned values from the getters to deduce whether a period has 48 48 * an explicit end date or duration. 49 * 49 * 50 50 * @author Ben Fortuna 51 51 */ 52 52 public class Period implements Serializable, Comparable { 53 53 54 public static final int INCLUSIVE_START = 1; 55 56 public static final int INCLUSIVE_END = 2; 57 54 58 private static final long serialVersionUID = 7321090422911676490L; 55 59 … … 62 66 /** 63 67 * Constructor. 64 * 68 * 65 69 * @param aValue 66 70 * a string representation of a period … … 74 78 try { 75 79 end = new DateTime(aValue.substring(aValue.indexOf('/') + 1)); 76 } catch (ParseException pe) { 80 } 81 catch (ParseException pe) { 77 82 // duration = DurationFormat.getInstance().parse(aValue); 78 83 duration = new Dur(aValue); … … 82 87 /** 83 88 * Constructs a new period with the specied start and end date. 84 * 89 * 85 90 * @param start 86 91 * the start date of the period … … 91 96 this.start = start; 92 97 this.end = end; 98 99 // ensure the end timezone is the same as the start.. 100 if (end != null) { 101 if (start.isUtc()) { 102 end.setUtc(true); 103 } 104 else { 105 end.setTimeZone(start.getTimeZone()); 106 } 107 } 93 108 } 94 109 95 110 /** 96 111 * Constructs a new period with the specified start date and duration. 97 * 112 * 98 113 * @param start 99 114 * the start date of the period … … 109 124 * Returns the duration of this period. If an explicit duration is not 110 125 * specified, the duration is derived from the end date. 111 * 126 * 112 127 * @return the duration of this period in milliseconds. 113 128 */ … … 122 137 * Returns the end date of this period. If an explicit end date is not 123 138 * specified, the end date is derived from the duration. 124 * 139 * 125 140 * @return the end date of this period. 126 141 */ … … 146 161 * @param date 147 162 * @return true if the specified date occurs within the current period 148 * 163 * 149 164 */ 150 165 public final boolean includes(final Date date) { 151 return includes(date, true); 166 return includes(date, INCLUSIVE_START | INCLUSIVE_END); 167 } 168 169 /** 170 * @param date 171 * @param inclusive 172 * @return 173 * @deprecated use {@link Period#includes(Date, int)} instead. 174 */ 175 public final boolean includes(final Date date, boolean inclusive) { 176 if (inclusive) { 177 return includes(date, INCLUSIVE_START | INCLUSIVE_END); 178 } 179 else { 180 return includes(date, 0); 181 } 152 182 } 153 183 … … 159 189 * @return true if the date is in the perod, false otherwise 160 190 */ 161 public final boolean includes(final Date date, final boolean inclusive) { 162 if (inclusive) { 163 return (!getStart().after(date) && !getEnd().before(date)); 164 } 165 return (getStart().before(date) && getEnd().after(date)); 191 public final boolean includes(final Date date, final int inclusiveMask) { 192 boolean includes = true; 193 if ((inclusiveMask & INCLUSIVE_START) > 0) { 194 includes = includes && !getStart().after(date); 195 } 196 else { 197 includes = includes && getStart().before(date); 198 } 199 if ((inclusiveMask & INCLUSIVE_END) > 0) { 200 includes = includes && !getEnd().before(date); 201 } 202 else { 203 includes = includes && getEnd().after(date); 204 } 205 return includes; 166 206 } 167 207 168 208 /** 169 209 * Decides whether this period is completed before the given period starts. 170 * 210 * 171 211 * @param period 172 212 * a period that may or may not start after this period ends … … 180 220 /** 181 221 * Decides whether this period starts after the given period ends. 182 * 222 * 183 223 * @param period 184 224 * a period that may or may not end before this period starts … … 192 232 /** 193 233 * Decides whether this period intersects with another one. 194 * 234 * 195 235 * @param period 196 236 * a possible intersecting period … … 215 255 /** 216 256 * Decides whether these periods are serial without a gap. 217 * 257 * 218 258 * @return true if one period immediately follows the other, false otherwise 219 259 */ … … 229 269 /** 230 270 * Decides whether the given period is completely contained within this one. 231 * 271 * 232 272 * @param period 233 273 * the period that may be contained by this one … … 245 285 * periods are specified by explicitly setting a start date and end date 246 286 * (i.e. durations are implied). 247 * 287 * 248 288 * @param period 249 289 * the period to add to this one … … 271 311 272 312 return new Period(newPeriodStart, newPeriodEnd); 313 } 314 315 /** 316 * Updates the start and (possible) end times of this period to reflect 317 * the specified UTC timezone status. 318 * @param utc 319 */ 320 public void setUtc(boolean utc) { 321 if (utc) { 322 start.setUtc(true); 323 if (end != null) { 324 getEnd().setUtc(true); 325 } 326 } 327 else { 328 start.setTimeZone(null); 329 if (end != null) { 330 getEnd().setTimeZone(null); 331 } 332 } 333 } 334 335 /** 336 * Updates the start and (possible) end times of this period to reflect 337 * the specified timezone status. 338 * @param timezone 339 */ 340 public final void setTimeZone(final TimeZone timezone) { 341 start.setUtc(false); 342 start.setTimeZone(timezone); 343 if (end != null) { 344 getEnd().setUtc(false); 345 getEnd().setTimeZone(timezone); 346 } 273 347 } 274 348 … … 291 365 /* 292 366 * (non-Javadoc) 293 * 367 * 294 368 * @see java.lang.Comparable#compareTo(java.lang.Object) 295 369 */ … … 300 374 /** 301 375 * Compares the specified period with this period. 302 * 376 * 303 377 * @param arg0 304 378 * @return external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/PeriodList.java
r1267 r1366 1 1 /* 2 * $Id: PeriodList.java,v 1.1 3 2005/11/03 12:27:42fortuna Exp $ [23-Apr-2004]2 * $Id: PeriodList.java,v 1.14 2006/12/17 11:25:51 fortuna Exp $ [23-Apr-2004] 3 3 * 4 4 * Copyright (c) 2004, Ben Fortuna … … 44 44 * <code>java.util.SortedSet</code> interface period lists will always be 45 45 * sorted according to natural ordering. 46 * 46 * 47 47 * @author Ben Fortuna 48 48 */ … … 51 51 private static final long serialVersionUID = -6319585959747194724L; 52 52 53 private TimeZone timezone; 54 55 private boolean utc; 56 53 57 /** 54 58 * Default constructor. 55 59 */ 56 60 public PeriodList() { 61 this(true); 62 } 63 64 /** 65 * @param utc 66 */ 67 public PeriodList(boolean utc) { 68 this.utc = utc; 57 69 } 58 70 59 71 /** 60 72 * Parses the specified string representation to create a list of periods. 61 * 73 * 62 74 * @param aValue 63 75 * a string representation of a list of periods … … 89 101 /** 90 102 * Add a period to the list. 91 * 103 * 92 104 * @param period 93 105 * the period to add … … 96 108 */ 97 109 public final boolean add(final Period period) { 110 if (isUtc()) { 111 period.setUtc(true); 112 } 113 else { 114 period.setTimeZone(timezone); 115 } 98 116 return add((Object) period); 99 117 } … … 102 120 * Overrides superclass to throw an <code>IllegalArgumentException</code> 103 121 * where argument is not a <code>net.fortuna.ical4j.model.Period</code>. 104 * 105 * @see List#add(E)122 * 123 * @see java.util.List#add(E) 106 124 */ 107 125 public final boolean add(final Object arg0) { … … 115 133 /** 116 134 * Remove a period from the list. 117 * 135 * 118 136 * @param period 119 137 * the period to remove … … 130 148 * periods, and combining adjacent periods. NOTE: If the period list is 131 149 * already normalised then this period list is returned. 132 * 150 * 133 151 * @return a period list 134 152 */ … … 180 198 * this list. Normalisation is also performed automatically after all 181 199 * periods have been added. 182 * 200 * 183 201 * @param periods 184 202 */ … … 199 217 * periods from this list and returns the results as a new period list. If 200 218 * no intersection is identified this list is returned. 201 * 219 * 202 220 * @param periods 203 221 * a list of periods to subtract from this list … … 257 275 return this; 258 276 } 277 278 /** 279 * Indicates whether this list is in local or UTC format. 280 * @return Returns true if in UTC format, otherwise false. 281 */ 282 public final boolean isUtc() { 283 return utc; 284 } 285 286 /** 287 * Sets whether this list is in UTC or local time format. 288 * @param utc The utc to set. 289 */ 290 public final void setUtc(final boolean utc) { 291 for (Iterator i = iterator(); i.hasNext();) { 292 Period period = (Period) i.next(); 293 period.setUtc(utc); 294 } 295 this.timezone = null; 296 this.utc = utc; 297 } 298 299 /** 300 * Applies the specified timezone to all dates in the list. 301 * All dates added to this list will also have this timezone 302 * applied. 303 * @param timezone 304 */ 305 public final void setTimeZone(final TimeZone timeZone) { 306 for (Iterator i = iterator(); i.hasNext();) { 307 Period period = (Period) i.next(); 308 period.setTimeZone(timeZone); 309 } 310 this.timezone = timeZone; 311 this.utc = false; 312 } 313 314 /** 315 * @return Returns the timeZone. 316 */ 317 public final TimeZone getTimeZone() { 318 return timezone; 319 } 259 320 } external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/PropertyFactoryImpl.java
r1364 r1366 1 1 /* 2 * $Id: PropertyFactoryImpl.java,v 1. 9 2006/11/11 04:43:29fortuna Exp $ [05-Apr-2004]2 * $Id: PropertyFactoryImpl.java,v 1.10 2007/01/28 02:41:56 fortuna Exp $ [05-Apr-2004] 3 3 * 4 4 * Copyright (c) 2004, Ben Fortuna … … 37 37 import java.net.URISyntaxException; 38 38 import java.text.ParseException; 39 import java.util.HashMap;40 import java.util.Map;41 39 42 40 import net.fortuna.ical4j.model.property.Action; … … 96 94 import net.fortuna.ical4j.model.property.Version; 97 95 import net.fortuna.ical4j.model.property.XProperty; 98 import net.fortuna.ical4j.util.CompatibilityHints;99 96 100 97 /** … … 103 100 * @author Ben Fortuna 104 101 */ 105 public final class PropertyFactoryImpl implements PropertyFactory { 102 public final class PropertyFactoryImpl extends AbstractContentFactory implements 103 PropertyFactory { 106 104 107 105 private static PropertyFactoryImpl instance = new PropertyFactoryImpl(); 108 106 109 private Map factories;110 111 private boolean allowIllegalNames;112 113 107 /** 114 108 * Constructor made private to prevent instantiation. 115 109 */ 116 110 private PropertyFactoryImpl() { 117 allowIllegalNames = CompatibilityHints118 .isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING);119 factories = new HashMap();120 111 factories.put(Property.ACTION, createActionFactory()); 121 112 factories.put(Property.ATTACH, createAttachFactory()); … … 1626 1617 return new XProperty(name); 1627 1618 } 1628 else if (allowIllegalNames ) {1619 else if (allowIllegalNames()) { 1629 1620 return new XProperty(name); 1630 1621 } … … 1652 1643 return new XProperty(name, parameters, value); 1653 1644 } 1654 else if (allowIllegalNames ) {1645 else if (allowIllegalNames()) { 1655 1646 return new XProperty(name); 1656 1647 } external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/PropertyList.java
r1267 r1366 1 1 /* 2 * $Id: PropertyList.java,v 1. 8 2005/09/28 09:03:53fortuna Exp $ [Apr 5, 2004]2 * $Id: PropertyList.java,v 1.9 2007/01/28 02:04:31 fortuna Exp $ [Apr 5, 2004] 3 3 * 4 4 * Copyright (c) 2004, Ben Fortuna … … 23 23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 26 26 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 27 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, … … 40 40 /** 41 41 * Defines a list of iCalendar properties. 42 *43 42 * @author Ben Fortuna 44 43 */ 45 44 public class PropertyList extends ArrayList implements Serializable { 46 45 47 46 private static final long serialVersionUID = -8875923766224921031L; 48 47 … … 80 79 for (Iterator i = iterator(); i.hasNext();) { 81 80 Property p = (Property) i.next(); 82 if (p.getName().equals (aName)) {81 if (p.getName().equalsIgnoreCase(aName)) { 83 82 return p; 84 83 } … … 89 88 /** 90 89 * Returns a list of properties with the specified name. 91 * @param name 92 * name of properties to return 90 * @param name name of properties to return 93 91 * @return a property list 94 92 */ … … 97 95 for (Iterator i = iterator(); i.hasNext();) { 98 96 Property p = (Property) i.next(); 99 if (p.getName().equals (name)) {97 if (p.getName().equalsIgnoreCase(name)) { 100 98 list.add(p); 101 99 } … … 108 106 * @param property the property to add 109 107 * @return true 110 * @see List#add(java.lang.Object)108 * @see java.util.List#add(java.lang.Object) 111 109 */ 112 110 public final boolean add(final Property property) { 113 111 return add((Object) property); 114 112 } 115 113 116 114 /** 117 * Overrides superclass to throw an <code>IllegalArgumentException</code> 118 * where argument is not a<code>net.fortuna.ical4j.model.Property</code>.119 * @see List#add(E)115 * Overrides superclass to throw an <code>IllegalArgumentException</code> where argument is not a 116 * <code>net.fortuna.ical4j.model.Property</code>. 117 * @see java.util.List#add(E) 120 118 */ 121 119 public final boolean add(final Object arg0) { 122 120 if (!(arg0 instanceof Property)) { 123 throw new IllegalArgumentException("Argument not a " + Property.class.getName()); 121 throw new IllegalArgumentException("Argument not a " 122 + Property.class.getName()); 124 123 } 125 124 return super.add(arg0); … … 127 126 128 127 /** 129 * @return boolean indicates if the list is empty130 * @see List#isEmpty()131 */132 // public final boolean isEmpty() {133 // return properties.isEmpty();134 // }135 136 /**137 * @return an iterator138 * @see List#iterator()139 */140 // public final Iterator iterator() {141 // return properties.iterator();142 // }143 144 /**145 128 * Remove a property from the list. 146 129 * @param property the property to remove 147 130 * @return true if the list contained the specified property 148 * @see List#remove(java.lang.Object)131 * @see java.util.List#remove(java.lang.Object) 149 132 */ 150 133 public final boolean remove(final Property property) { 151 134 return remove((Object) property); 152 135 } 153 154 /**155 * @return the number of properties in the list156 * @see List#size()157 */158 // public final int size() {159 // return properties.size();160 // }161 136 } external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/Recur.java
r1364 r1366 1 1 /* 2 * $Id: Recur.java,v 1.3 0 2006/11/11 07:42:10fortuna Exp $ [18-Apr-2004]2 * $Id: Recur.java,v 1.31 2007/01/04 04:47:56 fortuna Exp $ [18-Apr-2004] 3 3 * 4 4 * Copyright (c) 2004, Ben Fortuna … … 34 34 package net.fortuna.ical4j.model; 35 35 36 import java.io.IOException; 36 37 import java.io.Serializable; 37 38 import java.text.ParseException; … … 1078 1079 this.count = -1; 1079 1080 } 1081 1082 /** 1083 * @param stream 1084 * @throws IOException 1085 * @throws ClassNotFoundException 1086 */ 1087 private void readObject(java.io.ObjectInputStream stream) 1088 throws IOException, ClassNotFoundException { 1089 1090 stream.defaultReadObject(); 1091 log = LogFactory.getLog(Recur.class); 1092 } 1080 1093 } external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/UtcOffset.java
r1267 r1366 1 1 /* 2 * $Id: UtcOffset.java,v 1. 7 2006/10/22 12:45:28fortuna Exp $2 * $Id: UtcOffset.java,v 1.8 2007/01/04 04:47:56 fortuna Exp $ 3 3 * 4 4 * Created on 26/06/2005 … … 36 36 package net.fortuna.ical4j.model; 37 37 38 import java.io.IOException; 38 39 import java.io.Serializable; 39 40 import java.text.DecimalFormat; … … 54 55 55 56 private static final long serialVersionUID = 5883111996721531728L; 56 57 57 58 private static final int HOUR_START_INDEX = 1; 58 59 … … 73 74 private static final NumberFormat SECOND_FORMAT = new DecimalFormat("00"); 74 75 75 private Log log = LogFactory.getLog(UtcOffset.class);76 private transient Log log = LogFactory.getLog(UtcOffset.class); 76 77 77 78 private long offset; … … 164 165 return new HashCodeBuilder().append(getOffset()).toHashCode(); 165 166 } 167 168 /** 169 * @param stream 170 * @throws IOException 171 * @throws ClassNotFoundException 172 */ 173 private void readObject(java.io.ObjectInputStream stream) 174 throws IOException, ClassNotFoundException { 175 176 stream.defaultReadObject(); 177 log = LogFactory.getLog(UtcOffset.class); 178 } 166 179 } external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/component/Observance.java
r1364 r1366 1 1 /* 2 * $Id: Observance.java,v 1.1 3 2006/11/05 05:07:57fortuna Exp $ [05-Apr-2004]2 * $Id: Observance.java,v 1.15 2007/01/28 05:50:45 fortuna Exp $ [05-Apr-2004] 3 3 * 4 4 * Copyright (c) 2005, Ben Fortuna … … 34 34 package net.fortuna.ical4j.model.component; 35 35 36 import java.io.IOException; 36 37 import java.util.Calendar; 37 38 import java.util.Collections; … … 39 40 import java.util.Map; 40 41 import java.util.TreeMap; 41 42 import org.apache.commons.logging.Log;43 import org.apache.commons.logging.LogFactory;44 42 45 43 import net.fortuna.ical4j.model.Component; … … 60 58 import net.fortuna.ical4j.util.PropertyValidator; 61 59 60 import org.apache.commons.logging.Log; 61 import org.apache.commons.logging.LogFactory; 62 62 63 /** 63 64 * Defines an iCalendar sub-component representing a timezone observance. Class made abstract such that only Standard … … 74 75 public static final String DAYLIGHT = "DAYLIGHT"; 75 76 76 private Log log = LogFactory.getLog(Observance.class);77 private transient Log log = LogFactory.getLog(Observance.class); 77 78 78 79 // TODO: clear cache when observance definition changes (??) … … 260 261 for (Iterator i = onsets.keySet().iterator(); i.hasNext();) { 261 262 Period onsetPeriod = (Period) i.next(); 262 if (onsetPeriod.includes(date )) {263 if (onsetPeriod.includes(date, Period.INCLUSIVE_START)) { 263 264 return (Date) onsets.get(onsetPeriod); 264 265 } … … 309 310 return dtStart.getDate().compareTo(dtStart0.getDate()); 310 311 } 312 313 /** 314 * @param stream 315 * @throws IOException 316 * @throws ClassNotFoundException 317 */ 318 private void readObject(java.io.ObjectInputStream stream) 319 throws IOException, ClassNotFoundException { 320 stream.defaultReadObject(); 321 log = LogFactory.getLog(Observance.class); 322 } 311 323 } external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/component/VFreeBusy.java
r1267 r1366 1 1 /* 2 * $Id: VFreeBusy.java,v 1.2 5 2006/11/05 05:07:57fortuna Exp $ [Apr 5, 2004]2 * $Id: VFreeBusy.java,v 1.26 2007/01/04 04:48:39 fortuna Exp $ [Apr 5, 2004] 3 3 * 4 4 * Copyright (c) 2005, Ben Fortuna … … 35 35 package net.fortuna.ical4j.model.component; 36 36 37 import java.io.IOException; 37 38 import java.util.Iterator; 38 39 … … 226 227 private static final long serialVersionUID = 1046534053331139832L; 227 228 228 private Log log = LogFactory.getLog(VFreeBusy.class);229 private transient Log log = LogFactory.getLog(VFreeBusy.class); 229 230 230 231 /** … … 534 535 return (Uid) getProperty(Property.UID); 535 536 } 537 538 /** 539 * @param stream 540 * @throws IOException 541 * @throws ClassNotFoundException 542 */ 543 private void readObject(java.io.ObjectInputStream stream) 544 throws IOException, ClassNotFoundException { 545 546 stream.defaultReadObject(); 547 log = LogFactory.getLog(VFreeBusy.class); 548 } 536 549 } external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/parameter/AltRep.java
r1267 r1366 1 1 /* 2 * $Id: AltRep.java,v 1.1 0 2006/11/05 08:08:45fortuna Exp $ [18-Apr-2004]2 * $Id: AltRep.java,v 1.11 2007/02/10 08:45:56 fortuna Exp $ [18-Apr-2004] 3 3 * 4 4 * Copyright (c) 2004, Ben Fortuna … … 56 56 */ 57 57 public AltRep(final String aValue) throws URISyntaxException { 58 this( new URI(Uris.encode(Strings.unquote(aValue))));58 this(Uris.create(Strings.unquote(aValue))); 59 59 } 60 60 external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/parameter/Dir.java
r1267 r1366 1 1 /* 2 * $Id: Dir.java,v 1.1 0 2006/11/05 08:08:45fortuna Exp $ [18-Apr-2004]2 * $Id: Dir.java,v 1.11 2007/02/10 08:45:56 fortuna Exp $ [18-Apr-2004] 3 3 * 4 4 * Copyright (c) 2004, Ben Fortuna … … 56 56 */ 57 57 public Dir(final String aValue) throws URISyntaxException { 58 this( new URI(Uris.encode(Strings.unquote(aValue))));58 this(Uris.create(Strings.unquote(aValue))); 59 59 } 60 60 external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/parameter/SentBy.java
r1267 r1366 1 1 /* 2 * $Id: SentBy.java,v 1.1 0 2006/11/05 08:08:45fortuna Exp $ [18-Apr-2004]2 * $Id: SentBy.java,v 1.11 2007/02/10 08:45:56 fortuna Exp $ [18-Apr-2004] 3 3 * 4 4 * Copyright (c) 2004, Ben Fortuna … … 56 56 */ 57 57 public SentBy(final String aValue) throws URISyntaxException { 58 this( new URI(Uris.encode(Strings.unquote(aValue))));58 this(Uris.create(Strings.unquote(aValue))); 59 59 } 60 60 external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Attach.java
r1364 r1366 1 1 /* 2 * $Id: Attach.java,v 1.1 6 2006/11/05 08:12:20fortuna Exp $2 * $Id: Attach.java,v 1.18 2007/02/10 08:45:56 fortuna Exp $ 3 3 * 4 4 * Created: [Apr 6, 2004] … … 114 114 private static final long serialVersionUID = 4439949507756383452L; 115 115 116 private Log log = LogFactory.getLog(Attach.class);116 private transient Log log = LogFactory.getLog(Attach.class); 117 117 118 118 private URI uri; … … 220 220 } 221 221 222 /* 223 * (non-Javadoc) 224 * @see net.fortuna.ical4j.model.Property#setValue(java.lang.String) 222 /** 223 * Sets the current value of the Attach instance. If the specified 224 * value is encoded binary data, the value is decoded and stored in 225 * the binary field. Otherwise the value is assumed to be a URI 226 * location to binary data and is stored as such. 225 227 */ 226 228 public void setValue(final String aValue) throws IOException, 227 229 URISyntaxException { 230 228 231 // determine if ATTACH is a URI or an embedded 229 232 // binary.. … … 245 248 // assume URI.. 246 249 else { 247 uri = new URI(Uris.encode(aValue));250 uri = Uris.create(aValue); 248 251 } 249 252 } … … 292 295 this.binary = null; 293 296 } 297 298 /** 299 * @param stream 300 * @throws IOException 301 * @throws ClassNotFoundException 302 */ 303 private void readObject(java.io.ObjectInputStream stream) 304 throws IOException, ClassNotFoundException { 305 306 stream.defaultReadObject(); 307 log = LogFactory.getLog(Attach.class); 308 } 294 309 } external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Attendee.java
r1267 r1366 1 1 /* 2 * $Id: Attendee.java,v 1.1 0 2006/11/05 06:04:42fortuna Exp $3 * 2 * $Id: Attendee.java,v 1.11 2007/02/10 08:45:56 fortuna Exp $ 3 * 4 4 * Created: [Apr 6, 2004] 5 5 * … … 106 106 */ 107 107 public void setValue(final String aValue) throws URISyntaxException { 108 calAddress = new URI(Uris.encode(aValue));108 calAddress = Uris.create(aValue); 109 109 } 110 110 external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/DateListProperty.java
r1267 r1366 1 1 /* 2 * $Id: DateListProperty.java,v 1. 6 2006/11/05 06:04:42fortuna Exp $2 * $Id: DateListProperty.java,v 1.8 2006/12/17 11:25:56 fortuna Exp $ 3 3 * 4 4 * Created on 11/08/2005 … … 120 120 * @param timezone a timezone to associate with this property 121 121 */ 122 public final void setTimeZone(final TimeZone timezone) { 122 public void setTimeZone(final TimeZone timezone) { 123 if (dates == null) { 124 throw new UnsupportedOperationException( 125 "TimeZone is not applicable to current value"); 126 } 123 127 this.timezone = timezone; 124 128 if (timezone != null) { … … 145 149 */ 146 150 public final void setUtc(final boolean utc) { 147 if ( !Value.DATE_TIME.equals(dates.getType())) {151 if (dates == null || !Value.DATE_TIME.equals(dates.getType())) { 148 152 throw new UnsupportedOperationException( 149 153 "TimeZone is not applicable to current value"); external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/DateProperty.java
r1267 r1366 1 1 /* 2 * $Id: DateProperty.java,v 1.1 5 2006/11/05 06:04:42fortuna Exp $2 * $Id: DateProperty.java,v 1.16 2007/01/07 06:39:18 fortuna Exp $ 3 3 * 4 4 * Created on 9/07/2005 … … 77 77 78 78 /** 79 * Creates a new instance of the named property with an initial timezone. 80 * @param name property name 81 * @param timezone initial timezone 82 */ 83 public DateProperty(final String name, TimeZone timezone) { 84 super(name); 85 setTimeZone(timezone); 86 } 87 88 /** 79 89 * @return Returns the date. 80 90 */ … … 91 101 setTimeZone(((DateTime) date).getTimeZone()); 92 102 } 103 else { 104 // ensure timezone is null for VALUE=DATE properties.. 105 setTimeZone(null); 106 } 93 107 this.date = date; 94 108 } … … 96 110 /** 97 111 * Default setValue() implementation. Allows for either DATE or DATE-TIME values. 98 */99 /*100 * (non-Javadoc)101 * @see net.fortuna.ical4j.model.Property#setValue(java.lang.String)102 112 */ 103 113 public void setValue(final String value) throws ParseException { 104 114 // value can be either a date-time or a date.. 105 115 if (Value.DATE.equals(getParameter(Parameter.VALUE))) { 116 // ensure timezone is null for VALUE=DATE properties.. 117 setTimeZone(null); 106 118 this.date = new Date(value); 107 119 } … … 136 148 ((DateTime) getDate()).setTimeZone(timezone); 137 149 } 138 getParameters().remove(getParameter(Parameter.TZID)); 150 139 151 TzId tzId = new TzId(timezone.getID()); 140 152 getParameters().replace(tzId); external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/DtEnd.java
r1267 r1366 1 1 /* 2 * $Id: DtEnd.java,v 1.1 7 2006/11/05 06:04:43fortuna Exp $3 * 2 * $Id: DtEnd.java,v 1.18 2007/01/07 06:39:18 fortuna Exp $ 3 * 4 4 * Created: [Apr 6, 2004] 5 5 * … … 40 40 import net.fortuna.ical4j.model.Date; 41 41 import net.fortuna.ical4j.model.ParameterList; 42 import net.fortuna.ical4j.model.TimeZone; 42 43 import net.fortuna.ical4j.model.ValidationException; 43 44 44 45 /** 45 46 * Defines a DTEND iCalendar component property. 46 * 47 * 47 48 * <pre> 48 49 * 4.8.2.2 Date/Time End 49 * 50 * 50 51 * Property Name: DTEND 51 * 52 * 52 53 * Purpose: This property specifies the date and time that a calendar 53 54 * component ends. 54 * 55 * 55 56 * Value Type: The default value type is DATE-TIME. The value type can 56 57 * be set to a DATE value type. 57 * 58 * 58 59 * Property Parameters: Non-standard, value data type, time zone 59 60 * identifier property parameters can be specified on this property. 60 * 61 * 61 62 * Conformance: This property can be specified in "VEVENT" or 62 63 * "VFREEBUSY" calendar components. 63 * 64 * 64 65 * Description: Within the "VEVENT" calendar component, this property 65 66 * defines the date and time by which the event ends. The value MUST be 66 67 * later in time than the value of the "DTSTART" property. 67 * 68 * 68 69 * Within the "VFREEBUSY" calendar component, this property defines the 69 70 * end date and time for the free or busy time information. The time 70 71 * MUST be specified in the UTC time format. The value MUST be later in 71 72 * time than the value of the "DTSTART" property. 72 * 73 * 73 74 * Format Definition: The property is defined by the following notation: 74 * 75 * 75 76 * dtend = "DTEND" dtendparam":" dtendval CRLF 76 * 77 * 77 78 * dtendparam = *( 78 * 79 * 79 80 * ; the following are optional, 80 81 * ; but MUST NOT occur more than once 81 * 82 * 82 83 * (";" "VALUE" "=" ("DATE-TIME" / "DATE")) / 83 84 * (";" tzidparam) / 84 * 85 * 85 86 * ; the following is optional, 86 87 * ; and MAY occur more than once 87 * 88 * 88 89 * (";" xparam) 89 * 90 * 90 91 * ) 91 * 92 * 93 * 92 * 93 * 94 * 94 95 * dtendval = date-time / date 95 96 * ;Value MUST match value type 96 97 * </pre> 97 * 98 * 98 99 * Examples: 99 * 100 * 100 101 * <pre> 101 102 * // construct an end date from a start date and a duration.. … … 104 105 * DtEnd end = new DtEnd(oneWeek.getTime(start.getDate()); 105 106 * </pre> 106 * 107 * 107 108 * @author Ben Fortuna 108 109 */ … … 119 120 120 121 /** 122 * Creates a new DTEND property initialised with the specified timezone. 123 * @param timezone initial timezone 124 */ 125 public DtEnd(TimeZone timezone) { 126 super(DTEND, timezone); 127 } 128 129 /** 121 130 * Creates a new instance initialised with the parsed value. 122 131 * @param value the DTEND value string to parse … … 129 138 130 139 /** 131 * @param aList a list of parameters for this component 140 * Creates a new DTEND property initialised with the specified timezone and value. 141 * @param value a string representation of a DTEND value 142 * @param timezone initial timezone 143 * @throws ParseException where the specified value is not a valid string 144 * representation 145 */ 146 public DtEnd(String value, TimeZone timezone) throws ParseException { 147 super(DTEND, timezone); 148 setValue(value); 149 } 150 151 /** 152 * @param aList a list of parameters for this component 132 153 * @param aValue a value string for this component 133 154 * @throws ParseException when the specified string is not a valid date/date-time representation external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/DtStart.java
r1267 r1366 1 1 /* 2 * $Id: DtStart.java,v 1.1 6 2006/11/05 06:04:43fortuna Exp $3 * 2 * $Id: DtStart.java,v 1.17 2007/01/07 06:39:18 fortuna Exp $ 3 * 4 4 * Created: [Apr 6, 2004] 5 5 * … … 40 40 import net.fortuna.ical4j.model.Date; 41 41 import net.fortuna.ical4j.model.ParameterList; 42 import net.fortuna.ical4j.model.TimeZone; 42 43 import net.fortuna.ical4j.model.ValidationException; 43 44 44 45 /** 45 46 * Defines a DTSTART iCalendar component property. 46 * 47 * 47 48 * <pre> 48 49 * 4.8.2.4 Date/Time Start 49 * 50 * 50 51 * Property Name: DTSTART 51 * 52 * 52 53 * Purpose: This property specifies when the calendar component begins. 53 * 54 * 54 55 * Value Type: The default value type is DATE-TIME. The time value MUST 55 56 * be one of the forms defined for the DATE-TIME value type. The value 56 57 * type can be set to a DATE value type. 57 * 58 * 58 59 * Property Parameters: Non-standard, value data type, time zone 59 60 * identifier property parameters can be specified on this property. 60 * 61 * 61 62 * Conformance: This property can be specified in the "VEVENT", "VTODO", 62 63 * "VFREEBUSY", or "VTIMEZONE" calendar components. 63 * 64 * 64 65 * Description: Within the "VEVENT" calendar component, this property 65 66 * defines the start date and time for the event. The property is … … 67 68 * date/time but no end date/time. In that case, the event does not take 68 69 * up any time. 69 * 70 * 70 71 * Within the "VFREEBUSY" calendar component, this property defines the 71 72 * start date and time for the free or busy time information. The time 72 73 * MUST be specified in UTC time. 73 * 74 * 74 75 * Within the "VTIMEZONE" calendar component, this property defines the 75 76 * effective start date and time for a time zone specification. This … … 77 78 * in "VTIMEZONE" calendar components and MUST be specified as a local 78 79 * DATE-TIME without the "TZID" property parameter. 79 * 80 * 80 81 * Format Definition: The property is defined by the following notation: 81 * 82 * 82 83 * dtstart = "DTSTART" dtstparam ":" dtstval CRLF 83 * 84 * 84 85 * dtstparam = *( 85 * 86 * 86 87 * ; the following are optional, 87 88 * ; but MUST NOT occur more than once 88 * 89 * 89 90 * (";" "VALUE" "=" ("DATE-TIME" / "DATE")) / 90 91 * (";" tzidparam) / 91 * 92 * 92 93 * ; the following is optional, 93 94 * ; and MAY occur more than once 94 * 95 * 95 96 * *(";" xparam) 96 * 97 * 97 98 * ) 98 * 99 * 100 * 99 * 100 * 101 * 101 102 * dtstval = date-time / date 102 103 * ;Value MUST match value type 103 104 * </pre> 104 * 105 * 105 106 * @author Ben Fortuna 106 107 */ … … 117 118 118 119 /** 120 * Creates a new DTSTART property initialised with the specified timezone. 121 * @param timezone initial timezone 122 */ 123 public DtStart(TimeZone timezone) { 124 super(DTSTART, timezone); 125 } 126 127 /** 119 128 * @param aValue a value string for this component 120 129 * @throws ParseException where the specified value string is not a valid date-time/date representation … … 123 132 super(DTSTART); 124 133 setValue(aValue); 134 } 135 136 /** 137 * Creates a new DTSTART property initialised with the specified timezone and value. 138 * @param value a string representation of a DTSTART value 139 * @param timezone initial timezone 140 * @throws ParseException where the specified value is not a valid string 141 * representation 142 */ 143 public DtStart(String value, TimeZone timezone) throws ParseException { 144 super(DTSTART, timezone); 145 setValue(value); 125 146 } 126 147 external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Due.java
r1267 r1366 1 1 /* 2 * $Id: Due.java,v 1.1 4 2006/11/05 06:04:42fortuna Exp $3 * 2 * $Id: Due.java,v 1.15 2007/01/07 06:39:18 fortuna Exp $ 3 * 4 4 * Created: [Apr 6, 2004] 5 5 * … … 41 41 import net.fortuna.ical4j.model.DateTime; 42 42 import net.fortuna.ical4j.model.ParameterList; 43 import net.fortuna.ical4j.model.TimeZone; 43 44 import net.fortuna.ical4j.model.ValidationException; 44 45 45 46 /** 46 47 * Defines a DUE iCalendar component property. 47 * 48 * 48 49 * <pre> 49 50 * 4.8.2.3 Date/Time Due 50 * 51 * 51 52 * Property Name: DUE 52 * 53 * 53 54 * Purpose: This property defines the date and time that a to-do is 54 55 * expected to be completed. 55 * 56 * 56 57 * Value Type: The default value type is DATE-TIME. The value type can 57 58 * be set to a DATE value type. 58 * 59 * 59 60 * Property Parameters: Non-standard, value data type, time zone 60 61 * identifier property parameters can be specified on this property. 61 * 62 * 62 63 * Conformance: The property can be specified once in a "VTODO" calendar 63 64 * component. 64 * 65 * 65 66 * Description: The value MUST be a date/time equal to or after the 66 67 * DTSTART value, if specified. 67 * 68 * 68 69 * Format Definition: The property is defined by the following notation: 69 * 70 * 70 71 * due = "DUE" dueparam":" dueval CRLF 71 * 72 * 72 73 * dueparam = *( 73 74 * ; the following are optional, 74 75 * ; but MUST NOT occur more than once 75 * 76 * 76 77 * (";" "VALUE" "=" ("DATE-TIME" / "DATE")) / 77 78 * (";" tzidparam) / 78 * 79 * 79 80 * ; the following is optional, 80 81 * ; and MAY occur more than once 81 * 82 * 82 83 * *(";" xparam) 83 * 84 * 84 85 * ) 85 * 86 * 87 * 86 * 87 * 88 * 88 89 * dueval = date-time / date 89 90 * ;Value MUST match value type 90 91 * </pre> 91 * 92 * 92 93 * @author Ben Fortuna 93 94 */ … … 103 104 // defaults to UTC time.. 104 105 setDate(new DateTime(true)); 106 } 107 108 /** 109 * Creates a new DUE property initialised with the specified timezone. 110 * @param timezone initial timezone 111 */ 112 public Due(TimeZone timezone) { 113 super(DUE, timezone); 114 } 115 116 /** 117 * Creates a new instance initialised with the parsed value. 118 * @param value the DUE value string to parse 119 * @throws ParseException where the specified string is not a valid DUE value representation 120 */ 121 public Due(final String value) throws ParseException { 122 super(DUE); 123 setValue(value); 124 } 125 126 /** 127 * Creates a new DUE property initialised with the specified timezone and value. 128 * @param value a string representation of a DUE value 129 * @param timezone initial timezone 130 * @throws ParseException where the specified value is not a valid string 131 * representation 132 */ 133 public Due(String value, TimeZone timezone) throws ParseException { 134 super(DUE, timezone); 135 setValue(value); 105 136 } 106 137 external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Geo.java
r1267 r1366 1 1 /* 2 * $Id: Geo.java,v 1.1 1 2006/11/05 06:04:42fortuna Exp $2 * $Id: Geo.java,v 1.12 2007/01/07 06:41:11 fortuna Exp $ 3 3 * 4 4 * Created: [Apr 6, 2004] … … 45 45 /** 46 46 * Defines a GEO iCalendar component property. 47 * 47 * 48 48 * <pre> 49 49 * 4.8.1.6 Geographic Position 50 * 50 * 51 51 * Property Name: GEO 52 * 52 * 53 53 * Purpose: This property specifies information related to the global 54 54 * position for the activity specified by a calendar component. 55 * 55 * 56 56 * Value Type: FLOAT. The value MUST be two SEMICOLON separated FLOAT 57 57 * values. 58 * 58 * 59 59 * Property Parameters: Non-standard property parameters can be 60 60 * specified on this property. 61 * 61 * 62 62 * Conformance: This property can be specified in "VEVENT" or "VTODO" 63 63 * calendar components. 64 * 64 * 65 65 * Description: The property value specifies latitude and longitude, in 66 66 * that order (i.e., "LAT LON" ordering). The longitude represents the … … 71 71 * MUST accept values of this precision and MAY truncate values of 72 72 * greater precision. 73 * 73 * 74 74 * Values for latitude and longitude shall be expressed as decimal 75 75 * fractions of degrees. Whole degrees of latitude shall be represented … … 79 79 * it shall be separated from the whole number of degrees by a decimal 80 80 * point. 81 * 81 * 82 82 * Latitudes north of the equator shall be specified by a plus sign (+), 83 83 * or by the absence of a minus sign (-), preceding the digits … … 86 86 * degrees. A point on the Equator shall be assigned to the Northern 87 87 * Hemisphere. 88 * 88 * 89 89 * Longitudes east of the prime meridian shall be specified by a plus 90 90 * sign (+), or by the absence of a minus sign (-), preceding the digits … … 97 97 * around the earth, the East Bounding Coordinate data element shall be 98 98 * assigned the value +180 (180) degrees. 99 * 99 * 100 100 * Any spatial address with a latitude of +90 (90) or -90 degrees will 101 101 * specify the position at the North or South Pole, respectively. The 102 102 * component for longitude may have any legal value. 103 * 103 * 104 104 * With the exception of the special condition described above, this 105 105 * form is specified in Department of Commerce, 1986, Representation of … … 107 107 * Information Processing Standard 70-1): Washington, Department of 108 108 * Commerce, National Institute of Standards and Technology. 109 * 109 * 110 110 * The simple formula for converting degrees-minutes-seconds into 111 111 * decimal degrees is: 112 * 112 * 113 113 * decimal = degrees + minutes/60 + seconds/3600. 114 * 114 * 115 115 * Format Definition: The property is defined by the following notation: 116 * 116 * 117 117 * geo = "GEO" geoparam ":" geovalue CRLF 118 * 118 * 119 119 * geoparam = *(";" xparam) 120 * 120 * 121 121 * geovalue = float ";" float 122 122 * ;Latitude and Longitude components 123 * 123 * 124 124 * Example: The following is an example of this property: 125 * 125 * 126 126 * GEO:37.386013;-122.082932 127 127 * </pre> 128 * 128 * 129 129 * @author Ben Fortuna 130 130 */ … … 142 142 public Geo() { 143 143 super(GEO); 144 latitude = new BigDecimal(0);145 longitude = new BigDecimal(0);144 latitude = BigDecimal.valueOf(0); 145 longitude = BigDecimal.valueOf(0); 146 146 } 147 147 external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Organizer.java
r1267 r1366 1 1 /* 2 * $Id: Organizer.java,v 1.1 0 2006/11/05 06:04:43fortuna Exp $3 * 2 * $Id: Organizer.java,v 1.12 2007/02/10 09:05:39 fortuna Exp $ 3 * 4 4 * Created: [Apr 6, 2004] 5 5 * … … 49 49 /** 50 50 * Defines an ORGANIZER iCalendar component property. 51 * 51 * 52 52 * <pre> 53 53 * 4.8.4.3 Organizer 54 * 54 * 55 55 * Property Name: ORGANIZER 56 * 56 * 57 57 * Purpose: The property defines the organizer for a calendar component. 58 * 58 * 59 59 * Value Type: CAL-ADDRESS 60 * 60 * 61 61 * Property Parameters: Non-standard, language, common name, directory 62 62 * entry reference, sent by property parameters can be specified on this 63 63 * property. 64 * 64 * 65 65 * Conformance: This property MUST be specified in an iCalendar object 66 66 * that specifies a group scheduled calendar entity. This property MUST … … 70 70 * that defines calendar entities that are not group scheduled entities, 71 71 * but are entities only on a single user's calendar. 72 * 72 * 73 73 * Description: The property is specified within the "VEVENT", "VTODO", 74 74 * "VJOURNAL calendar components to specify the organizer of a group … … 78 78 * calendar component, the property is used to specify the calendar that 79 79 * the published busy time came from. 80 * 80 * 81 81 * The property has the property parameters CN, for specifying the 82 82 * common or display name associated with the "Organizer", DIR, for … … 87 87 * parameter is specified, the identified language applies to the CN 88 88 * parameter value. 89 * 89 * 90 90 * Format Definition: The property is defined by the following notation: 91 * 91 * 92 92 * organizer = "ORGANIZER" orgparam ":" 93 93 * cal-address CRLF 94 * 94 * 95 95 * orgparam = *( 96 * 96 * 97 97 * ; the following are optional, 98 98 * ; but MUST NOT occur more than once 99 * 99 * 100 100 * (";" cnparam) / (";" dirparam) / (";" sentbyparam) / 101 101 * (";" languageparam) / 102 * 102 * 103 103 * ; the following is optional, 104 104 * ; and MAY occur more than once 105 * 105 * 106 106 * (";" xparam) 107 * 107 * 108 108 * ) 109 * 109 * 110 110 * Example: The following is an example of this property: 111 * 111 * 112 112 * ORGANIZER;CN=John Smith:MAILTO:jsmith@host1.com 113 * 113 * 114 114 * The following is an example of this property with a pointer to the 115 115 * directory information associated with the organizer: 116 * 116 * 117 117 * ORGANIZER;CN=JohnSmith;DIR="ldap://host.com:6666/o=3DDC%20Associ 118 118 * ates,c=3DUS??(cn=3DJohn%20Smith)":MAILTO:jsmith@host1.com 119 * 119 * 120 120 * The following is an example of this property used by another calendar 121 121 * user who is acting on behalf of the organizer, with responses 122 122 * intended to be sent back to the organizer, not the other calendar 123 123 * user: 124 * 124 * 125 125 * ORGANIZER;SENT-BY="MAILTO:jane_doe@host.com": 126 126 * MAILTO:jsmith@host1.com 127 127 * </pre> 128 * 128 * 129 129 * @author Ben Fortuna 130 130 */ … … 140 140 public Organizer() { 141 141 super(ORGANIZER); 142 } 143 144 /** 145 * Constructs a new instance with the specified value. 146 * @param value 147 */ 148 public Organizer(String value) throws URISyntaxException { 149 super(ORGANIZER); 150 setValue(value); 142 151 } 143 152 … … 205 214 */ 206 215 public final void setValue(final String aValue) throws URISyntaxException { 207 calAddress = new URI(Uris.encode(aValue));216 calAddress = Uris.create(aValue); 208 217 } 209 218 external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/RDate.java
r1267 r1366 1 1 /* 2 * $Id: RDate.java,v 1.1 2 2006/11/05 06:04:43fortuna Exp $3 * 2 * $Id: RDate.java,v 1.13 2006/12/17 11:25:56 fortuna Exp $ 3 * 4 4 * Created: [Apr 6, 2004] 5 5 * … … 42 42 import net.fortuna.ical4j.model.ParameterList; 43 43 import net.fortuna.ical4j.model.PeriodList; 44 import net.fortuna.ical4j.model.TimeZone; 44 45 import net.fortuna.ical4j.model.ValidationException; 45 46 import net.fortuna.ical4j.model.parameter.Value; … … 49 50 /** 50 51 * Defines an RDATE iCalendar component property. 51 * 52 * 52 53 * <pre> 53 54 * 4.8.5.3 Recurrence Date/Times 54 * 55 * 55 56 * Property Name: RDATE 56 * 57 * 57 58 * Purpose: This property defines the list of date/times for a 58 59 * recurrence set. 59 * 60 * 60 61 * Value Type: The default value type for this property is DATE-TIME. 61 62 * The value type can be set to DATE or PERIOD. 62 * 63 * 63 64 * Property Parameters: Non-standard, value data type and time zone 64 65 * identifier property parameters can be specified on this property. 65 * 66 * 66 67 * Conformance: The property can be specified in "VEVENT", "VTODO", 67 68 * "VJOURNAL" or "VTIMEZONE" calendar components. 68 * 69 * 69 70 * Description: This property can appear along with the "RRULE" property 70 71 * to define an aggregate set of repeating occurrences. When they both 71 72 * appear in an iCalendar object, the recurring events are defined by 72 73 * the union of occurrences defined by both the "RDATE" and "RRULE". 73 * 74 * 74 75 * The recurrence dates, if specified, are used in computing the 75 76 * recurrence set. The recurrence set is the complete set of recurrence … … 90 91 * "RRULE" and "RDATE" properties, only one recurrence is considered. 91 92 * Duplicate instances are ignored. 92 * 93 * 93 94 * Format Definition: The property is defined by the following notation: 94 * 95 * 95 96 * rdate = "RDATE" rdtparam ":" rdtval *("," rdtval) CRLF 96 * 97 * 97 98 * rdtparam = *( 98 * 99 * 99 100 * ; the following are optional, 100 101 * ; but MUST NOT occur more than once 101 * 102 * 102 103 * (";" "VALUE" "=" ("DATE-TIME" / "DATE" / "PERIOD")) / 103 104 * (";" tzidparam) / 104 * 105 * 105 106 * ; the following is optional, 106 107 * ; and MAY occur more than once 107 * 108 * 108 109 * (";" xparam) 109 * 110 * 110 111 * ) 111 * 112 * 112 113 * rdtval = date-time / date / period 113 114 * ;Value MUST match value type 114 * 115 * 115 116 * Example: The following are examples of this property: 116 * 117 * 117 118 * RDATE:19970714T123000Z 118 * 119 * 119 120 * RDATE;TZID=US-EASTERN:19970714T083000 120 * 121 * 121 122 * RDATE;VALUE=PERIOD:19960403T020000Z/19960403T040000Z, 122 123 * 19960404T010000Z/PT3H 123 * 124 * 124 125 * RDATE;VALUE=DATE:19970101,19970120,19970217,19970421 125 126 * 19970526,19970704,19970901,19971014,19971128,19971129,19971225 126 127 * </pre> 127 * 128 * 128 129 * @author Ben Fortuna 129 130 */ … … 247 248 return super.getValue(); 248 249 } 250 251 /* (non-Javadoc) 252 * @see net.fortuna.ical4j.model.property.DateListProperty#setTimeZone(net.fortuna.ical4j.model.TimeZone) 253 */ 254 public final void setTimeZone(TimeZone timezone) { 255 if (periods != null) { 256 periods.setTimeZone(timezone); 257 } 258 else { 259 super.setTimeZone(timezone); 260 } 261 } 249 262 } external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/RecurrenceId.java
r1267 r1366 1 1 /* 2 * $Id: RecurrenceId.java,v 1.1 6 2006/11/05 06:04:43fortuna Exp $3 * 2 * $Id: RecurrenceId.java,v 1.17 2007/01/07 06:39:17 fortuna Exp $ 3 * 4 4 * Created: [Apr 6, 2004] 5 5 * … … 42 42 import net.fortuna.ical4j.model.Parameter; 43 43 import net.fortuna.ical4j.model.ParameterList; 44 import net.fortuna.ical4j.model.TimeZone; 44 45 import net.fortuna.ical4j.model.ValidationException; 45 46 import net.fortuna.ical4j.util.ParameterValidator; … … 47 48 /** 48 49 * Defines a RECURRENCE-ID iCalendar component property. 49 * 50 * 50 51 * <pre> 51 52 * 4.8.4.4 Recurrence ID 52 * 53 * 53 54 * Property Name: RECURRENCE-ID 54 * 55 * 55 56 * Purpose: This property is used in conjunction with the "UID" and 56 57 * "SEQUENCE" property to identify a specific instance of a recurring … … 58 59 * value is the effective value of the "DTSTART" property of the 59 60 * recurrence instance. 60 * 61 * 61 62 * Value Type: The default value type for this property is DATE-TIME. 62 63 * The time format can be any of the valid forms defined for a DATE-TIME … … 64 65 * interpretations of the various forms. The value type can be set to 65 66 * DATE. 66 * 67 * 67 68 * Property Parameters: Non-standard property, value data type, time 68 69 * zone identifier and recurrence identifier range parameters can be 69 70 * specified on this property. 70 * 71 * 71 72 * Conformance: This property can be specified in an iCalendar object 72 73 * containing a recurring calendar component. 73 * 74 * 74 75 * Description: The full range of calendar components specified by a 75 76 * recurrence set is referenced by referring to just the "UID" property … … 77 78 * property allows the reference to an individual instance within the 78 79 * recurrence set. 79 * 80 * 80 81 * If the value of the "DTSTART" property is a DATE type value, then the 81 82 * value MUST be the calendar date for the recurrence instance. 82 * 83 * 83 84 * The date/time value is set to the time when the original recurrence 84 85 * instance would occur; meaning that if the intent is to change a 85 86 * Friday meeting to Thursday, the date/time is still set to the 86 87 * original Friday meeting. 87 * 88 * 88 89 * The "RECURRENCE-ID" property is used in conjunction with the "UID" 89 90 * and "SEQUENCE" property to identify a particular instance of a … … 101 102 * "THISANDFUTURE" to indicate a range defined by the given recurrence 102 103 * instance and all subsequent instances. 103 * 104 * 104 105 * Format Definition: The property is defined by the following notation: 105 * 106 * 106 107 * recurid = "RECURRENCE-ID" ridparam ":" ridval CRLF 107 * 108 * 108 109 * ridparam = *( 109 * 110 * 110 111 * ; the following are optional, 111 112 * ; but MUST NOT occur more than once 112 * 113 * 113 114 * (";" "VALUE" "=" ("DATE-TIME" / "DATE)) / 114 115 * (";" tzidparam) / (";" rangeparam) / 115 * 116 * 116 117 * ; the following is optional, 117 118 * ; and MAY occur more than once 118 * 119 * 119 120 * (";" xparam) 120 * 121 * 121 122 * ) 122 * 123 * 123 124 * ridval = date-time / date 124 125 * ;Value MUST match value type 125 126 * </pre> 126 * 127 * 127 128 * @author Ben Fortuna 128 129 */ … … 137 138 super(RECURRENCE_ID); 138 139 setDate(new DateTime()); 140 } 141 142 /** 143 * Creates a new RECURRENCE_ID property initialised with the specified timezone. 144 * @param timezone initial timezone 145 */ 146 public RecurrenceId(TimeZone timezone) { 147 super(RECURRENCE_ID, timezone); 148 } 149 150 /** 151 * Creates a new instance initialised with the parsed value. 152 * @param value the RECURRENCE_ID value string to parse 153 * @throws ParseException where the specified string is not a valid RECURRENCE_ID value representation 154 */ 155 public RecurrenceId(final String value) throws ParseException { 156 super(RECURRENCE_ID); 157 setValue(value); 158 } 159 160 /** 161 * Creates a new RECURRENCE_ID property initialised with the specified timezone and value. 162 * @param value a string representation of a RECURRENCE_ID value 163 * @param timezone initial timezone 164 * @throws ParseException where the specified value is not a valid string 165 * representation 166 */ 167 public RecurrenceId(String value, TimeZone timezone) throws ParseException { 168 super(RECURRENCE_ID, timezone); 169 setValue(value); 139 170 } 140 171 external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/TzUrl.java
r1267 r1366 1 1 /* 2 * $Id: TzUrl.java,v 1.1 1 2006/11/05 06:04:42fortuna Exp $3 * 2 * $Id: TzUrl.java,v 1.12 2007/02/10 08:45:56 fortuna Exp $ 3 * 4 4 * Created: [Apr 6, 2004] 5 5 * … … 47 47 /** 48 48 * Defines a TZURL iCalendar component property. 49 * 49 * 50 50 * <pre> 51 51 * 4.8.3.5 Time Zone URL 52 * 52 * 53 53 * Property Name: TZURL 54 * 54 * 55 55 * Purpose: The TZURL provides a means for a VTIMEZONE component to 56 56 * point to a network location that can be used to retrieve an up-to- 57 57 * date version of itself. 58 * 58 * 59 59 * Value Type: URI 60 * 60 * 61 61 * Property Parameters: Non-standard property parameters can be 62 62 * specified on this property. 63 * 63 * 64 64 * Conformance: This property can be specified in a "VTIMEZONE" calendar 65 65 * component. 66 * 66 * 67 67 * Description: The TZURL provides a means for a VTIMEZONE component to 68 68 * point to a network location that can be used to retrieve an up-to- … … 71 71 * this resource results in an iCalendar object containing a single 72 72 * VTIMEZONE component and a METHOD property set to PUBLISH. 73 * 73 * 74 74 * Format Definition: The property is defined by the following notation: 75 * 75 * 76 76 * tzurl = "TZURL" tzurlparam ":" uri CRLF 77 * 77 * 78 78 * tzurlparam = *(";" xparam) 79 * 79 * 80 80 * Example: The following is an example of this property: 81 * 81 * 82 82 * TZURL:http://timezones.r.us.net/tz/US-California-Los_Angeles 83 83 * </pre> 84 * 84 * 85 85 * @author Ben Fortuna 86 86 */ … … 138 138 */ 139 139 public final void setValue(final String aValue) throws URISyntaxException { 140 uri = new URI(Uris.encode(aValue));140 uri = Uris.create(aValue); 141 141 } 142 142 external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Url.java
r1364 r1366 1 1 /* 2 * $Id: Url.java,v 1.1 1 2006/11/05 06:04:42fortuna Exp $2 * $Id: Url.java,v 1.12 2007/02/10 08:45:56 fortuna Exp $ 3 3 * 4 4 * Created: [Apr 6, 2004] … … 39 39 import java.net.URISyntaxException; 40 40 41 import net.fortuna.ical4j.model.Parameter;42 41 import net.fortuna.ical4j.model.ParameterList; 43 42 import net.fortuna.ical4j.model.Property; 44 43 import net.fortuna.ical4j.model.ValidationException; 45 import net.fortuna.ical4j.util.ParameterValidator;46 44 import net.fortuna.ical4j.util.Strings; 47 45 import net.fortuna.ical4j.util.Uris; … … 140 138 */ 141 139 public final void setValue(final String aValue) throws URISyntaxException { 142 uri = new URI(Uris.encode(aValue));140 uri = Uris.create(aValue); 143 141 } 144 142 … … 164 162 public final void validate() throws ValidationException { 165 163 // TODO: Auto-generated method stub 166 ParameterValidator.getInstance().assertOneOrLess(Parameter.TYPE,167 getParameters());168 164 } 169 165 } external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/util/TimeZones.java
r1267 r1366 1 1 /* 2 * $Id: TimeZones.java,v 1. 3 2005/09/23 10:14:43fortuna Exp $ [5/07/2004]2 * $Id: TimeZones.java,v 1.4 2006/12/17 08:23:40 fortuna Exp $ [5/07/2004] 3 3 * 4 4 * Copyright (c) 2004, Ben Fortuna … … 42 42 */ 43 43 public final class TimeZones { 44 44 45 45 public static final String UTC_ID = "Etc/UTC"; 46 46 47 public static final String IBM_UTC_ID = "GMT"; 48 47 49 public static final String GMT_ID = "Etc/GMT"; 48 50 … … 52 54 private TimeZones() { 53 55 } 54 56 55 57 /** 56 58 * Indicates whether the specified timezone is equivalent to … … 62 64 // return timezone.hasSameRules(TimeZone.getTimeZone(UTC_ID)); 63 65 // return timezone.getRawOffset() == 0; 64 return UTC_ID.equals(timezone.getID()); 66 return UTC_ID.equals(timezone.getID()) 67 || IBM_UTC_ID.equals(timezone.getID()); 65 68 } 66 69 } external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/util/Uris.java
r1267 r1366 1 1 /* 2 * $Id: Uris.java,v 1. 2 2006/04/17 11:29:12fortuna Exp $2 * $Id: Uris.java,v 1.3 2007/02/10 08:32:21 fortuna Exp $ 3 3 * 4 4 * Created on 11/09/2005 … … 25 25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 28 28 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 29 29 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, … … 36 36 package net.fortuna.ical4j.util; 37 37 38 import java.net.URI; 39 import java.net.URISyntaxException; 38 40 39 41 /** … … 43 45 public final class Uris { 44 46 45 //private static final String ENCODING_CHARSET = "UTF-8";46 47 //private static Log log = LogFactory.getLog(Uris.class);48 47 // private static final String ENCODING_CHARSET = "UTF-8"; 48 49 // private static Log log = LogFactory.getLog(Uris.class); 50 49 51 /** 50 52 * Constructor made private to enforce static nature. … … 54 56 55 57 /** 56 * Encodes the specified URI string using the UTF-8 charset. In the 57 * event that an exception is thrown, the specifed URI string is 58 * returned unmodified. 58 * Encodes the specified URI string using the UTF-8 charset. In the event that an exception is thrown, the specifed 59 * URI string is returned unmodified. 59 60 * @param s a URI string 60 61 * @return an encoded URI string … … 62 63 public static String encode(final String s) { 63 64 /* 64 try { 65 return URLEncoder.encode(s, ENCODING_CHARSET); 66 } 67 catch (UnsupportedEncodingException use) { 68 log.error("Error ocurred encoding URI [" + s + "]", use); 69 } 70 */ 71 65 * try { return URLEncoder.encode(s, ENCODING_CHARSET); } catch (UnsupportedEncodingException use) { 66 * log.error("Error ocurred encoding URI [" + s + "]", use); } 67 */ 68 72 69 /* 73 * Lotus Notes does not correctly strip angle brackets from cid uris. 74 * From RFC2932: 75 * 76 * A "cid" URL is converted to the corresponding Content-ID message 77 * header [MIME] by removing the "cid:" prefix, converting the % encoded 78 * character to their equivalent US-ASCII characters, and enclosing the 79 * remaining parts with an angle bracket pair, "<" and ">". For 80 * example, "cid:foo4%25foo1@bar.net" corresponds to 81 * 82 * Content-ID: <foo4%25foo1@bar.net> 83 * 84 * Reversing the process and converting URL special characters to their 85 * % encodings produces the original cid. 86 * 87 * A "mid" URL is converted to a Message-ID or Message-ID/Content-ID 88 * pair in a similar fashion. 70 * Lotus Notes does not correctly strip angle brackets from cid uris. From RFC2932: A "cid" URL is converted to 71 * the corresponding Content-ID message header [MIME] by removing the "cid:" prefix, converting the % encoded 72 * character to their equivalent US-ASCII characters, and enclosing the remaining parts with an angle bracket 73 * pair, "<" and ">". For example, "cid:foo4%25foo1@bar.net" corresponds to Content-ID: <foo4%25foo1@bar.net> 74 * Reversing the process and converting URL special characters to their % encodings produces the original cid. A 75 * "mid" URL is converted to a Message-ID or Message-ID/Content-ID pair in a similar fashion. 89 76 */ 90 if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_NOTES_COMPATIBILITY)) { 77 if (CompatibilityHints 78 .isHintEnabled(CompatibilityHints.KEY_NOTES_COMPATIBILITY)) { 91 79 return s.replaceAll("[<>]", ""); 92 80 } 93 81 return s; 94 82 } 95 83 96 84 /** 97 * Decodes the specified URI string using the UTF-8 charset. In the 98 * event that an exception is thrown, the specifed URI string is 99 * returned unmodified. 85 * Decodes the specified URI string using the UTF-8 charset. In the event that an exception is thrown, the specifed 86 * URI string is returned unmodified. 100 87 * @param s a URI string 101 88 * @return an encoded URI string … … 103 90 public static String decode(final String s) { 104 91 /* 105 try { 106 return URLDecoder.decode(s, ENCODING_CHARSET); 107 } 108 catch (UnsupportedEncodingException use) { 109 log.error("Error ocurred decoding URI [" + s + "]", use); 110 } 111 */ 92 * try { return URLDecoder.decode(s, ENCODING_CHARSET); } catch (UnsupportedEncodingException use) { 93 * log.error("Error ocurred decoding URI [" + s + "]", use); } 94 */ 112 95 return s; 113 96 } 97 98 /** 99 * Attempts to create a URI instance and will optionally swallow any resulting URISyntaxException depending on 100 * configured {@link CompatibilityHints}. Will also automatically attempt encoding of the string representation for 101 * greater compatibility. 102 * @param s a string representation of a URI. 103 * @return a URI instance, or null if a valid URI string is not specified and relaxed parsing is enabled. 104 * @throws URISyntaxException if a valid URI string is not specified and relaxed parsing is disabled 105 */ 106 public static URI create(final String s) throws URISyntaxException { 107 try { 108 return new URI(encode(s)); 109 } 110 catch (URISyntaxException use) { 111 if (CompatibilityHints 112 .isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING)) { 113 114 return null; 115 } 116 throw use; 117 } 118 } 114 119 }
