|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface CustomDuplication
Interface which should be implemented by any Resource type which
cannot be duplicated in the standard way (see
Factory.duplicate). If a Resource
class requires custom duplication logic it should implement this
interface and provide an implementation of the
duplicate method to create a new
resource instance that has the same behaviour as this.
| Method Summary | |
|---|---|
Resource |
duplicate(Factory.DuplicationContext ctx)
Create a duplicate of this resource. |
| Method Detail |
|---|
Resource duplicate(Factory.DuplicationContext ctx)
throws ResourceInstantiationException
Create a duplicate of this resource. The object returned
need not be of the same concrete class as this, but
should behave the same and implement the same set of GATE core
interfaces, i.e. if this implements
ProcessingResource then the duplicate should also
implement ProcessingResource, if this
implements LanguageAnalyser then the duplicate should
also implement LanguageAnalyser, etc.
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
Factory.duplicate(Resource) instead.
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.duplicate
rather than using the single-argument form.
ResourceInstantiationException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||