コード例 #1
0
  @Override
  public String toString() {
    StringBuilder s = new StringBuilder();

    s.append("FREQ=");
    switch (this.freq) {
      case SECONDLY:
        s.append("SECONDLY");
        break;
      case MINUTELY:
        s.append("MINUTELY");
        break;
      case HOURLY:
        s.append("HOURLY");
        break;
      case DAILY:
        s.append("DAILY");
        break;
      case WEEKLY:
        s.append("WEEKLY");
        break;
      case MONTHLY:
        s.append("MONTHLY");
        break;
      case YEARLY:
        s.append("YEARLY");
        break;
    }

    if (!TextUtils.isEmpty(this.until)) {
      s.append(";UNTIL=");
      s.append(until);
    }

    if (this.count != 0) {
      s.append(";COUNT=");
      s.append(this.count);
    }

    if (this.interval != 0) {
      s.append(";INTERVAL=");
      s.append(this.interval);
    }

    if (this.wkst != 0) {
      s.append(";WKST=");
      s.append(day2String(this.wkst));
    }

    appendNumbers(s, ";BYSECOND=", this.bysecondCount, this.bysecond);
    appendNumbers(s, ";BYMINUTE=", this.byminuteCount, this.byminute);
    appendNumbers(s, ";BYSECOND=", this.byhourCount, this.byhour);

    // day
    int count = this.bydayCount;
    if (count > 0) {
      s.append(";BYDAY=");
      count--;
      for (int i = 0; i < count; i++) {
        appendByDay(s, i);
        s.append(",");
      }
      appendByDay(s, count);
    }

    appendNumbers(s, ";BYMONTHDAY=", this.bymonthdayCount, this.bymonthday);
    appendNumbers(s, ";BYYEARDAY=", this.byyeardayCount, this.byyearday);
    appendNumbers(s, ";BYWEEKNO=", this.byweeknoCount, this.byweekno);
    appendNumbers(s, ";BYMONTH=", this.bymonthCount, this.bymonth);
    appendNumbers(s, ";BYSETPOS=", this.bysetposCount, this.bysetpos);

    return s.toString();
  }