rrule icon indicating copy to clipboard operation
rrule copied to clipboard

Set<int> byHours,Set<int> bySeconds use List<int> instead would be better

Open rtugeek opened this issue 3 years ago • 0 comments

E.g.

repeat every day at 08:00, 09:23, 09:50, 10:23 (these times input by the user, could be totally random)

Set Example

if use Set,will gernate: byHours: {8,9,9,10} byMinutes: {0,23,50}, the minute (23) of "10:23" will removed because using Set. instances:

  1. 08:00 ← 1
  2. 08:23
  3. 08:50
  4. 09:00
  5. 09:23 ← 5
  6. 09:50 ← 6
  7. 10:00
  8. 10:23
  9. 10:50 ← 9
  10. ....

In this case, setting bysetpos to 1,5,6,9 will get the correct result, but this is impossible to implement by code because the information of byMinutes has been lost and the user's input could be totally random.

List Example

if use List, will gernate: byHours: {8,9,9,10} byMinutes: {0,23,50,23} instances:

  1. 08:00 ← 1 = 0 * byMinutes.length + 1
  2. 08:23
  3. 08:50
  4. 08:23
  5. 09:00
  6. 09:23 ← 6 = 1 * byMinutes.length + 1
  7. 09:50
  8. 09:23
  9. 09:00
  10. 09:23
  11. 09:50 ←11 = 2 * byMinutes.length + 1
  12. 09:23
  13. 10:00
  14. 10:23
  15. 10:50
  16. 10:23 ←16 = 3 * byMinutes.length + 1
  17. ...

In this case, setting bysetpos to 1,6,11,16 will get the correct result, and it's easy to implement by code because =there is a pattern in bysetpos: index * byMinutes.length + 1

rtugeek avatar Jun 24 '22 04:06 rtugeek