001: /*--------------------------------------------------------------------------*
002: | Copyright (C) 2006 Christopher Kohlhaas |
003: | |
004: | This program is free software; you can redistribute it and/or modify |
005: | it under the terms of the GNU General Public License as published by the |
006: | Free Software Foundation. A copy of the license has been included with |
007: | these distribution in the COPYING file, if not go to www.fsf.org |
008: | |
009: | As a special exception, you are granted the permissions to link this |
010: | program with every library, which license fulfills the Open Source |
011: | Definition as published by the Open Source Initiative (OSI). |
012: *--------------------------------------------------------------------------*/
013: package org.rapla.entities.domain;
014:
015: import java.util.Date;
016:
017: /** Encapsulates the repeating rule for an appointment.
018: @see Appointment*/
019: public interface Repeating {
020: RepeatingType DAILY = RepeatingType.DAILY;
021: RepeatingType WEEKLY = RepeatingType.WEEKLY;
022: RepeatingType MONTHLY = RepeatingType.MONTHLY;
023: RepeatingType YEARLY = RepeatingType.YEARLY;
024:
025: void setInterval(int interval);
026:
027: /** returns the number of intervals between two repeatings.
028: * That are in the selected context:
029: * <li>For weekly repeatings: Number of weeks.</li>
030: * <li>For dayly repeatings: Number of days.</li>
031: */
032: int getInterval();
033:
034: /** The value returned depends which method was called last.
035: * If <code>setNumber()</code> has been called with a parameter
036: * >=0 <code>fixedNumber()</code> will return true. If
037: * <code>setEnd()</code> has been called
038: * <code>fixedNumber()</code> will return false.
039: * @see #setEnd
040: * @see #setNumber
041: */
042: boolean isFixedNumber();
043:
044: /** Set the end of repeating.
045: * If this value is set to null and the
046: * number is set to -1 the appointment will repeat
047: * forever.
048: * @param end If not null isFixedNumber will return true.
049: * @see #setNumber
050: */
051: void setEnd(Date end);
052:
053: /* @return end of repeating or null if unlimited */
054: Date getEnd();
055:
056: /** Set a fixed number of repeating.
057: * If this value is set to -1
058: * and the repeating end is set to null the appointment will
059: * repeat forever.
060: * @param number If >=0 isFixedNumber will return true.
061: * @see #setEnd
062: * @see #isFixedNumber
063: */
064: void setNumber(int number);
065:
066: /* @return number of repeating or -1 if it repeats forever. */
067: int getNumber();
068:
069: /* daily,weekly, monthly */
070: RepeatingType getType();
071:
072: /* daily,weekly, monthly */
073: void setType(RepeatingType type);
074:
075: /* exceptions for this repeating. */
076: Date[] getExceptions();
077:
078: boolean hasExceptions();
079:
080: boolean isWeekly();
081:
082: boolean isDaily();
083:
084: boolean isMonthly();
085:
086: boolean isYearly();
087:
088: void addException(Date date);
089:
090: void removeException(Date date);
091:
092: void clearExceptions();
093:
094: /** returns the appointment of this repeating.
095: @see Appointment
096: */
097: Appointment getAppointment();
098:
099: /* tests if an exception is added for the given date */
100: boolean isException(long date);
101:
102: Object clone();
103: }
|