1 package org.columba.calendar.model; 2 3 import java.util.Calendar ; 4 import java.util.List ; 5 6 import org.columba.calendar.model.api.IRecurrence; 7 import org.columba.calendar.model.api.IWeekDay; 8 9 public class Recurrence implements IRecurrence { 10 11 private int type; 12 private int endType; 13 private int endMaxOccurrences; 14 private Calendar endDate; 15 private int interval; 16 private List <IWeekDay> weekDays; 17 18 public Recurrence(int type) { 19 this.type = type; 20 } 21 22 public Recurrence(int type, int endType, int endMaxOccurrences, Calendar endDate, int interval, List <IWeekDay> weekdays) { 23 this.type = type; 24 this.endType = endType; 25 this.endDate = endDate; 26 this.endMaxOccurrences = endMaxOccurrences; 27 this.interval = interval; 28 this.weekDays = weekdays; 29 } 30 31 public Calendar getEndDate() { 32 return endDate; 33 } 34 35 public int getEndMaxOccurrences() { 36 return endMaxOccurrences; 37 } 38 39 public int getEndType() { 40 return endType; 41 } 42 43 public int getInterval() { 44 return interval; 45 } 46 47 public int getType() { 48 return type; 49 } 50 51 public List getWeekDays() { 52 return weekDays; 53 } 54 55 public void setEndDate(Calendar endDate) { 56 this.endDate = endDate; 57 } 58 59 public void setEndMaxOccurrences(int max) { 60 this.endMaxOccurrences = max; 61 } 62 63 public void setEndType(int type) { 64 this.endType = type; 65 } 66 67 public void setInterval(int interval) { 68 this.interval = interval; 69 } 70 71 public void setType(int type) { 72 this.type = type; 73 } 74 75 public void setWeekDays(List <IWeekDay> days) { 76 this.weekDays = days; 77 } 78 79 public static int toFrequency(int recurrenceType2) { 80 switch (recurrenceType2) { 81 case RECURRENCE_WEEKLY: 82 return java.util.Calendar.WEEK_OF_YEAR; 83 case RECURRENCE_DAILY: 84 return java.util.Calendar.DAY_OF_YEAR; 85 case RECURRENCE_ANNUALLY: 86 return java.util.Calendar.YEAR; 87 case RECURRENCE_MONTHLY: 88 return java.util.Calendar.MONTH; 89 } 90 return -1; 91 } 92 93 public static int fromFrequency(int recurrenceType2) { 94 switch (recurrenceType2) { 95 case java.util.Calendar.WEEK_OF_YEAR: 96 return RECURRENCE_WEEKLY; 97 case java.util.Calendar.DAY_OF_YEAR: 98 return RECURRENCE_DAILY; 99 case java.util.Calendar.YEAR: 100 return RECURRENCE_ANNUALLY; 101 case java.util.Calendar.MONTH: 102 return RECURRENCE_MONTHLY; 103 } 104 return RECURRENCE_NONE; 105 } 106 107 } 108 | Popular Tags |