I am writing a method that needs to break a delta into pieces (e.g. two deltas that result in the same patch as the original delta). The current design is problematic because:
- I don't want my method to know/care what the delta type is.
- The
AbstractDelta class is abstract, so I cannot simply invoke its constructor.
- The
AbstractDelta subtypes do not provide with() methods.
- Some of your code (e.g.
DiffRowGenerator) check the class type instance (e.g. if (delta instanceof InsertDelta) instead of using AbstractDelta.getType() so I cannot subclass AbstractDelta myself.
Probably the easiest way to resolve this is to add an abstract withChunks(Chunk<T> original, Chunk<T> revised) method to AbstractDelta.