public interface CustomDuplication
Factory.duplicate). If a Resource class requires custom duplication logic it should implement this interface and provide a method to create a new resource instance that has the same behaviour as
Create a duplicate of this resource. The object returned
need not be of the same concrete class as
should behave the same and implement the same set of GATE core
interfaces, i.e. if
ProcessingResource then the duplicate should also
LanguageAnalyser then the duplicate should
Typical uses for resource duplication are multi-threaded applications that require a number of identical resources for concurrent use in different threads. Therefore it is important that duplicates created by this method should be safe for concurrent use in multiple threads - in some cases it may be appropriate for the duplicate to share some state with the original object, but this must be handled in a thread-safe manner.
Implementors of this interface should not use covariant return types, as to do so may limit the flexibility of subclasses to implement duplication in the most efficient manner.
NOTE this method cannot be called directly, use
ctx- the current
duplication context. If an implementation of this method needs to duplicate any other resources as part of the custom duplication process it should pass this context back to the two-argument form of
Factory.duplicaterather than using the single-argument form.