com.cc.framework.ui.model.imp
Class RecurrencePatternImp.AbstractRecurrenceIterator

java.lang.Object
  extended bycom.cc.framework.ui.model.imp.RecurrencePatternImp.AbstractRecurrenceIterator
All Implemented Interfaces:
java.util.Iterator
Direct Known Subclasses:
RecurrencePatternImp.DailyIterator, RecurrencePatternImp.MonthlyIterator, RecurrencePatternImp.MonthlyNthIterator, RecurrencePatternImp.WeeklyIterator, RecurrencePatternImp.YearlyIterator, RecurrencePatternImp.YearlyNthIterator
Enclosing class:
RecurrencePatternImp

protected abstract static class RecurrencePatternImp.AbstractRecurrenceIterator
extends java.lang.Object
implements java.util.Iterator

Day iterator

Author:
Harald Schulz

Field Summary
protected  java.util.Calendar current
          The current iteration element
protected  java.util.Calendar endDate
          The patterns end date
protected  RecurrencePattern pattern
          The recurrence pattern that specifies the occurrences
 
Constructor Summary
RecurrencePatternImp.AbstractRecurrenceIterator(RecurrencePattern pattern)
          Constructor
 
Method Summary
 java.util.Calendar calcEndDate()
          Calculates the end date for a Recurrence pattern with a limited number of occurrences
protected static boolean checkDayInstance(int dayOfMonth, int dayOfMonthMax, int dayOfWeek, int dayOfWeekMask, int instance)
          Checks if the given day matches the instance
protected  java.util.Calendar doCalcEndDate()
          Calculates the pattern end date
protected abstract  boolean doMatch(java.util.Calendar date)
          Checks if this iterator matches a certain date
 boolean hasNext()
           
 boolean match(java.util.Calendar date)
          Checks if this iterator matches a certain date
 java.lang.Object next()
           
 void remove()
           
protected  void reset()
          Resets the iterator to the first iteration element for this iterator
protected  void selectNext()
          Selects the next iteration element for this iterator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pattern

protected RecurrencePattern pattern
The recurrence pattern that specifies the occurrences


current

protected java.util.Calendar current
The current iteration element


endDate

protected java.util.Calendar endDate
The patterns end date

Constructor Detail

RecurrencePatternImp.AbstractRecurrenceIterator

public RecurrencePatternImp.AbstractRecurrenceIterator(RecurrencePattern pattern)
Constructor

Parameters:
pattern - the recurrence pattern
Method Detail

reset

protected void reset()
Resets the iterator to the first iteration element for this iterator


selectNext

protected void selectNext()
Selects the next iteration element for this iterator


hasNext

public final boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator
See Also:
Iterator.hasNext()

next

public final java.lang.Object next()
Specified by:
next in interface java.util.Iterator
See Also:
Iterator.next()

remove

public final void remove()
Specified by:
remove in interface java.util.Iterator
See Also:
Iterator.remove()

match

public final boolean match(java.util.Calendar date)
Checks if this iterator matches a certain date

Parameters:
date - The date to check
Returns:
returns true if this recurrence pattern is relevant for the given date

doMatch

protected abstract boolean doMatch(java.util.Calendar date)
Checks if this iterator matches a certain date

Parameters:
date - The date to check
Returns:
returns true if this recurrence pattern is relevant for the given date

calcEndDate

public final java.util.Calendar calcEndDate()
Calculates the end date for a Recurrence pattern with a limited number of occurrences

Returns:
returns the date of the last occurrence

doCalcEndDate

protected java.util.Calendar doCalcEndDate()
Calculates the pattern end date

Returns:
the end date or null when the pattern has no end date

checkDayInstance

protected static boolean checkDayInstance(int dayOfMonth,
                                          int dayOfMonthMax,
                                          int dayOfWeek,
                                          int dayOfWeekMask,
                                          int instance)
Checks if the given day matches the instance

Parameters:
dayOfMonth - The day of month to check
dayOfMonthMax - The maximum days of the current month
dayOfWeek - Day of week to check
dayOfWeekMask - The mask with the allowed days
instance - the instance to check
Returns:
true if the given day matches the instance


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.