Is the Java API a data structure for representing a hierarchy

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?

+3
source share
5 answers

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.

+2
source

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

+1
source

DOM , JDOM... ?

[result:true, childResults:[result:true, childResults:[], result:false, childResults:[]]] 

- , ... .

EDIT:

, ... , , Java, Groovy , .. ( ?), ... , Groovy: )

+1

, , API. . DOM xml/html, -? - ?

0

Java, .

.

0
source

Source: https://habr.com/ru/post/1718912/


All Articles