Achim,
wow - quick reaction !!
When I was first thinking about the topic the first idea was to remove the static methods
I was doing that for the class DictionaryDataFile (removing the static fields/methods), so now there is one instance of DictionaryDataFile per dictionary.
Where I'm not sure now is how multithreading is working now. Will there be multiple calls providing results? Or do they come in a batch once? Does it work in synchronous mode or only in asynchronous mode?
You hit the interesting point ! I was thinking quite a bit about how to do this. Finally, I did favour the presented solution, because there is only rather limited impact on the interface.
Let me explain: multithreading works as it did before. That means that a call to
TranslationExecution.executeTranslation with
executeInBackground will start a new thread that executes the translation. If you should do another call to
TranslationExecution.executeTranslation before the previous translation completed, then that would interrupt the previous translation and start a new translation thread (this can happen for example with incremental search, where the user extended an expression before the translation results of the previous translation were there).
In order to run a translation over several dictionaries, you will have to run them one after the other. Each time when
newTranslationResult is called, then the next translation can be executed.
Optionally, we could think to have an additional
TranslationExecution.executeTranslationBatch where a list of translation jobs is passed in. Hmmmm, then
TranslationResult could not carry the field dictionary, cause a
TranslationResult would have several
SingleTranslation each with a field
dictionary. Guess that would not be hard to implement.
Hmmmm, or for a list of translation jobs there would be a list of
TranslationResult, each for a separate dictionary (then the field
dictionary in
TranslationResult would be ok). Hmmmm, what are your ideas on that ?
With best greetings,
Gert