Class EventGenerator

  • public class EventGenerator
    extends Object
    Continuation-based content diff implementation that generates EventHandler callbacks by recursing down a content diff in a way that guarantees that only a finite number of callbacks will be made during a generate() method call, regardless of how large or complex the content diff is.

    A simple usage pattern would look like this:

     EventGenerator generator = new EventGenerator(before, after, handler);
     while (!generator.isDone()) {
    • Constructor Detail

      • EventGenerator

        public EventGenerator​(@NotNull
                              @NotNull NodeState before,
                              @NotNull NodeState after,
                              @NotNull EventHandler handler)
        Creates a new generator instance for processing the given changes.
    • Method Detail

      • isDone

        public boolean isDone()
        Checks whether there are no more content changes to be processed.
      • generate

        public void generate()
        Generates a finite number of EventHandler callbacks based on the content changes that have yet to be processed. Further processing (even if no callbacks were made) may be postponed to a future generate() call, until the isDone() method finally return true.