org.rapla.entities.domain
Interface Appointment

All Superinterfaces:
Comparable, Entity, Ownable, RaplaObject

public interface Appointment
extends RaplaObject, Entity, Comparable, Ownable

The basic building blocks of reservations.

See Also:
Reservation, Repeating

Field Summary
static Appointment[] EMPTY_ARRAY
           
static RaplaType TYPE
           
 
Fields inherited from interface org.rapla.entities.Entity
ENTITY_ARRAY
 
Method Summary
 void createBlocks(Date start, Date end, AppointmentBlockArray blocks)
          adds all Appointment-blocks in the given period to the appointmentBlockArray.
 void createBlocks(Date start, Date end, AppointmentBlockArray blocks, boolean excludeExceptions)
          adds all Appointment-blocks in the given period to the appointmentBlockArray.
 Date getEnd()
           
 Date getFirstDifference(Appointment a2, Date maxDate)
           
 Date getLastDifference(Appointment a2, Date maxDate)
           
 Date getMaxEnd()
           If no repeating is set this method will return the same as getEnd().
 Repeating getRepeating()
           
 Reservation getReservation()
          returns the reservation that owns the appointment.
 Date getStart()
           
 boolean isRepeatingEnabled()
          returns if the appointment has a repeating
 boolean isWholeDaysSet()
          this method will be used for future enhancements
 boolean matches(Appointment appointment)
          Returns if the exceptions, repeatings, start and end dates of the Appoinemnts are the same.
 void move(Date newStart)
          Moves the start-time of the appointment.
 void move(Date start, Date end)
          Changes the start- and end-time of the appointment.
 boolean overlaps(Appointment appointment)
          Tests two appointments for overlap.
 boolean overlaps(Date start, Date end)
          Test for overlap with a period.
 boolean overlaps(Date start, Date end, boolean considerExceptions)
          Test for overlap with a period.
 void setRepeatingEnabled(boolean enableRepeating)
          Enables repeating for this appointment.
 void setWholeDays(boolean enable)
          this method will be used for future enhancements
 
Methods inherited from interface org.rapla.entities.Entity
isIdentical, isPersistant
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.rapla.entities.Ownable
getOwner, setOwner
 

Field Detail

TYPE

static final RaplaType TYPE

EMPTY_ARRAY

static final Appointment[] EMPTY_ARRAY
Method Detail

getStart

Date getStart()

getEnd

Date getEnd()

getMaxEnd

Date getMaxEnd()

If no repeating is set this method will return the same as getEnd().

If the repeating has no end the method will return Null. Oterwise the maximum of getEnd() and repeating.getEnd() will be returned.

See Also:
getEnd(), Repeating

getReservation

Reservation getReservation()
returns the reservation that owns the appointment.

Returns:
the reservation that owns the appointment or null if the appointment does not belong to a reservation.

getRepeating

Repeating getRepeating()
Returns:
null if the appointment has no repeating

setRepeatingEnabled

void setRepeatingEnabled(boolean enableRepeating)
Enables repeating for this appointment. Use getRepeating() to manipulate the repeating.


isRepeatingEnabled

boolean isRepeatingEnabled()
returns if the appointment has a repeating


move

void move(Date start,
          Date end)
Changes the start- and end-time of the appointment.


move

void move(Date newStart)
Moves the start-time of the appointment. The end-time will be adjusted accordingly to the duration of the appointment.


overlaps

boolean overlaps(Appointment appointment)
Tests two appointments for overlap. Important: Times like 13:00-14:00 and 14:00-15:00 do not overlap The overlap-relation must be symmetric a1.overlaps(a2) == a2.overlaps(a1)

Returns:
true if the appointment overlaps the given appointment.

overlaps

boolean overlaps(Date start,
                 Date end)
Test for overlap with a period. same as overlaps( start, end, true)

Returns:
true if the overlaps with the given period.

overlaps

boolean overlaps(Date start,
                 Date end,
                 boolean considerExceptions)
Test for overlap with a period. You can specify if exceptions should be considered in the overlapping algorithm.

Returns:
true if the overlaps with the given period.

matches

boolean matches(Appointment appointment)
Returns if the exceptions, repeatings, start and end dates of the Appoinemnts are the same.


getFirstDifference

Date getFirstDifference(Appointment a2,
                        Date maxDate)
Parameters:
maxDate - must not be null, specifies the last date that should be searched returns the first date at which the two appointments differ (dates after maxDate will not be calculated)

getLastDifference

Date getLastDifference(Appointment a2,
                       Date maxDate)
Parameters:
maxDate - must not be null, specifies the last date that should be searched returns the last date at which the two appointments differ. (dates after maxDate will not be calculated)

isWholeDaysSet

boolean isWholeDaysSet()
this method will be used for future enhancements


setWholeDays

void setWholeDays(boolean enable)
this method will be used for future enhancements


createBlocks

void createBlocks(Date start,
                  Date end,
                  AppointmentBlockArray blocks)
adds all Appointment-blocks in the given period to the appointmentBlockArray. A block is in the period if its starttimestart. Exceptions are excluded, i.e. there is no block on an exception date.


createBlocks

void createBlocks(Date start,
                  Date end,
                  AppointmentBlockArray blocks,
                  boolean excludeExceptions)
adds all Appointment-blocks in the given period to the appointmentBlockArray. A block is in the period if its starttimestart. You can specify if exceptions should be excluded.



Copyright © 2000-2006 Rapla Team. All Rights Reseserved.