Changeset 1366

Show
Ignore:
Timestamp:
04/24/07 15:32:30
Author:
douglm
Message:

Bring up to date with ical4j beta2

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/data/CalendarBuilder.java

    r1267 r1366  
    11/* 
    2  * $Id: CalendarBuilder.java,v 1.23 2006/11/05 08:05:47 fortuna Exp $ 
     2 * $Id: CalendarBuilder.java,v 1.24 2007/02/08 08:45:09 fortuna Exp $ 
    33 * 
    44 * Created: Apr 5, 2004 
     
    9292     */ 
    9393    public CalendarBuilder() { 
    94         this(new CalendarParserImpl(), TimeZoneRegistryFactory.getInstance() 
    95                 .createRegistry()); 
     94        this(CalendarParserFactory.getInstance().createParser(), 
     95                TimeZoneRegistryFactory.getInstance().createRegistry()); 
    9696    } 
    9797 
     
    109109     */ 
    110110    public CalendarBuilder(final TimeZoneRegistry registry) { 
    111         this(new CalendarParserImpl(), registry); 
     111        this(CalendarParserFactory.getInstance().createParser(), registry); 
    112112    } 
    113113 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/filter/PeriodRule.java

    r1267 r1366  
    11/* 
    2  * $Id: PeriodRule.java,v 1.5 2006/11/05 07:59:37 fortuna Exp $ 
     2 * $Id: PeriodRule.java,v 1.6 2007/01/28 04:04:04 fortuna Exp $ 
    33 * 
    44 * Created on 2/02/2006 
     
    7878    public final boolean match(final Component component) { 
    7979        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)) { 
    8181            debug(start.getDate(), "start date"); 
    8282            return true; 
    8383        } 
    8484        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)) { 
    8686            debug(end.getDate(), "end date"); 
    8787            return true; 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/AddressList.java

    r1267 r1366  
    11/* 
    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] 
    33 * 
    44 * Copyright (c) 2004, Ben Fortuna 
     
    2323 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    2424 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
    25  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
     25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
    2626 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
    2727 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
     
    4242import java.util.StringTokenizer; 
    4343 
     44import net.fortuna.ical4j.util.CompatibilityHints; 
    4445import net.fortuna.ical4j.util.Strings; 
    4546import net.fortuna.ical4j.util.Uris; 
    4647 
    47  
    4848/** 
    4949 * Defines a list of iCalendar addresses. 
    50  *  
    5150 * @author Ben Fortuna 
    5251 */ 
    5352public class AddressList implements Serializable { 
    54      
     53 
    5554    private static final long serialVersionUID = 81383256078213569L; 
    56      
     55 
    5756    private List addresses; 
    5857 
     
    6564 
    6665    /** 
    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 
    7369     */ 
    7470    public AddressList(final String aValue) throws URISyntaxException { 
     
    7672        for (StringTokenizer t = new StringTokenizer(aValue, ","); t 
    7773                .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            } 
    7987        } 
    8088    } 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/ComponentFactory.java

    r1364 r1366  
    11/* 
    2  * $Id: ComponentFactory.java,v 1.11 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] 
    33 * 
    44 * Copyright (c) 2004, Ben Fortuna 
     
    2323 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    2424 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
    25  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
     25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
    2626 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
    2727 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
     
    4848 
    4949/** 
    50  * A factory for creating iCalendar components. Note that if relaxed parsing is enabled (via 
    51  * specifying the system property: 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. 
    5252 * @author Ben Fortuna 
    5353 */ 
     
    5656    private static ComponentFactory instance = new ComponentFactory(); 
    5757 
    58     private boolean allowIllegalNames; 
    59  
    6058    /** 
    6159     * Constructor made private to prevent instantiation. 
    6260     */ 
    6361    private ComponentFactory() { 
    64         allowIllegalNames = CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING); 
    6562    } 
    6663 
     
    7269    } 
    7370 
     71    /** 
     72     * @param name 
     73     * @return 
     74     */ 
    7475    public Component createComponent(final String name) { 
    7576        return createComponent(name, new PropertyList()); 
     
    7879    /** 
    7980     * 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 
    8583     * @return a component 
    8684     */ 
    87     public Component createComponent(final String name, final PropertyList properties) { 
     85    public Component createComponent(final String name, 
     86            final PropertyList properties) { 
    8887        if (Component.VALARM.equals(name)) { 
    8988            return new VAlarm(properties); 
     
    116115            return new XComponent(name, properties); 
    117116        } 
    118         else if (allowIllegalNames) { 
     117        else if (allowIllegalNames()) { 
    119118            return new XComponent(name, properties); 
    120119        } 
    121120        else { 
    122             throw new IllegalArgumentException("Illegal component [" + name + "]"); 
     121            throw new IllegalArgumentException("Illegal component [" + name 
     122                    + "]"); 
    123123        } 
    124124    } 
    125125 
    126126    /** 
    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) 
    136131     * @return a component 
    137132     */ 
     
    146141            } 
    147142            else { 
    148                 throw new IllegalArgumentException("Illegal component [" + name + "]"); 
     143                throw new IllegalArgumentException("Illegal component [" + name 
     144                        + "]"); 
    149145            } 
    150146        } 
     
    160156                && name.length() > Component.EXPERIMENTAL_PREFIX.length(); 
    161157    } 
     158 
     159    /** 
     160     * @return 
     161     */ 
     162    protected boolean allowIllegalNames() { 
     163        return CompatibilityHints 
     164                .isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING); 
     165    } 
    162166} 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/DateList.java

    r1267 r1366  
    11/* 
    2  * $Id: DateList.java,v 1.18 2006/04/05 10:51:16 fortuna Exp $ [23-Apr-2004] 
     2 * $Id: DateList.java,v 1.19 2006/12/17 11:25:52 fortuna Exp $ [23-Apr-2004] 
    33 * 
    44 * Copyright (c) 2004, Ben Fortuna 
     
    5454 
    5555    private TimeZone timeZone; 
    56      
     56 
    5757    private boolean utc; 
    5858 
     
    7777        this(aType, null); 
    7878    } 
    79      
     79 
    8080    /** 
    8181     * Default constructor. 
    82      *  
     82     * 
    8383     * @param aType 
    8484     *            specifies the type of dates (either date or date-time) 
     
    9797        this(aValue, aType, null); 
    9898    } 
    99      
     99 
    100100    /** 
    101101     * Parses the specified string representation to create a list of dates. 
    102      *  
     102     * 
    103103     * @param aValue 
    104104     *            a string representation of a list of dates 
     
    122122        } 
    123123    } 
    124      
     124 
    125125    /** 
    126126     * Constructs a new date list of the specified type containing 
     
    190190        return add((Object) date); 
    191191    } 
    192      
     192 
    193193    /** 
    194194     * Overrides superclass to throw an <code>IllegalArgumentException</code> 
     
    205205    /** 
    206206     * Remove a date from the list. 
    207      *  
     207     * 
    208208     * @param date 
    209209     *            the date to remove 
     
    218218     * Returns the VALUE parameter specifying the type of dates (ie. date or 
    219219     * date-time) stored in this date list. 
    220      *  
     220     * 
    221221     * @return Returns a Value parameter. 
    222222     */ 
     
    228228     * Indicates whether this list is in local or UTC format. This property will 
    229229     * have no affect if the type of the list is not DATE-TIME. 
    230      *  
     230     * 
    231231     * @return Returns true if in UTC format, otherwise false. 
    232232     */ 
     
    237237    /** 
    238238     * Sets whether this list is in UTC or local time format. 
    239      *  
     239     * 
    240240     * @param utc 
    241241     *            The utc to set. 
     
    248248        } 
    249249        this.timeZone = null; 
    250         this.utc = true
    251     } 
    252      
     250        this.utc = utc
     251    } 
     252 
    253253    /** 
    254254     * Applies the specified timezone to all dates in the list. 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/DateTime.java

    r1267 r1366  
    11/* 
    2  * $Id: DateTime.java,v 1.14 2006/11/11 08:35:13 fortuna Exp $ 
     2 * $Id: DateTime.java,v 1.15 2007/01/28 05:45:54 fortuna Exp $ 
    33 * 
    44 * Created on 26/06/2005 
     
    181181                } 
    182182                else { 
    183                     throw pe
     183                    throw pe2
    184184                } 
    185185            } 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/Dur.java

    r1267 r1366  
    11/* 
    2  * $Id: Dur.java,v 1.9 2006/05/27 13:21:25 fortuna Exp $ 
     2 * $Id: Dur.java,v 1.12 2007/01/13 12:17:57 fortuna Exp $ 
    33 * 
    44 * Created on 20/06/2005 
     
    3636package net.fortuna.ical4j.model; 
    3737 
     38import java.io.IOException; 
    3839import java.io.Serializable; 
    3940import java.util.Calendar; 
     
    4546 
    4647/** 
    47  * Represents a duration of time in iCalendar. Note that according to RFC2445 
    48  * durations represented in weeks are mutually exclusive of other duration 
    49  * 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 * 
    5051 * <pre> 
    51  * 4.3.6   Duration 
    52  *  
    53  *    Value Name: DURATION 
    54  *  
    55  *    Purpose: This value type is used to identify properties that contain 
    56  *    a duration of time. 
    57  *  
    58  *    Formal Definition: The value type is defined by the following 
    59  *    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  = ([&quot;+&quot;] / &quot;-&quot;) &quot;P&quot; (dur-date / dur-time / dur-week) 
     63 * 
     64 *      dur-date   = dur-day [dur-time] 
     65 *      dur-time   = &quot;T&quot; (dur-hour / dur-minute / dur-second) 
     66 *      dur-week   = 1*DIGIT &quot;W&quot; 
     67 *      dur-hour   = 1*DIGIT &quot;H&quot; [dur-minute] 
     68 *      dur-minute = 1*DIGIT &quot;M&quot; [dur-second] 
     69 *      dur-second = 1*DIGIT &quot;S&quot; 
     70 *      dur-day    = 1*DIGIT &quot;D&quot; 
    7071 * </pre> 
    71  *  
     72 * 
    7273 * @author Ben Fortuna 
    7374 */ 
    7475public class Dur implements Comparable, Serializable { 
    75      
     76 
    7677    private static final long serialVersionUID = 5013232281547134583L; 
    77      
     78 
    7879    private static final int DAYS_PER_WEEK = 7; 
    79      
    80     private static final int WEEKS_PER_YEAR = 52; 
    81      
     80 
    8281    private static final int SECONDS_PER_MINUTE = 60; 
    83      
     82 
    8483    private static final int MINUTES_PER_HOUR = 60; 
    85      
     84 
    8685    private static final int HOURS_PER_DAY = 24; 
    87      
     86 
    8887    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); 
    9190 
    9291    private boolean negative; 
    93      
     92 
    9493    private int weeks; 
    95      
     94 
    9695    private int days; 
    97      
     96 
    9897    private int hours; 
    99      
     98 
    10099    private int minutes; 
    101      
     100 
    102101    private int seconds; 
    103      
     102 
    104103    /** 
    105104     * Constructs a new duration instance from a string representation. 
     
    117116        String prevToken = null; 
    118117 
    119         for (StringTokenizer t = new StringTokenizer(value, "+-PWDTHMS", true); t.hasMoreTokens();) { 
     118        for (StringTokenizer t = new StringTokenizer(value, "+-PWDTHMS", true); t 
     119                .hasMoreTokens();) { 
    120120            prevToken = token; 
    121121            token = t.nextToken(); 
     
    156156        } 
    157157    } 
    158      
     158 
    159159    /** 
    160160     * Constructs a new duration from the specified weeks. 
     
    168168        this.seconds = 0; 
    169169    } 
    170      
     170 
    171171    /** 
    172172     * Constructs a new duration from the specified arguments. 
     
    176176     * @param seconds duration in seconds 
    177177     */ 
    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) { 
    179180        this.weeks = 0; 
    180181        this.days = days; 
     
    183184        this.seconds = seconds; 
    184185    } 
    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. 
    190190     * @param start the start date of the duration 
    191191     * @param end the end date of the duration 
    192192     */ 
    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 
    194204        Calendar startCal = Calendar.getInstance(); 
    195205        startCal.setTime(start); 
    196206        Calendar endCal = Calendar.getInstance(); 
    197207        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; 
    233253            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. 
    297259     * @param start the date to start the duration 
    298260     * @return the end of the duration as a date 
     
    317279        return cal.getTime(); 
    318280    } 
    319      
     281 
    320282    /** 
    321283     * Provides a negation of this instance. 
     
    328290        return negated; 
    329291    } 
    330      
    331     /* (non-Javadoc) 
     292 
     293    /* 
     294     * (non-Javadoc) 
    332295     * @see java.lang.Object#toString() 
    333296     */ 
     
    365328        return b.toString(); 
    366329    } 
    367      
     330 
    368331    /** 
    369332     * @param arg0 
     
    373336        return compareTo((Dur) arg0); 
    374337    } 
    375      
     338 
    376339    /** 
    377340     * Compares this duration with another. 
     
    381344    public final int compareTo(final Dur arg0) { 
    382345        if (isNegative() != arg0.isNegative()) { 
    383 //            return Boolean.valueOf(isNegative()).compareTo(Boolean.valueOf(arg0.isNegative())); 
     346            // return Boolean.valueOf(isNegative()).compareTo(Boolean.valueOf(arg0.isNegative())); 
    384347            // for pre-java 1.5 compatibility.. 
    385348            if (isNegative()) { 
     
    446409        return weeks; 
    447410    } 
     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    } 
    448423} 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/ParameterFactoryImpl.java

    r1364 r1366  
    2525 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    2626 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
    27  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
     27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
    2828 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
    2929 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
     
    3737 
    3838import java.net.URISyntaxException; 
    39 import java.util.HashMap; 
    40 import java.util.Map; 
    4139 
    4240import net.fortuna.ical4j.model.parameter.Abbrev; 
     
    6664/** 
    6765 * A factory for creating iCalendar parameters. 
    68  * 
    6966 * @author Ben Fortuna 
    7067 */ 
    71 public final class ParameterFactoryImpl implements ParameterFactory { 
     68public final class ParameterFactoryImpl extends AbstractContentFactory 
     69    implements ParameterFactory { 
    7270 
    7371    private static ParameterFactoryImpl instance = new ParameterFactoryImpl(); 
    7472 
    75     private Map factories; 
    76  
    7773    /** 
    7874     * Constructor made private to prevent instantiation. 
    7975     */ 
    8076    private ParameterFactoryImpl() { 
    81         factories = new HashMap(); 
    8277        factories.put(Parameter.ABBREV, createAbbrevFactory()); 
    8378        factories.put(Parameter.ALTREP, createAltRepFactory()); 
     
    124119    private ParameterFactory createAltRepFactory() { 
    125120        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 { 
    130127                return new AltRep(value); 
    131128            } 
     
    138135    private ParameterFactory createCnFactory() { 
    139136        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 { 
    145143                return new Cn(value); 
    146144            } 
     
    153151    private ParameterFactory createCuTypeFactory() { 
    154152        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); 
    161160                if (CuType.INDIVIDUAL.equals(parameter)) { 
    162161                    return CuType.INDIVIDUAL; 
     
    184183    private ParameterFactory createDelegatedFromFactory() { 
    185184        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 { 
    191191                return new DelegatedFrom(value); 
    192192            } 
     
    199199    private ParameterFactory createDelegatedToFactory() { 
    200200        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 { 
    206207                return new DelegatedTo(value); 
    207208            } 
     
    214215    private ParameterFactory createDirFactory() { 
    215216        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 { 
    221223                return new Dir(value); 
    222224            } 
     
    229231    private ParameterFactory createEncodingFactory() { 
    230232        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 { 
    236239                Encoding parameter = new Encoding(value); 
    237240                if (Encoding.EIGHT_BIT.equals(parameter)) { 
     
    251254    private ParameterFactory createFmtTypeFactory() { 
    252255        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 { 
    258262                return new FmtType(value); 
    259263            } 
     
    266270    private ParameterFactory createFbTypeFactory() { 
    267271        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 { 
    273278                FbType parameter = new FbType(value); 
    274279                if (FbType.FREE.equals(parameter)) { 
     
    294299    private ParameterFactory createLanguageFactory() { 
    295300        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 { 
    301307                return new Language(value); 
    302308            } 
     
    309315    private ParameterFactory createMemberFactory() { 
    310316        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 { 
    316323                return new Member(value); 
    317324            } 
     
    324331    private ParameterFactory createPartStatFactory() { 
    325332        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 { 
    331339                PartStat parameter = new PartStat(value); 
    332340                if (PartStat.NEEDS_ACTION.equals(parameter)) { 
     
    361369    private ParameterFactory createRangeFactory() { 
    362370        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 { 
    368377                Range parameter = new Range(value); 
    369378                if (Range.THISANDFUTURE.equals(parameter)) { 
     
    383392    private ParameterFactory createRelatedFactory() { 
    384393        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 { 
    390400                Related parameter = new Related(value); 
    391401                if (Related.START.equals(parameter)) { 
     
    405415    private ParameterFactory createRelTypeFactory() { 
    406416        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 { 
    412423                RelType parameter = new RelType(value); 
    413424                if (RelType.PARENT.equals(parameter)) { 
     
    430441    private ParameterFactory createRoleFactory() { 
    431442        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 { 
    437449                Role parameter = new Role(value); 
    438450                if (Role.CHAIR.equals(parameter)) { 
     
    458470    private ParameterFactory createRsvpFactory() { 
    459471        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 { 
    465478                Rsvp parameter = new Rsvp(value); 
    466479                if (Rsvp.TRUE.equals(parameter)) { 
     
    480493    private ParameterFactory createSentByFactory() { 
    481494        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 { 
    487501                return new SentBy(value); 
    488502            } 
     
    510524    private ParameterFactory createTzIdFactory() { 
    511525        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 { 
    517532                return new TzId(value); 
    518533            } 
     
    525540    private ParameterFactory createValueFactory() { 
    526541        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 { 
    532548                Value parameter = new Value(value); 
    533549                if (Value.BINARY.equals(parameter)) { 
     
    587603    /** 
    588604     * 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 
    594607     * @return a component 
    595      * @throws URISyntaxException thrown when the specified string 
    596      * is not a valid representation of a URI for selected parameters 
     608     * @throws URISyntaxException thrown when the specified string is not a valid representation of a URI for selected 
     609     * parameters 
    597610     */ 
    598611    public Parameter createParameter(final String name, final String value) 
     
    605618            return new XParameter(name, value); 
    606619        } 
     620        else if (allowIllegalNames()) { 
     621            return new XParameter(name, value); 
     622        } 
    607623        else { 
    608             throw new IllegalArgumentException("Invalid parameter name: " + name); 
     624            throw new IllegalArgumentException("Invalid parameter name: " 
     625                    + name); 
    609626        } 
    610627    } 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/ParameterList.java

    r1267 r1366  
    11/* 
    2  * $Id: ParameterList.java,v 1.12 2006/10/22 12:45:28 fortuna Exp $ [Apr 5, 2004] 
     2 * $Id: ParameterList.java,v 1.13 2007/01/28 02:07:14 fortuna Exp $ [Apr 5, 2004] 
    33 * 
    44 * Copyright (c) 2004, Ben Fortuna 
     
    2323 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    2424 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
    25  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
     25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
    2626 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
    2727 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
     
    4545 
    4646/** 
    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. 
    5149 * @author Ben Fortuna 
    5250 */ 
    5351public class ParameterList implements Serializable { 
    54      
     52 
    5553    private static final long serialVersionUID = -1913059830016450169L; 
    5654 
     
    6361        this(false); 
    6462    } 
    65      
     63 
    6664    /** 
    6765     * Constructor. 
     
    7573        } 
    7674    } 
    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. 
    8279     * @param list a parameter list to copy parameters from 
    8380     * @throws URISyntaxException 
    8481     */ 
    85     public ParameterList(final ParameterList list, final boolean unmodifiable) throws URISyntaxException { 
     82    public ParameterList(final ParameterList list, final boolean unmodifiable) 
     83            throws URISyntaxException { 
    8684        parameters = new ArrayList(); 
    8785        for (Iterator i = list.iterator(); i.hasNext();) { 
    8886            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())); 
    9089        } 
    9190        if (unmodifiable) { 
     
    112111    /** 
    113112     * Returns the first parameter with the specified name. 
    114      * 
    115      * @param aName 
    116      *            name of the parameter 
     113     * @param aName name of the parameter 
    117114     * @return the first matching parameter or null if no matching parameters 
    118115     */ 
     
    122119            Parameter p = (Parameter) i.next(); 
    123120 
    124             if (aName.equals(p.getName())) { 
     121            if (aName.equalsIgnoreCase(p.getName())) { 
    125122                return p; 
    126123            } 
     
    132129    /** 
    133130     * 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 
    136132     * @return a parameter list 
    137133     */ 
     
    142138            Parameter p = (Parameter) i.next(); 
    143139 
    144             if (p.getName().equals(name)) { 
     140            if (p.getName().equalsIgnoreCase(name)) { 
    145141                list.add(p); 
    146142            } 
     
    150146 
    151147    /** 
    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) } 
    154151     * @param parameter the parameter to add 
    155152     * @return true 
     
    159156        return parameters.add(parameter); 
    160157    } 
    161      
     158 
    162159    /** 
    163160     * 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 
    166162     * @return true if successfully added to this list 
    167163     */ 
    168164    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();) { 
    170167            remove((Parameter) i.next()); 
    171168        } 
     
    208205 
    209206    /** 
    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. 
    213209     * @see java.lang.Object#equals(java.lang.Object) 
    214210     */ 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/Period.java

    r1267 r1366  
    11/* 
    2  * $Id: Period.java,v 1.13 2006/10/22 12:45:27 fortuna Exp $ [Apr 14, 2004] 
     2 * $Id: Period.java,v 1.15 2007/01/28 04:04:04 fortuna Exp $ [Apr 14, 2004] 
    33 * 
    44 * Copyright (c) 2005, Ben Fortuna 
     
    4747 * rely on the returned values from the getters to deduce whether a period has 
    4848 * an explicit end date or duration. 
    49  *  
     49 * 
    5050 * @author Ben Fortuna 
    5151 */ 
    5252public class Period implements Serializable, Comparable { 
    5353 
     54    public static final int INCLUSIVE_START = 1; 
     55 
     56    public static final int INCLUSIVE_END = 2; 
     57 
    5458    private static final long serialVersionUID = 7321090422911676490L; 
    5559 
     
    6266    /** 
    6367     * Constructor. 
    64      *  
     68     * 
    6569     * @param aValue 
    6670     *            a string representation of a period 
     
    7478        try { 
    7579            end = new DateTime(aValue.substring(aValue.indexOf('/') + 1)); 
    76         } catch (ParseException pe) { 
     80        } 
     81        catch (ParseException pe) { 
    7782            // duration = DurationFormat.getInstance().parse(aValue); 
    7883            duration = new Dur(aValue); 
     
    8287    /** 
    8388     * Constructs a new period with the specied start and end date. 
    84      *  
     89     * 
    8590     * @param start 
    8691     *            the start date of the period 
     
    9196        this.start = start; 
    9297        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        } 
    93108    } 
    94109 
    95110    /** 
    96111     * Constructs a new period with the specified start date and duration. 
    97      *  
     112     * 
    98113     * @param start 
    99114     *            the start date of the period 
     
    109124     * Returns the duration of this period. If an explicit duration is not 
    110125     * specified, the duration is derived from the end date. 
    111      *  
     126     * 
    112127     * @return the duration of this period in milliseconds. 
    113128     */ 
     
    122137     * Returns the end date of this period. If an explicit end date is not 
    123138     * specified, the end date is derived from the duration. 
    124      *  
     139     * 
    125140     * @return the end date of this period. 
    126141     */ 
     
    146161     * @param date 
    147162     * @return true if the specified date occurs within the current period 
    148      *  
     163     * 
    149164     */ 
    150165    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        } 
    152182    } 
    153183 
     
    159189     * @return true if the date is in the perod, false otherwise 
    160190     */ 
    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; 
    166206    } 
    167207 
    168208    /** 
    169209     * Decides whether this period is completed before the given period starts. 
    170      *  
     210     * 
    171211     * @param period 
    172212     *            a period that may or may not start after this period ends 
     
    180220    /** 
    181221     * Decides whether this period starts after the given period ends. 
    182      *  
     222     * 
    183223     * @param period 
    184224     *            a period that may or may not end before this period starts 
     
    192232    /** 
    193233     * Decides whether this period intersects with another one. 
    194      *  
     234     * 
    195235     * @param period 
    196236     *            a possible intersecting period 
     
    215255    /** 
    216256     * Decides whether these periods are serial without a gap. 
    217      *  
     257     * 
    218258     * @return true if one period immediately follows the other, false otherwise 
    219259     */ 
     
    229269    /** 
    230270     * Decides whether the given period is completely contained within this one. 
    231      *  
     271     * 
    232272     * @param period 
    233273     *            the period that may be contained by this one 
     
    245285     * periods are specified by explicitly setting a start date and end date 
    246286     * (i.e. durations are implied). 
    247      *  
     287     * 
    248288     * @param period 
    249289     *            the period to add to this one 
     
    271311 
    272312        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        } 
    273347    } 
    274348 
     
    291365    /* 
    292366     * (non-Javadoc) 
    293      *  
     367     * 
    294368     * @see java.lang.Comparable#compareTo(java.lang.Object) 
    295369     */ 
     
    300374    /** 
    301375     * Compares the specified period with this period. 
    302      *  
     376     * 
    303377     * @param arg0 
    304378     * @return 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/PeriodList.java

    r1267 r1366  
    11/* 
    2  * $Id: PeriodList.java,v 1.13 2005/11/03 12:27:42 fortuna Exp $ [23-Apr-2004] 
     2 * $Id: PeriodList.java,v 1.14 2006/12/17 11:25:51 fortuna Exp $ [23-Apr-2004] 
    33 * 
    44 * Copyright (c) 2004, Ben Fortuna 
     
    4444 * <code>java.util.SortedSet</code> interface period lists will always be 
    4545 * sorted according to natural ordering. 
    46  *  
     46 * 
    4747 * @author Ben Fortuna 
    4848 */ 
     
    5151    private static final long serialVersionUID = -6319585959747194724L; 
    5252 
     53    private TimeZone timezone; 
     54 
     55    private boolean utc; 
     56 
    5357    /** 
    5458     * Default constructor. 
    5559     */ 
    5660    public PeriodList() { 
     61        this(true); 
     62    } 
     63 
     64    /** 
     65     * @param utc 
     66     */ 
     67    public PeriodList(boolean utc) { 
     68        this.utc = utc; 
    5769    } 
    5870 
    5971    /** 
    6072     * Parses the specified string representation to create a list of periods. 
    61      *  
     73     * 
    6274     * @param aValue 
    6375     *            a string representation of a list of periods 
     
    89101    /** 
    90102     * Add a period to the list. 
    91      *  
     103     * 
    92104     * @param period 
    93105     *            the period to add 
     
    96108     */ 
    97109    public final boolean add(final Period period) { 
     110        if (isUtc()) { 
     111            period.setUtc(true); 
     112        } 
     113        else { 
     114            period.setTimeZone(timezone); 
     115        } 
    98116        return add((Object) period); 
    99117    } 
     
    102120     * Overrides superclass to throw an <code>IllegalArgumentException</code> 
    103121     * 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) 
    106124     */ 
    107125    public final boolean add(final Object arg0) { 
     
    115133    /** 
    116134     * Remove a period from the list. 
    117      *  
     135     * 
    118136     * @param period 
    119137     *            the period to remove 
     
    130148     * periods, and combining adjacent periods. NOTE: If the period list is 
    131149     * already normalised then this period list is returned. 
    132      *  
     150     * 
    133151     * @return a period list 
    134152     */ 
     
    180198     * this list. Normalisation is also performed automatically after all 
    181199     * periods have been added. 
    182      *  
     200     * 
    183201     * @param periods 
    184202     */ 
     
    199217     * periods from this list and returns the results as a new period list. If 
    200218     * no intersection is identified this list is returned. 
    201      *  
     219     * 
    202220     * @param periods 
    203221     *            a list of periods to subtract from this list 
     
    257275        return this; 
    258276    } 
     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    } 
    259320} 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/PropertyFactoryImpl.java

    r1364 r1366  
    11/* 
    2  * $Id: PropertyFactoryImpl.java,v 1.9 2006/11/11 04:43:29 fortuna Exp $ [05-Apr-2004] 
     2 * $Id: PropertyFactoryImpl.java,v 1.10 2007/01/28 02:41:56 fortuna Exp $ [05-Apr-2004] 
    33 * 
    44 * Copyright (c) 2004, Ben Fortuna 
     
    3737import java.net.URISyntaxException; 
    3838import java.text.ParseException; 
    39 import java.util.HashMap; 
    40 import java.util.Map; 
    4139 
    4240import net.fortuna.ical4j.model.property.Action; 
     
    9694import net.fortuna.ical4j.model.property.Version; 
    9795import net.fortuna.ical4j.model.property.XProperty; 
    98 import net.fortuna.ical4j.util.CompatibilityHints; 
    9996 
    10097/** 
     
    103100 * @author Ben Fortuna 
    104101 */ 
    105 public final class PropertyFactoryImpl implements PropertyFactory { 
     102public final class PropertyFactoryImpl extends AbstractContentFactory implements 
     103        PropertyFactory { 
    106104 
    107105    private static PropertyFactoryImpl instance = new PropertyFactoryImpl(); 
    108106 
    109     private Map factories; 
    110  
    111     private boolean allowIllegalNames; 
    112  
    113107    /** 
    114108     * Constructor made private to prevent instantiation. 
    115109     */ 
    116110    private PropertyFactoryImpl() { 
    117         allowIllegalNames = CompatibilityHints 
    118                 .isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING); 
    119         factories = new HashMap(); 
    120111        factories.put(Property.ACTION, createActionFactory()); 
    121112        factories.put(Property.ATTACH, createAttachFactory()); 
     
    16261617            return new XProperty(name); 
    16271618        } 
    1628         else if (allowIllegalNames) { 
     1619        else if (allowIllegalNames()) { 
    16291620            return new XProperty(name); 
    16301621        } 
     
    16521643            return new XProperty(name, parameters, value); 
    16531644        } 
    1654         else if (allowIllegalNames) { 
     1645        else if (allowIllegalNames()) { 
    16551646            return new XProperty(name); 
    16561647        } 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/PropertyList.java

    r1267 r1366  
    11/* 
    2  * $Id: PropertyList.java,v 1.8 2005/09/28 09:03:53 fortuna Exp $ [Apr 5, 2004] 
     2 * $Id: PropertyList.java,v 1.9 2007/01/28 02:04:31 fortuna Exp $ [Apr 5, 2004] 
    33 * 
    44 * Copyright (c) 2004, Ben Fortuna 
     
    2323 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    2424 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
    25  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
     25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
    2626 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
    2727 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
     
    4040/** 
    4141 * Defines a list of iCalendar properties. 
    42  * 
    4342 * @author Ben Fortuna 
    4443 */ 
    4544public class PropertyList extends ArrayList implements Serializable { 
    46      
     45 
    4746    private static final long serialVersionUID = -8875923766224921031L; 
    4847 
     
    8079        for (Iterator i = iterator(); i.hasNext();) { 
    8180            Property p = (Property) i.next(); 
    82             if (p.getName().equals(aName)) { 
     81            if (p.getName().equalsIgnoreCase(aName)) { 
    8382                return p; 
    8483            } 
     
    8988    /** 
    9089     * 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 
    9391     * @return a property list 
    9492     */ 
     
    9795        for (Iterator i = iterator(); i.hasNext();) { 
    9896            Property p = (Property) i.next(); 
    99             if (p.getName().equals(name)) { 
     97            if (p.getName().equalsIgnoreCase(name)) { 
    10098                list.add(p); 
    10199            } 
     
    108106     * @param property the property to add 
    109107     * @return true 
    110      * @see List#add(java.lang.Object) 
     108     * @see java.util.List#add(java.lang.Object) 
    111109     */ 
    112110    public final boolean add(final Property property) { 
    113111        return add((Object) property); 
    114112    } 
    115      
     113 
    116114    /** 
    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) 
    120118     */ 
    121119    public final boolean add(final Object arg0) { 
    122120        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()); 
    124123        } 
    125124        return super.add(arg0); 
     
    127126 
    128127    /** 
    129      * @return boolean indicates if the list is empty 
    130      * @see List#isEmpty() 
    131      */ 
    132 //    public final boolean isEmpty() { 
    133 //        return properties.isEmpty(); 
    134 //    } 
    135  
    136     /** 
    137      * @return an iterator 
    138      * @see List#iterator() 
    139      */ 
    140 //    public final Iterator iterator() { 
    141 //        return properties.iterator(); 
    142 //    } 
    143  
    144     /** 
    145128     * Remove a property from the list. 
    146129     * @param property the property to remove 
    147130     * @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) 
    149132     */ 
    150133    public final boolean remove(final Property property) { 
    151134        return remove((Object) property); 
    152135    } 
    153  
    154     /** 
    155      * @return the number of properties in the list 
    156      * @see List#size() 
    157      */ 
    158 //    public final int size() { 
    159 //        return properties.size(); 
    160 //    } 
    161136} 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/Recur.java

    r1364 r1366  
    11/* 
    2  * $Id: Recur.java,v 1.30 2006/11/11 07:42:10 fortuna Exp $ [18-Apr-2004] 
     2 * $Id: Recur.java,v 1.31 2007/01/04 04:47:56 fortuna Exp $ [18-Apr-2004] 
    33 * 
    44 * Copyright (c) 2004, Ben Fortuna 
     
    3434package net.fortuna.ical4j.model; 
    3535 
     36import java.io.IOException; 
    3637import java.io.Serializable; 
    3738import java.text.ParseException; 
     
    10781079        this.count = -1; 
    10791080    } 
     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    } 
    10801093} 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/UtcOffset.java

    r1267 r1366  
    11/* 
    2  * $Id: UtcOffset.java,v 1.7 2006/10/22 12:45:28 fortuna Exp $ 
     2 * $Id: UtcOffset.java,v 1.8 2007/01/04 04:47:56 fortuna Exp $ 
    33 * 
    44 * Created on 26/06/2005 
     
    3636package net.fortuna.ical4j.model; 
    3737 
     38import java.io.IOException; 
    3839import java.io.Serializable; 
    3940import java.text.DecimalFormat; 
     
    5455 
    5556    private static final long serialVersionUID = 5883111996721531728L; 
    56      
     57 
    5758    private static final int HOUR_START_INDEX = 1; 
    5859 
     
    7374    private static final NumberFormat SECOND_FORMAT = new DecimalFormat("00"); 
    7475 
    75     private Log log = LogFactory.getLog(UtcOffset.class); 
     76    private transient Log log = LogFactory.getLog(UtcOffset.class); 
    7677 
    7778    private long offset; 
     
    164165        return new HashCodeBuilder().append(getOffset()).toHashCode(); 
    165166    } 
     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    } 
    166179} 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/component/Observance.java

    r1364 r1366  
    11/* 
    2  * $Id: Observance.java,v 1.13 2006/11/05 05:07:57 fortuna Exp $ [05-Apr-2004] 
     2 * $Id: Observance.java,v 1.15 2007/01/28 05:50:45 fortuna Exp $ [05-Apr-2004] 
    33 * 
    44 * Copyright (c) 2005, Ben Fortuna 
     
    3434package net.fortuna.ical4j.model.component; 
    3535 
     36import java.io.IOException; 
    3637import java.util.Calendar; 
    3738import java.util.Collections; 
     
    3940import java.util.Map; 
    4041import java.util.TreeMap; 
    41  
    42 import org.apache.commons.logging.Log; 
    43 import org.apache.commons.logging.LogFactory; 
    4442 
    4543import net.fortuna.ical4j.model.Component; 
     
    6058import net.fortuna.ical4j.util.PropertyValidator; 
    6159 
     60import org.apache.commons.logging.Log; 
     61import org.apache.commons.logging.LogFactory; 
     62 
    6263/** 
    6364 * Defines an iCalendar sub-component representing a timezone observance. Class made abstract such that only Standard 
     
    7475    public static final String DAYLIGHT = "DAYLIGHT"; 
    7576 
    76     private Log log = LogFactory.getLog(Observance.class); 
     77    private transient Log log = LogFactory.getLog(Observance.class); 
    7778 
    7879    // TODO: clear cache when observance definition changes (??) 
     
    260261        for (Iterator i = onsets.keySet().iterator(); i.hasNext();) { 
    261262            Period onsetPeriod = (Period) i.next(); 
    262             if (onsetPeriod.includes(date)) { 
     263            if (onsetPeriod.includes(date, Period.INCLUSIVE_START)) { 
    263264                return (Date) onsets.get(onsetPeriod); 
    264265            } 
     
    309310        return dtStart.getDate().compareTo(dtStart0.getDate()); 
    310311    } 
     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    } 
    311323} 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/component/VFreeBusy.java

    r1267 r1366  
    11/* 
    2  * $Id: VFreeBusy.java,v 1.25 2006/11/05 05:07:57 fortuna Exp $ [Apr 5, 2004] 
     2 * $Id: VFreeBusy.java,v 1.26 2007/01/04 04:48:39 fortuna Exp $ [Apr 5, 2004] 
    33 * 
    44 * Copyright (c) 2005, Ben Fortuna 
     
    3535package net.fortuna.ical4j.model.component; 
    3636 
     37import java.io.IOException; 
    3738import java.util.Iterator; 
    3839 
     
    226227    private static final long serialVersionUID = 1046534053331139832L; 
    227228 
    228     private Log log = LogFactory.getLog(VFreeBusy.class); 
     229    private transient Log log = LogFactory.getLog(VFreeBusy.class); 
    229230 
    230231    /** 
     
    534535        return (Uid) getProperty(Property.UID); 
    535536    } 
     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    } 
    536549} 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/parameter/AltRep.java

    r1267 r1366  
    11/* 
    2  * $Id: AltRep.java,v 1.10 2006/11/05 08:08:45 fortuna Exp $ [18-Apr-2004] 
     2 * $Id: AltRep.java,v 1.11 2007/02/10 08:45:56 fortuna Exp $ [18-Apr-2004] 
    33 * 
    44 * Copyright (c) 2004, Ben Fortuna 
     
    5656     */ 
    5757    public AltRep(final String aValue) throws URISyntaxException { 
    58         this(new URI(Uris.encode(Strings.unquote(aValue)))); 
     58        this(Uris.create(Strings.unquote(aValue))); 
    5959    } 
    6060 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/parameter/Dir.java

    r1267 r1366  
    11/* 
    2  * $Id: Dir.java,v 1.10 2006/11/05 08:08:45 fortuna Exp $ [18-Apr-2004] 
     2 * $Id: Dir.java,v 1.11 2007/02/10 08:45:56 fortuna Exp $ [18-Apr-2004] 
    33 * 
    44 * Copyright (c) 2004, Ben Fortuna 
     
    5656     */ 
    5757    public Dir(final String aValue) throws URISyntaxException { 
    58         this(new URI(Uris.encode(Strings.unquote(aValue)))); 
     58        this(Uris.create(Strings.unquote(aValue))); 
    5959    } 
    6060 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/parameter/SentBy.java

    r1267 r1366  
    11/* 
    2  * $Id: SentBy.java,v 1.10 2006/11/05 08:08:45 fortuna Exp $ [18-Apr-2004] 
     2 * $Id: SentBy.java,v 1.11 2007/02/10 08:45:56 fortuna Exp $ [18-Apr-2004] 
    33 * 
    44 * Copyright (c) 2004, Ben Fortuna 
     
    5656     */ 
    5757    public SentBy(final String aValue) throws URISyntaxException { 
    58         this(new URI(Uris.encode(Strings.unquote(aValue)))); 
     58        this(Uris.create(Strings.unquote(aValue))); 
    5959    } 
    6060 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Attach.java

    r1364 r1366  
    11/* 
    2  * $Id: Attach.java,v 1.16 2006/11/05 08:12:20 fortuna Exp $ 
     2 * $Id: Attach.java,v 1.18 2007/02/10 08:45:56 fortuna Exp $ 
    33 * 
    44 * Created: [Apr 6, 2004] 
     
    114114    private static final long serialVersionUID = 4439949507756383452L; 
    115115 
    116     private Log log = LogFactory.getLog(Attach.class); 
     116    private transient Log log = LogFactory.getLog(Attach.class); 
    117117 
    118118    private URI uri; 
     
    220220    } 
    221221 
    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. 
    225227     */ 
    226228    public void setValue(final String aValue) throws IOException, 
    227229            URISyntaxException { 
     230 
    228231        // determine if ATTACH is a URI or an embedded 
    229232        // binary.. 
     
    245248        // assume URI.. 
    246249        else { 
    247             uri = new URI(Uris.encode(aValue)); 
     250            uri = Uris.create(aValue); 
    248251        } 
    249252    } 
     
    292295        this.binary = null; 
    293296    } 
     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    } 
    294309} 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Attendee.java

    r1267 r1366  
    11/* 
    2  * $Id: Attendee.java,v 1.10 2006/11/05 06:04:42 fortuna Exp $ 
    3  *  
     2 * $Id: Attendee.java,v 1.11 2007/02/10 08:45:56 fortuna Exp $ 
     3 * 
    44 * Created: [Apr 6, 2004] 
    55 * 
     
    106106     */ 
    107107    public void setValue(final String aValue) throws URISyntaxException { 
    108         calAddress = new URI(Uris.encode(aValue)); 
     108        calAddress = Uris.create(aValue); 
    109109    } 
    110110 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/DateListProperty.java

    r1267 r1366  
    11/* 
    2  * $Id: DateListProperty.java,v 1.6 2006/11/05 06:04:42 fortuna Exp $ 
     2 * $Id: DateListProperty.java,v 1.8 2006/12/17 11:25:56 fortuna Exp $ 
    33 * 
    44 * Created on 11/08/2005 
     
    120120     * @param timezone a timezone to associate with this property 
    121121     */ 
    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        } 
    123127        this.timezone = timezone; 
    124128        if (timezone != null) { 
     
    145149     */ 
    146150    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())) { 
    148152            throw new UnsupportedOperationException( 
    149153                    "TimeZone is not applicable to current value"); 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/DateProperty.java

    r1267 r1366  
    11/* 
    2  * $Id: DateProperty.java,v 1.15 2006/11/05 06:04:42 fortuna Exp $ 
     2 * $Id: DateProperty.java,v 1.16 2007/01/07 06:39:18 fortuna Exp $ 
    33 * 
    44 * Created on 9/07/2005 
     
    7777 
    7878    /** 
     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    /** 
    7989     * @return Returns the date. 
    8090     */ 
     
    91101            setTimeZone(((DateTime) date).getTimeZone()); 
    92102        } 
     103        else { 
     104            // ensure timezone is null for VALUE=DATE properties.. 
     105            setTimeZone(null); 
     106        } 
    93107        this.date = date; 
    94108    } 
     
    96110    /** 
    97111     * 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) 
    102112     */ 
    103113    public void setValue(final String value) throws ParseException { 
    104114        // value can be either a date-time or a date.. 
    105115        if (Value.DATE.equals(getParameter(Parameter.VALUE))) { 
     116            // ensure timezone is null for VALUE=DATE properties.. 
     117            setTimeZone(null); 
    106118            this.date = new Date(value); 
    107119        } 
     
    136148                ((DateTime) getDate()).setTimeZone(timezone); 
    137149            } 
    138             getParameters().remove(getParameter(Parameter.TZID)); 
     150 
    139151            TzId tzId = new TzId(timezone.getID()); 
    140152            getParameters().replace(tzId); 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/DtEnd.java

    r1267 r1366  
    11/* 
    2  * $Id: DtEnd.java,v 1.17 2006/11/05 06:04:43 fortuna Exp $ 
    3  *  
     2 * $Id: DtEnd.java,v 1.18 2007/01/07 06:39:18 fortuna Exp $ 
     3 * 
    44 * Created: [Apr 6, 2004] 
    55 * 
     
    4040import net.fortuna.ical4j.model.Date; 
    4141import net.fortuna.ical4j.model.ParameterList; 
     42import net.fortuna.ical4j.model.TimeZone; 
    4243import net.fortuna.ical4j.model.ValidationException; 
    4344 
    4445/** 
    4546 * Defines a DTEND iCalendar component property. 
    46  *  
     47 * 
    4748 * <pre> 
    4849 *     4.8.2.2 Date/Time End 
    49  *      
     50 * 
    5051 *        Property Name: DTEND 
    51  *      
     52 * 
    5253 *        Purpose: This property specifies the date and time that a calendar 
    5354 *        component ends. 
    54  *      
     55 * 
    5556 *        Value Type: The default value type is DATE-TIME. The value type can 
    5657 *        be set to a DATE value type. 
    57  *      
     58 * 
    5859 *        Property Parameters: Non-standard, value data type, time zone 
    5960 *        identifier property parameters can be specified on this property. 
    60  *      
     61 * 
    6162 *        Conformance: This property can be specified in &quot;VEVENT&quot; or 
    6263 *        &quot;VFREEBUSY&quot; calendar components. 
    63  *      
     64 * 
    6465 *        Description: Within the &quot;VEVENT&quot; calendar component, this property 
    6566 *        defines the date and time by which the event ends. The value MUST be 
    6667 *        later in time than the value of the &quot;DTSTART&quot; property. 
    67  *      
     68 * 
    6869 *        Within the &quot;VFREEBUSY&quot; calendar component, this property defines the 
    6970 *        end date and time for the free or busy time information. The time 
    7071 *        MUST be specified in the UTC time format. The value MUST be later in 
    7172 *        time than the value of the &quot;DTSTART&quot; property. 
    72  *      
     73 * 
    7374 *        Format Definition: The property is defined by the following notation: 
    74  *      
     75 * 
    7576 *          dtend      = &quot;DTEND&quot; dtendparam&quot;:&quot; dtendval CRLF 
    76  *      
     77 * 
    7778 *          dtendparam = *( 
    78  *      
     79 * 
    7980 *                     ; the following are optional, 
    8081 *                     ; but MUST NOT occur more than once 
    81  *      
     82 * 
    8283 *                     (&quot;;&quot; &quot;VALUE&quot; &quot;=&quot; (&quot;DATE-TIME&quot; / &quot;DATE&quot;)) / 
    8384 *                     (&quot;;&quot; tzidparam) / 
    84  *      
     85 * 
    8586 *                     ; the following is optional, 
    8687 *                     ; and MAY occur more than once 
    87  *      
     88 * 
    8889 *                     (&quot;;&quot; xparam) 
    89  *      
     90 * 
    9091 *                     ) 
    91  *      
    92  *      
    93  *      
     92 * 
     93 * 
     94 * 
    9495 *          dtendval   = date-time / date 
    9596 *          ;Value MUST match value type 
    9697 * </pre> 
    97  *  
     98 * 
    9899 * Examples: 
    99  *  
     100 * 
    100101 * <pre> 
    101102 *      // construct an end date from a start date and a duration.. 
     
    104105 *      DtEnd end = new DtEnd(oneWeek.getTime(start.getDate()); 
    105106 * </pre> 
    106  *  
     107 * 
    107108 * @author Ben Fortuna 
    108109 */ 
     
    119120 
    120121    /** 
     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    /** 
    121130     * Creates a new instance initialised with the parsed value. 
    122131     * @param value the DTEND value string to parse 
     
    129138 
    130139    /** 
    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 
    132153     * @param aValue a value string for this component 
    133154     * @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  
    11/* 
    2  * $Id: DtStart.java,v 1.16 2006/11/05 06:04:43 fortuna Exp $ 
    3  *  
     2 * $Id: DtStart.java,v 1.17 2007/01/07 06:39:18 fortuna Exp $ 
     3 * 
    44 * Created: [Apr 6, 2004] 
    55 * 
     
    4040import net.fortuna.ical4j.model.Date; 
    4141import net.fortuna.ical4j.model.ParameterList; 
     42import net.fortuna.ical4j.model.TimeZone; 
    4243import net.fortuna.ical4j.model.ValidationException; 
    4344 
    4445/** 
    4546 * Defines a DTSTART iCalendar component property. 
    46  *  
     47 * 
    4748 * <pre> 
    4849 *     4.8.2.4 Date/Time Start 
    49  *      
     50 * 
    5051 *        Property Name: DTSTART 
    51  *      
     52 * 
    5253 *        Purpose: This property specifies when the calendar component begins. 
    53  *      
     54 * 
    5455 *        Value Type: The default value type is DATE-TIME. The time value MUST 
    5556 *        be one of the forms defined for the DATE-TIME value type. The value 
    5657 *        type can be set to a DATE value type. 
    57  *      
     58 * 
    5859 *        Property Parameters: Non-standard, value data type, time zone 
    5960 *        identifier property parameters can be specified on this property. 
    60  *      
     61 * 
    6162 *        Conformance: This property can be specified in the &quot;VEVENT&quot;, &quot;VTODO&quot;, 
    6263 *        &quot;VFREEBUSY&quot;, or &quot;VTIMEZONE&quot; calendar components. 
    63  *      
     64 * 
    6465 *        Description: Within the &quot;VEVENT&quot; calendar component, this property 
    6566 *        defines the start date and time for the event. The property is 
     
    6768 *        date/time but no end date/time. In that case, the event does not take 
    6869 *        up any time. 
    69  *      
     70 * 
    7071 *        Within the &quot;VFREEBUSY&quot; calendar component, this property defines the 
    7172 *        start date and time for the free or busy time information. The time 
    7273 *        MUST be specified in UTC time. 
    73  *      
     74 * 
    7475 *        Within the &quot;VTIMEZONE&quot; calendar component, this property defines the 
    7576 *        effective start date and time for a time zone specification. This 
     
    7778 *        in &quot;VTIMEZONE&quot; calendar components and MUST be specified as a local 
    7879 *        DATE-TIME without the &quot;TZID&quot; property parameter. 
    79  *      
     80 * 
    8081 *        Format Definition: The property is defined by the following notation: 
    81  *      
     82 * 
    8283 *          dtstart    = &quot;DTSTART&quot; dtstparam &quot;:&quot; dtstval CRLF 
    83  *      
     84 * 
    8485 *          dtstparam  = *( 
    85  *      
     86 * 
    8687 *                     ; the following are optional, 
    8788 *                     ; but MUST NOT occur more than once 
    88  *      
     89 * 
    8990 *                     (&quot;;&quot; &quot;VALUE&quot; &quot;=&quot; (&quot;DATE-TIME&quot; / &quot;DATE&quot;)) / 
    9091 *                     (&quot;;&quot; tzidparam) / 
    91  *      
     92 * 
    9293 *                     ; the following is optional, 
    9394 *                     ; and MAY occur more than once 
    94  *      
     95 * 
    9596 *                       *(&quot;;&quot; xparam) 
    96  *      
     97 * 
    9798 *                     ) 
    98  *      
    99  *      
    100  *      
     99 * 
     100 * 
     101 * 
    101102 *          dtstval    = date-time / date 
    102103 *          ;Value MUST match value type 
    103104 * </pre> 
    104  *  
     105 * 
    105106 * @author Ben Fortuna 
    106107 */ 
     
    117118 
    118119    /** 
     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    /** 
    119128     * @param aValue a value string for this component 
    120129     * @throws ParseException where the specified value string is not a valid date-time/date representation 
     
    123132        super(DTSTART); 
    124133        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); 
    125146    } 
    126147 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Due.java

    r1267 r1366  
    11/* 
    2  * $Id: Due.java,v 1.14 2006/11/05 06:04:42 fortuna Exp $ 
    3  *  
     2 * $Id: Due.java,v 1.15 2007/01/07 06:39:18 fortuna Exp $ 
     3 * 
    44 * Created: [Apr 6, 2004] 
    55 * 
     
    4141import net.fortuna.ical4j.model.DateTime; 
    4242import net.fortuna.ical4j.model.ParameterList; 
     43import net.fortuna.ical4j.model.TimeZone; 
    4344import net.fortuna.ical4j.model.ValidationException; 
    4445 
    4546/** 
    4647 * Defines a DUE iCalendar component property. 
    47  *  
     48 * 
    4849 * <pre> 
    4950 *     4.8.2.3 Date/Time Due 
    50  *      
     51 * 
    5152 *        Property Name: DUE 
    52  *      
     53 * 
    5354 *        Purpose: This property defines the date and time that a to-do is 
    5455 *        expected to be completed. 
    55  *      
     56 * 
    5657 *        Value Type: The default value type is DATE-TIME. The value type can 
    5758 *        be set to a DATE value type. 
    58  *      
     59 * 
    5960 *        Property Parameters: Non-standard, value data type, time zone 
    6061 *        identifier property parameters can be specified on this property. 
    61  *      
     62 * 
    6263 *        Conformance: The property can be specified once in a &quot;VTODO&quot; calendar 
    6364 *        component. 
    64  *      
     65 * 
    6566 *        Description: The value MUST be a date/time equal to or after the 
    6667 *        DTSTART value, if specified. 
    67  *      
     68 * 
    6869 *        Format Definition: The property is defined by the following notation: 
    69  *      
     70 * 
    7071 *          due        = &quot;DUE&quot; dueparam&quot;:&quot; dueval CRLF 
    71  *      
     72 * 
    7273 *          dueparam   = *( 
    7374 *                     ; the following are optional, 
    7475 *                     ; but MUST NOT occur more than once 
    75  *      
     76 * 
    7677 *                     (&quot;;&quot; &quot;VALUE&quot; &quot;=&quot; (&quot;DATE-TIME&quot; / &quot;DATE&quot;)) / 
    7778 *                     (&quot;;&quot; tzidparam) / 
    78  *      
     79 * 
    7980 *                     ; the following is optional, 
    8081 *                     ; and MAY occur more than once 
    81  *      
     82 * 
    8283 *                       *(&quot;;&quot; xparam) 
    83  *      
     84 * 
    8485 *                     ) 
    85  *      
    86  *      
    87  *      
     86 * 
     87 * 
     88 * 
    8889 *          dueval     = date-time / date 
    8990 *          ;Value MUST match value type 
    9091 * </pre> 
    91  *  
     92 * 
    9293 * @author Ben Fortuna 
    9394 */ 
     
    103104        // defaults to UTC time.. 
    104105        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); 
    105136    } 
    106137 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Geo.java

    r1267 r1366  
    11/* 
    2  * $Id: Geo.java,v 1.11 2006/11/05 06:04:42 fortuna Exp $ 
     2 * $Id: Geo.java,v 1.12 2007/01/07 06:41:11 fortuna Exp $ 
    33 * 
    44 * Created: [Apr 6, 2004] 
     
    4545/** 
    4646 * Defines a GEO iCalendar component property. 
    47  *  
     47 * 
    4848 * <pre> 
    4949 *      4.8.1.6 Geographic Position 
    50  *       
     50 * 
    5151 *         Property Name: GEO 
    52  *       
     52 * 
    5353 *         Purpose: This property specifies information related to the global 
    5454 *         position for the activity specified by a calendar component. 
    55  *       
     55 * 
    5656 *         Value Type: FLOAT. The value MUST be two SEMICOLON separated FLOAT 
    5757 *         values. 
    58  *       
     58 * 
    5959 *         Property Parameters: Non-standard property parameters can be 
    6060 *         specified on this property. 
    61  *       
     61 * 
    6262 *         Conformance: This property can be specified in  &quot;VEVENT&quot; or &quot;VTODO&quot; 
    6363 *         calendar components. 
    64  *       
     64 * 
    6565 *         Description: The property value specifies latitude and longitude, in 
    6666 *         that order (i.e., &quot;LAT LON&quot; ordering). The longitude represents the 
     
    7171 *         MUST accept values of this precision and MAY truncate values of 
    7272 *         greater precision. 
    73  *       
     73 * 
    7474 *         Values for latitude and longitude shall be expressed as decimal 
    7575 *         fractions of degrees. Whole degrees of latitude shall be represented 
     
    7979 *         it shall be separated from the whole number of degrees by a decimal 
    8080 *         point. 
    81  *       
     81 * 
    8282 *         Latitudes north of the equator shall be specified by a plus sign (+), 
    8383 *         or by the absence of a minus sign (-), preceding the digits 
     
    8686 *         degrees. A point on the Equator shall be assigned to the Northern 
    8787 *         Hemisphere. 
    88  *       
     88 * 
    8989 *         Longitudes east of the prime meridian shall be specified by a plus 
    9090 *         sign (+), or by the absence of a minus sign (-), preceding the digits 
     
    9797 *         around the earth, the East Bounding Coordinate data element shall be 
    9898 *         assigned the value +180 (180) degrees. 
    99  *       
     99 * 
    100100 *         Any spatial address with a latitude of +90 (90) or -90 degrees will 
    101101 *         specify the position at the North or South Pole, respectively. The 
    102102 *         component for longitude may have any legal value. 
    103  *       
     103 * 
    104104 *         With the exception of the special condition described above, this 
    105105 *         form is specified in Department of Commerce, 1986, Representation of 
     
    107107 *         Information Processing Standard 70-1):  Washington,  Department of 
    108108 *         Commerce, National Institute of Standards and Technology. 
    109  *       
     109 * 
    110110 *         The simple formula for converting degrees-minutes-seconds into 
    111111 *         decimal degrees is: 
    112  *       
     112 * 
    113113 *           decimal = degrees + minutes/60 + seconds/3600. 
    114  *       
     114 * 
    115115 *         Format Definition: The property is defined by the following notation: 
    116  *       
     116 * 
    117117 *           geo        = &quot;GEO&quot; geoparam &quot;:&quot; geovalue CRLF 
    118  *       
     118 * 
    119119 *           geoparam   = *(&quot;;&quot; xparam) 
    120  *       
     120 * 
    121121 *           geovalue   = float &quot;;&quot; float 
    122122 *           ;Latitude and Longitude components 
    123  *       
     123 * 
    124124 *         Example: The following is an example of this property: 
    125  *       
     125 * 
    126126 *           GEO:37.386013;-122.082932 
    127127 * </pre> 
    128  *  
     128 * 
    129129 * @author Ben Fortuna 
    130130 */ 
     
    142142    public Geo() { 
    143143        super(GEO); 
    144         latitude = new BigDecimal(0); 
    145         longitude = new BigDecimal(0); 
     144        latitude = BigDecimal.valueOf(0); 
     145        longitude = BigDecimal.valueOf(0); 
    146146    } 
    147147 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Organizer.java

    r1267 r1366  
    11/* 
    2  * $Id: Organizer.java,v 1.10 2006/11/05 06:04:43 fortuna Exp $ 
    3  *  
     2 * $Id: Organizer.java,v 1.12 2007/02/10 09:05:39 fortuna Exp $ 
     3 * 
    44 * Created: [Apr 6, 2004] 
    55 * 
     
    4949/** 
    5050 * Defines an ORGANIZER iCalendar component property. 
    51  *  
     51 * 
    5252 * <pre> 
    5353 *     4.8.4.3 Organizer 
    54  *      
     54 * 
    5555 *        Property Name: ORGANIZER 
    56  *      
     56 * 
    5757 *        Purpose: The property defines the organizer for a calendar component. 
    58  *      
     58 * 
    5959 *        Value Type: CAL-ADDRESS 
    60  *      
     60 * 
    6161 *        Property Parameters: Non-standard, language, common name, directory 
    6262 *        entry reference, sent by property parameters can be specified on this 
    6363 *        property. 
    64  *      
     64 * 
    6565 *        Conformance: This property MUST be specified in an iCalendar object 
    6666 *        that specifies a group scheduled calendar entity. This property MUST 
     
    7070 *        that defines calendar entities that are not group scheduled entities, 
    7171 *        but are entities only on a single user's calendar. 
    72  *      
     72 * 
    7373 *        Description: The property is specified within the &quot;VEVENT&quot;, &quot;VTODO&quot;, 
    7474 *        &quot;VJOURNAL calendar components to specify the organizer of a group 
     
    7878 *        calendar component, the property is used to specify the calendar that 
    7979 *        the published busy time came from. 
    80  *      
     80 * 
    8181 *        The property has the property parameters CN, for specifying the 
    8282 *        common or display name associated with the &quot;Organizer&quot;, DIR, for 
     
    8787 *        parameter is specified, the identified language applies to the CN 
    8888 *        parameter value. 
    89  *      
     89 * 
    9090 *        Format Definition: The property is defined by the following notation: 
    91  *      
     91 * 
    9292 *          organizer  = &quot;ORGANIZER&quot; orgparam &quot;:&quot; 
    9393 *                       cal-address CRLF 
    94  *      
     94 * 
    9595 *          orgparam   = *( 
    96  *      
     96 * 
    9797 *                     ; the following are optional, 
    9898 *                     ; but MUST NOT occur more than once 
    99  *      
     99 * 
    100100 *                     (&quot;;&quot; cnparam) / (&quot;;&quot; dirparam) / (&quot;;&quot; sentbyparam) / 
    101101 *                     (&quot;;&quot; languageparam) / 
    102  *      
     102 * 
    103103 *                     ; the following is optional, 
    104104 *                     ; and MAY occur more than once 
    105  *      
     105 * 
    106106 *                     (&quot;;&quot; xparam) 
    107  *      
     107 * 
    108108 *                     ) 
    109  *      
     109 * 
    110110 *        Example: The following is an example of this property: 
    111  *      
     111 * 
    112112 *          ORGANIZER;CN=John Smith:MAILTO:jsmith@host1.com 
    113  *      
     113 * 
    114114 *        The following is an example of this property with a pointer to the 
    115115 *        directory information associated with the organizer: 
    116  *      
     116 * 
    117117 *          ORGANIZER;CN=JohnSmith;DIR=&quot;ldap://host.com:6666/o=3DDC%20Associ 
    118118 *           ates,c=3DUS??(cn=3DJohn%20Smith)&quot;:MAILTO:jsmith@host1.com 
    119  *      
     119 * 
    120120 *        The following is an example of this property used by another calendar 
    121121 *        user who is acting on behalf of the organizer, with responses 
    122122 *        intended to be sent back to the organizer, not the other calendar 
    123123 *        user: 
    124  *      
     124 * 
    125125 *          ORGANIZER;SENT-BY=&quot;MAILTO:jane_doe@host.com&quot;: 
    126126 *           MAILTO:jsmith@host1.com 
    127127 * </pre> 
    128  *  
     128 * 
    129129 * @author Ben Fortuna 
    130130 */ 
     
    140140    public Organizer() { 
    141141        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); 
    142151    } 
    143152 
     
    205214     */ 
    206215    public final void setValue(final String aValue) throws URISyntaxException { 
    207         calAddress = new URI(Uris.encode(aValue)); 
     216        calAddress = Uris.create(aValue); 
    208217    } 
    209218 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/RDate.java

    r1267 r1366  
    11/* 
    2  * $Id: RDate.java,v 1.12 2006/11/05 06:04:43 fortuna Exp $ 
    3  *  
     2 * $Id: RDate.java,v 1.13 2006/12/17 11:25:56 fortuna Exp $ 
     3 * 
    44 * Created: [Apr 6, 2004] 
    55 * 
     
    4242import net.fortuna.ical4j.model.ParameterList; 
    4343import net.fortuna.ical4j.model.PeriodList; 
     44import net.fortuna.ical4j.model.TimeZone; 
    4445import net.fortuna.ical4j.model.ValidationException; 
    4546import net.fortuna.ical4j.model.parameter.Value; 
     
    4950/** 
    5051 * Defines an RDATE iCalendar component property. 
    51  *  
     52 * 
    5253 * <pre> 
    5354 *     4.8.5.3 Recurrence Date/Times 
    54  *      
     55 * 
    5556 *        Property Name: RDATE 
    56  *      
     57 * 
    5758 *        Purpose: This property defines the list of date/times for a 
    5859 *        recurrence set. 
    59  *      
     60 * 
    6061 *        Value Type: The default value type for this property is DATE-TIME. 
    6162 *        The value type can be set to DATE or PERIOD. 
    62  *      
     63 * 
    6364 *        Property Parameters: Non-standard, value data type and time zone 
    6465 *        identifier property parameters can be specified on this property. 
    65  *      
     66 * 
    6667 *        Conformance: The property can be specified in &quot;VEVENT&quot;, &quot;VTODO&quot;, 
    6768 *        &quot;VJOURNAL&quot; or &quot;VTIMEZONE&quot; calendar components. 
    68  *      
     69 * 
    6970 *        Description: This property can appear along with the &quot;RRULE&quot; property 
    7071 *        to define an aggregate set of repeating occurrences. When they both 
    7172 *        appear in an iCalendar object, the recurring events are defined by 
    7273 *        the union of occurrences defined by both the &quot;RDATE&quot; and &quot;RRULE&quot;. 
    73  *      
     74 * 
    7475 *        The recurrence dates, if specified, are used in computing the 
    7576 *        recurrence set. The recurrence set is the complete set of recurrence 
     
    9091 *        &quot;RRULE&quot; and &quot;RDATE&quot; properties, only one recurrence is considered. 
    9192 *        Duplicate instances are ignored. 
    92  *      
     93 * 
    9394 *        Format Definition: The property is defined by the following notation: 
    94  *      
     95 * 
    9596 *          rdate      = &quot;RDATE&quot; rdtparam &quot;:&quot; rdtval *(&quot;,&quot; rdtval) CRLF 
    96  *      
     97 * 
    9798 *          rdtparam   = *( 
    98  *      
     99 * 
    99100 *                     ; the following are optional, 
    100101 *                     ; but MUST NOT occur more than once 
    101  *      
     102 * 
    102103 *                     (&quot;;&quot; &quot;VALUE&quot; &quot;=&quot; (&quot;DATE-TIME&quot; / &quot;DATE&quot; / &quot;PERIOD&quot;)) / 
    103104 *                     (&quot;;&quot; tzidparam) / 
    104  *      
     105 * 
    105106 *                     ; the following is optional, 
    106107 *                     ; and MAY occur more than once 
    107  *      
     108 * 
    108109 *                     (&quot;;&quot; xparam) 
    109  *      
     110 * 
    110111 *                     ) 
    111  *      
     112 * 
    112113 *          rdtval     = date-time / date / period 
    113114 *          ;Value MUST match value type 
    114  *      
     115 * 
    115116 *        Example: The following are examples of this property: 
    116  *      
     117 * 
    117118 *          RDATE:19970714T123000Z 
    118  *      
     119 * 
    119120 *          RDATE;TZID=US-EASTERN:19970714T083000 
    120  *      
     121 * 
    121122 *          RDATE;VALUE=PERIOD:19960403T020000Z/19960403T040000Z, 
    122123 *           19960404T010000Z/PT3H 
    123  *      
     124 * 
    124125 *          RDATE;VALUE=DATE:19970101,19970120,19970217,19970421 
    125126 *           19970526,19970704,19970901,19971014,19971128,19971129,19971225 
    126127 * </pre> 
    127  *  
     128 * 
    128129 * @author Ben Fortuna 
    129130 */ 
     
    247248        return super.getValue(); 
    248249    } 
     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    } 
    249262} 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/RecurrenceId.java

    r1267 r1366  
    11/* 
    2  * $Id: RecurrenceId.java,v 1.16 2006/11/05 06:04:43 fortuna Exp $ 
    3  *  
     2 * $Id: RecurrenceId.java,v 1.17 2007/01/07 06:39:17 fortuna Exp $ 
     3 * 
    44 * Created: [Apr 6, 2004] 
    55 * 
     
    4242import net.fortuna.ical4j.model.Parameter; 
    4343import net.fortuna.ical4j.model.ParameterList; 
     44import net.fortuna.ical4j.model.TimeZone; 
    4445import net.fortuna.ical4j.model.ValidationException; 
    4546import net.fortuna.ical4j.util.ParameterValidator; 
     
    4748/** 
    4849 * Defines a RECURRENCE-ID iCalendar component property. 
    49  *  
     50 * 
    5051 * <pre> 
    5152 *     4.8.4.4 Recurrence ID 
    52  *      
     53 * 
    5354 *        Property Name: RECURRENCE-ID 
    54  *      
     55 * 
    5556 *        Purpose: This property is used in conjunction with the &quot;UID&quot; and 
    5657 *        &quot;SEQUENCE&quot; property to identify a specific instance of a recurring 
     
    5859 *        value is the effective value of the &quot;DTSTART&quot; property of the 
    5960 *        recurrence instance. 
    60  *      
     61 * 
    6162 *        Value Type: The default value type for this property is DATE-TIME. 
    6263 *        The time format can be any of the valid forms defined for a DATE-TIME 
     
    6465 *        interpretations of the various forms. The value type can be set to 
    6566 *        DATE. 
    66  *      
     67 * 
    6768 *        Property Parameters: Non-standard property, value data type, time 
    6869 *        zone identifier and recurrence identifier range parameters can be 
    6970 *        specified on this property. 
    70  *      
     71 * 
    7172 *        Conformance: This property can be specified in an iCalendar object 
    7273 *        containing a recurring calendar component. 
    73  *      
     74 * 
    7475 *        Description: The full range of calendar components specified by a 
    7576 *        recurrence set is referenced by referring to just the &quot;UID&quot; property 
     
    7778 *        property allows the reference to an individual instance within the 
    7879 *        recurrence set. 
    79  *      
     80 * 
    8081 *        If the value of the &quot;DTSTART&quot; property is a DATE type value, then the 
    8182 *        value MUST be the calendar date for the recurrence instance. 
    82  *      
     83 * 
    8384 *        The date/time value is set to the time when the original recurrence 
    8485 *        instance would occur; meaning that if the intent is to change a 
    8586 *        Friday meeting to Thursday, the date/time is still set to the 
    8687 *        original Friday meeting. 
    87  *      
     88 * 
    8889 *        The &quot;RECURRENCE-ID&quot; property is used in conjunction with the &quot;UID&quot; 
    8990 *        and &quot;SEQUENCE&quot; property to identify a particular instance of a 
     
    101102 *        &quot;THISANDFUTURE&quot; to indicate a range defined by the given recurrence 
    102103 *        instance and all subsequent instances. 
    103  *      
     104 * 
    104105 *        Format Definition: The property is defined by the following notation: 
    105  *      
     106 * 
    106107 *          recurid    = &quot;RECURRENCE-ID&quot; ridparam &quot;:&quot; ridval CRLF 
    107  *      
     108 * 
    108109 *          ridparam   = *( 
    109  *      
     110 * 
    110111 *                     ; the following are optional, 
    111112 *                     ; but MUST NOT occur more than once 
    112  *      
     113 * 
    113114 *                     (&quot;;&quot; &quot;VALUE&quot; &quot;=&quot; (&quot;DATE-TIME&quot; / &quot;DATE)) / 
    114115 *                     (&quot;;&quot; tzidparam) / (&quot;;&quot; rangeparam) / 
    115  *      
     116 * 
    116117 *                     ; the following is optional, 
    117118 *                     ; and MAY occur more than once 
    118  *      
     119 * 
    119120 *                     (&quot;;&quot; xparam) 
    120  *      
     121 * 
    121122 *                     ) 
    122  *      
     123 * 
    123124 *          ridval     = date-time / date 
    124125 *          ;Value MUST match value type 
    125126 * </pre> 
    126  *  
     127 * 
    127128 * @author Ben Fortuna 
    128129 */ 
     
    137138        super(RECURRENCE_ID); 
    138139        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); 
    139170    } 
    140171 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/TzUrl.java

    r1267 r1366  
    11/* 
    2  * $Id: TzUrl.java,v 1.11 2006/11/05 06:04:42 fortuna Exp $ 
    3  *  
     2 * $Id: TzUrl.java,v 1.12 2007/02/10 08:45:56 fortuna Exp $ 
     3 * 
    44 * Created: [Apr 6, 2004] 
    55 * 
     
    4747/** 
    4848 * Defines a TZURL iCalendar component property. 
    49  *  
     49 * 
    5050 * <pre> 
    5151 *     4.8.3.5 Time Zone URL 
    52  *      
     52 * 
    5353 *        Property Name: TZURL 
    54  *      
     54 * 
    5555 *        Purpose: The TZURL provides a means for a VTIMEZONE component to 
    5656 *        point to a network location that can be used to retrieve an up-to- 
    5757 *        date version of itself. 
    58  *      
     58 * 
    5959 *        Value Type: URI 
    60  *      
     60 * 
    6161 *        Property Parameters: Non-standard property parameters can be 
    6262 *        specified on this property. 
    63  *      
     63 * 
    6464 *        Conformance: This property can be specified in a &quot;VTIMEZONE&quot; calendar 
    6565 *        component. 
    66  *      
     66 * 
    6767 *        Description: The TZURL provides a means for a VTIMEZONE component to 
    6868 *        point to a network location that can be used to retrieve an up-to- 
     
    7171 *        this resource results in an iCalendar object containing a single 
    7272 *        VTIMEZONE component and a METHOD property set to PUBLISH. 
    73  *      
     73 * 
    7474 *        Format Definition: The property is defined by the following notation: 
    75  *      
     75 * 
    7676 *          tzurl      = &quot;TZURL&quot; tzurlparam &quot;:&quot; uri CRLF 
    77  *      
     77 * 
    7878 *          tzurlparam = *(&quot;;&quot; xparam) 
    79  *      
     79 * 
    8080 *        Example: The following is an example of this property: 
    81  *      
     81 * 
    8282 *          TZURL:http://timezones.r.us.net/tz/US-California-Los_Angeles 
    8383 * </pre> 
    84  *  
     84 * 
    8585 * @author Ben Fortuna 
    8686 */ 
     
    138138     */ 
    139139    public final void setValue(final String aValue) throws URISyntaxException { 
    140         uri = new URI(Uris.encode(aValue)); 
     140        uri = Uris.create(aValue); 
    141141    } 
    142142 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/model/property/Url.java

    r1364 r1366  
    11/* 
    2  * $Id: Url.java,v 1.11 2006/11/05 06:04:42 fortuna Exp $ 
     2 * $Id: Url.java,v 1.12 2007/02/10 08:45:56 fortuna Exp $ 
    33 * 
    44 * Created: [Apr 6, 2004] 
     
    3939import java.net.URISyntaxException; 
    4040 
    41 import net.fortuna.ical4j.model.Parameter; 
    4241import net.fortuna.ical4j.model.ParameterList; 
    4342import net.fortuna.ical4j.model.Property; 
    4443import net.fortuna.ical4j.model.ValidationException; 
    45 import net.fortuna.ical4j.util.ParameterValidator; 
    4644import net.fortuna.ical4j.util.Strings; 
    4745import net.fortuna.ical4j.util.Uris; 
     
    140138     */ 
    141139    public final void setValue(final String aValue) throws URISyntaxException { 
    142         uri = new URI(Uris.encode(aValue)); 
     140        uri = Uris.create(aValue); 
    143141    } 
    144142 
     
    164162    public final void validate() throws ValidationException { 
    165163        // TODO: Auto-generated method stub 
    166         ParameterValidator.getInstance().assertOneOrLess(Parameter.TYPE, 
    167                 getParameters()); 
    168164    } 
    169165} 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/util/TimeZones.java

    r1267 r1366  
    11/* 
    2  * $Id: TimeZones.java,v 1.3 2005/09/23 10:14:43 fortuna Exp $ [5/07/2004] 
     2 * $Id: TimeZones.java,v 1.4 2006/12/17 08:23:40 fortuna Exp $ [5/07/2004] 
    33 * 
    44 * Copyright (c) 2004, Ben Fortuna 
     
    4242 */ 
    4343public final class TimeZones { 
    44      
     44 
    4545    public static final String UTC_ID = "Etc/UTC"; 
    46      
     46 
     47    public static final String IBM_UTC_ID = "GMT"; 
     48 
    4749    public static final String GMT_ID = "Etc/GMT"; 
    4850 
     
    5254    private TimeZones() { 
    5355    } 
    54      
     56 
    5557    /** 
    5658     * Indicates whether the specified timezone is equivalent to 
     
    6264//        return timezone.hasSameRules(TimeZone.getTimeZone(UTC_ID)); 
    6365//        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()); 
    6568    } 
    6669} 
  • external/ical4j/ical4j-1.0-beta1/net/fortuna/ical4j/util/Uris.java

    r1267 r1366  
    11/* 
    2  * $Id: Uris.java,v 1.2 2006/04/17 11:29:12 fortuna Exp $ 
     2 * $Id: Uris.java,v 1.3 2007/02/10 08:32:21 fortuna Exp $ 
    33 * 
    44 * Created on 11/09/2005 
     
    2525 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    2626 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
    27  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
     27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
    2828 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
    2929 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
     
    3636package net.fortuna.ical4j.util; 
    3737 
     38import java.net.URI; 
     39import java.net.URISyntaxException; 
    3840 
    3941/** 
     
    4345public final class Uris { 
    4446 
    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 
    4951    /** 
    5052     * Constructor made private to enforce static nature. 
     
    5456 
    5557    /** 
    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. 
    5960     * @param s a URI string 
    6061     * @return an encoded URI string 
     
    6263    public static String encode(final String s) { 
    6364        /* 
    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 
    7269        /* 
    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. 
    8976         */ 
    90         if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_NOTES_COMPATIBILITY)) { 
     77        if (CompatibilityHints 
     78                .isHintEnabled(CompatibilityHints.KEY_NOTES_COMPATIBILITY)) { 
    9179            return s.replaceAll("[<>]", ""); 
    9280        } 
    9381        return s; 
    9482    } 
    95      
     83 
    9684    /** 
    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. 
    10087     * @param s a URI string 
    10188     * @return an encoded URI string 
     
    10390    public static String decode(final String s) { 
    10491        /* 
    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         */ 
    11295        return s; 
    11396    } 
     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    } 
    114119}