Task #2056

Updated by Sebastien Jacquot over 2 years ago

Mutualize and clarify the result nodes tree hierarchy. It will also permit to avoid cyclic dependencies in plug-ins.

h3. Solution

* define methods in TXMResult (or TXMObject?): getParent(), getChildren(), delete(), deleteChild(int index), etc. and copy(), clone() ?
* override these in subclasses that needs to free some other resources/objects
* check the way that the toolbox uses to remove an object from R (RServeVariablesView) and enhance it (at this moment it tests the instanceof each object leading to cyclic dependencies in plug-ins)
* define method updateChild(int index) to update a child result from modification of its parent?

* use the methods in the result adapters

NOTE: these adapters are used to fill the tree of the corpora view:

* see: /org.txm.rcp/src/main/java/org/txm/rcpapplication/TextometrieContentProvider.java
* and: /org.txm.rcp/src/main/java/org/txm/rcpapplication/TextometrieLabelProvider.java

SJ: First proposal:

* define TXMResult
* define TXMObject extends TXMResult
* * find a better name for TXMObject
* redefine Function role:
* * does only computation and produces a TXMResult
* * this class is used to monitor a computation
* delete/merge HasResult
* delete/merge Result
* check that all commands inherit from TXMResult

SJ: current state after developments (2017-04-03) :
* class org.txm.core.results.TXMResult.java and interface org.txm.core.results.ITXMResult.java has been developed
* interface ITXMResult was needed for some TXM abstract results as LexicalTable, LexicalTableImpl, etc.
* HasResult, Result and old TXMResult classes have been removed/merged
* TxmObject inherits from new TXMResult (need to clarify here, the name are not well chosen)

* Actual hierarchy
** TXMResult <- Function <- A function (with thread canceling support)
** TXMResult <- A result (without thread canceling support)
** TXMResult <- TxmObject <- an object
** IChartResult <- ITXMResult (used for export purpose)

* Still in progress:
** need to clarify the Function class role and name
** need to clarify the TxmObject role and name
*** the problem here is a TxmObject needs methods from TXMResult but that's strange to have a TxmObject that inherits from a result in terms of semantic