/** * Get all the terminal nodes pending from this one, or itself if it is already a terminal node * * @return List of terminal nodes pending from this one */ public ArrayList<OntologyElement> getTerminalChildren() { ArrayList<OntologyElement> ret = new ArrayList<>(); if (this.children.isEmpty()) { ret.add(this); return ret; } for (OntologyElement elem : this.children) { ret.addAll(elem.getTerminalChildren()); } return ret; }
/** * Add multiple children to this ontology element and set this element as parent of all of them. * * @param children List of the new children elements */ public void addChildren(ArrayList<OntologyElement> children) { this.children.addAll(children); for (OntologyElement e : children) { e.parent = this; } }
/** * Assigns a child ontology element to this one. It also sets this element as parent of the new * child. * * @param child New child ontology element */ public void addChild(OntologyElement child) { this.children.add(child); child.parent = this; }