code_junkie

What's a good algorithm for editing a “schedule” most efficiently?

Nov 11th, 2011
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. |---------------- A -------------------|
  2. |--- B ----| |--- B ---|
  3.  
  4. |---------------- A -------------------|
  5. |--- B ----| |--- B ---|
  6.  
  7. |---------------- A -------------------|
  8. |--- B ----| |--- B ---|
  9.  
  10. * A removed A-timespan removes all the linked timespans from B
  11. * An added A-timespan, what about this?
  12. * A shortened A-timespan removes all the linked timespans from B that now falls outside A
  13. * A lenghtened A-timespan, will this include all matching B-timespans now inside?
  14.  
  15. |-------------- A1 --------------| |-------- A2 --------------|
  16. |---- B1 ----| |----- B2 ---| |---- B3 ----| |-- B4 --|
  17.  
  18. |-------------- A1 ---------------------------------| |--- A2 --|
  19. |---- B1 ----| |----- B2 ---| |---- B3 ----| |-- B4 --|
  20.  
  21. 1. Lengthen (update) A1
  22. 2. Shorten and move (update) A2
  23. 3. Re-link (update) B3 from A2 to A1 instead
  24.  
  25. |-------------- A1 -----------------------------| |--- A2 --|
  26. |---- B1 ----| |----- B2 ---| |---- B3 ----| |-- B4 --|
  27.  
  28. |------------------ A -----------------------|
  29. |------- B1 -------| |------- B2 ------|
  30. |---| <-- I want to remove this from A
  31.  
  32. |------------------ A1 ----| |---- A2 -----|
  33. |------- B1 -------| |B3| |--- B2 ---|
  34.  
  35. |------------------ A1 ----| |---- A2 -----|
  36. |------- B1 -------|
Add Comment
Please, Sign In to add comment