I have two classes; one interprets the commands and sends these commands to another class that executes them. Then I want the class that executes the commands to be able to send the results of this execution back to the interpreter class. The problem is that these results are hierarchical.
Currently, the only thing I know in the Java API that will allow me to do this is the DOM. I really do not want to work with the DOM by creating a new document, and then send a portion of it back to another class; it just looks like a BIG MSS. Is there anything else I can use?
Do you really need a specialized tree data structure if you can just create a class consisting of nodes? Just use the objects from the class, say Result, for the result and add fields to Resultfor possible child nodes. Fields can also be of type Result, if necessary.
Result
You can try some available data structures such as JDots http://sourceforge.net/projects/jdots/
JDots (Java Dynamic Object Tree Software) is a library / framework for creating a dynamic tree of Java objects, for the active exchange / distribution of methods
DOM , JDOM... ?
[result:true, childResults:[result:true, childResults:[], result:false, childResults:[]]]
- , ... .
EDIT:
, ... , , Java, Groovy , .. ( ?), ... , Groovy: )
, , API. . DOM xml/html, -? - ?
Java, .
.
Source: https://habr.com/ru/post/1718912/More articles:XML mode for XEmacs? - xmlFirst row style in WPF Datagrid - c #WPF - GridView.GridViewColumn two rows in a row? - c #Writing .NET for Windows through Linux and Mono - c #Determining relative positions in a layout? - androidWant to sort by record association records in Datamapper - sortingData structure for fast line queries? - c ++How to create own DLL in Visual Studio from C # code? - c ++Scalable coloring application Qt - qtCommunication between AIR (Flex) and C ++ applications - c ++All Articles