Esempio n. 1
0
 public String stateToString() {
   StringBuilder sb = new StringBuilder();
   sb.append(DateUtils.FORMAT_TIMESTAMP_ISO_8601.format(startDate.getTime())).append("~");
   sb.append(pattern.stateToString()).append("~");
   sb.append(period.stateToString());
   return sb.toString();
 }
Esempio n. 2
0
 public static Recurrence parse(String recurrence) {
   Recurrence r = new Recurrence();
   String[] a = recurrence.split("~");
   try {
     Date d = DateUtils.FORMAT_TIMESTAMP_ISO_8601.parse(a[0]);
     Calendar c = Calendar.getInstance();
     c.setTime(d);
     r.startDate = c;
   } catch (ParseException e) {
     throw new RuntimeException(recurrence);
   }
   r.pattern = RecurrencePattern.parse(a[1]);
   r.period = RecurrencePeriod.parse(a[2]);
   return r;
 }