org.jasig.schedassist.model
Class VisibleSchedule

java.lang.Object
  extended by org.jasig.schedassist.model.VisibleSchedule
All Implemented Interfaces:
Serializable

public class VisibleSchedule
extends Object
implements Serializable

Object representation of the merged result of an IScheduleOwner's AvailableSchedule and their Calendar data (from a ICalendarDataDao).

Version:
$Id: VisibleSchedule.java 2530 2010-09-10 20:21:16Z npblair $
Author:
Nicholas Blair, nblair@doit.wisc.edu
See Also:
Serialized Form

Constructor Summary
VisibleSchedule(MeetingDurations meetingDurations)
          Default constructor.
 
Method Summary
 void addFreeBlock(AvailableBlock block)
          If the internal map already contains the target block as a key, the existing key is removed and the new block is stored as the key.
 void addFreeBlocks(Collection<AvailableBlock> blocks)
          Invokes addFreeBlock(AvailableBlock) on each AvailableBlock in the Collection.
 int getAttendingCount()
           
 List<AvailableBlock> getAttendingList()
           
protected  List<AvailableBlock> getBlockListForStatus(AvailableStatus targetStatus)
          Iterate through the blockMap and return a List of AvailableBlocks that match the target AvailableStatus.
 SortedMap<AvailableBlock,AvailableStatus> getBlockMap()
           
 int getBusyCount()
           
 List<AvailableBlock> getBusyList()
           
 net.fortuna.ical4j.model.Calendar getCalendar()
          Convenience method to generate an ical4j Calendar from the AvailableBlocks stored in this instance.
protected  int getCountForStatus(AvailableStatus targetStatus)
          Iterate through the blockMap and return a count of AvailableBlocks that match the target AvailableStatus.
 int getFreeCount()
           
 List<AvailableBlock> getFreeList()
           
 Date getScheduleEnd()
          Return the endTime of the last AvailableBlock stored within this object, or null if this object is empty.
 Date getScheduleStart()
          Return the startTime of the first AvailableBlock stored within this object, or null if this object is empty.
 int getSize()
           
protected  Set<AvailableBlock> locateConflicting(AvailableBlock conflict)
          Returns the set of AvailableBlock objects within this instance that conflict with the argument.
 void overwriteFreeBlockOnlyIfPresent(AvailableBlock block)
          If the internal map already contains the target block as a key, remove the existing and store the argument in its place.
 void setAttendingBlock(AvailableBlock block)
          ONLY stores the block in the map if conflicting FREE blocks are already stored in the block.
 void setAttendingBlocks(Collection<AvailableBlock> blocks)
           
 void setBusyBlock(AvailableBlock block)
          ONLY stores the block in the map if conflicting FREE blocks are already stored in the block.
 void setBusyBlocks(Collection<AvailableBlock> blocks)
           
 VisibleSchedule subset(Date start, Date end)
          This method returns a subset of this VisibleSchedule including only blocks between start and end, inclusive.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VisibleSchedule

public VisibleSchedule(MeetingDurations meetingDurations)
Default constructor.

Method Detail

addFreeBlock

public void addFreeBlock(AvailableBlock block)
If the internal map already contains the target block as a key, the existing key is removed and the new block is stored as the key. Stores the value for this key as AvailableStatus.FREE.

Parameters:
block -

overwriteFreeBlockOnlyIfPresent

public void overwriteFreeBlockOnlyIfPresent(AvailableBlock block)
If the internal map already contains the target block as a key, remove the existing and store the argument in its place. Otherwise does not store this block.

Parameters:
block -

addFreeBlocks

public void addFreeBlocks(Collection<AvailableBlock> blocks)
Invokes addFreeBlock(AvailableBlock) on each AvailableBlock in the Collection.

Parameters:
blocks -

setBusyBlock

public void setBusyBlock(AvailableBlock block)
ONLY stores the block in the map if conflicting FREE blocks are already stored in the block.

Parameters:
block -

setBusyBlocks

public void setBusyBlocks(Collection<AvailableBlock> blocks)
Parameters:
blocks -

setAttendingBlock

public void setAttendingBlock(AvailableBlock block)
ONLY stores the block in the map if conflicting FREE blocks are already stored in the block.

Parameters:
block -

setAttendingBlocks

public void setAttendingBlocks(Collection<AvailableBlock> blocks)
Parameters:
blocks -

getBlockMap

public SortedMap<AvailableBlock,AvailableStatus> getBlockMap()
Returns:
a defensive copy of the whole map

getSize

public int getSize()
Returns:
the number of events in this VisibleSchedule

getFreeCount

public int getFreeCount()
Returns:
the number of free blocks in this instance

getBusyCount

public int getBusyCount()
Returns:
the number of busy blocks in this instance

getAttendingCount

public int getAttendingCount()
Returns:
the number of attending blocks in this instance

getFreeList

public List<AvailableBlock> getFreeList()
Returns:
a List of AvailableBlock in this VisibleSchedule that are AvailableStatus.FREE

getBusyList

public List<AvailableBlock> getBusyList()
Returns:
a List of AvailableBlock in this VisibleSchedule that are AvailableStatus.BUSY

getAttendingList

public List<AvailableBlock> getAttendingList()
Returns:
a List of AvailableBlock in this VisibleSchedule that are AvailableStatus.ATTENDING

getScheduleStart

public Date getScheduleStart()
Return the startTime of the first AvailableBlock stored within this object, or null if this object is empty.

Returns:
the first start time of the first block in this instance

getScheduleEnd

public Date getScheduleEnd()
Return the endTime of the last AvailableBlock stored within this object, or null if this object is empty.

Returns:
the very last end time of the last block in this instance

getCalendar

public net.fortuna.ical4j.model.Calendar getCalendar()
Convenience method to generate an ical4j Calendar from the AvailableBlocks stored in this instance. The VEvents are very rudimentary, simply defining the start date, end date, and have an event title that matches the status (and number of attendees if visitorLimit is > 1).

Returns:
a Calendar of free/busy/attending events from this instance

subset

public VisibleSchedule subset(Date start,
                              Date end)
This method returns a subset of this VisibleSchedule including only blocks between start and end, inclusive.

Parameters:
start -
end -
Returns:
a subset of this instance between the dates, inclusive

locateConflicting

protected Set<AvailableBlock> locateConflicting(AvailableBlock conflict)
Returns the set of AvailableBlock objects within this instance that conflict with the argument. A conflict is defined as any overlap of 1 minute or more.

Parameters:
conflict -
Returns:
a set of conflicting blocks within this instance that conflict with the block argument

getCountForStatus

protected int getCountForStatus(AvailableStatus targetStatus)
Iterate through the blockMap and return a count of AvailableBlocks that match the target AvailableStatus.

Parameters:
targetStatus -
Returns:
a count of the number of blocks in this instance that match the status argument

getBlockListForStatus

protected List<AvailableBlock> getBlockListForStatus(AvailableStatus targetStatus)
Iterate through the blockMap and return a List of AvailableBlocks that match the target AvailableStatus.

Parameters:
targetStatus -
Returns:
the list of blocks within this instance that match the status


Copyright © 2011 Jasig. All Rights Reserved.