+ node.parent = this;
+ if (op != null && node.op != null) {
+ if (!op.getSubOps().contains(node.op)) {
+ op.addSubOp(node.op);
+ node.op.addParentOp(op);
+ }
+ }
+ }
+
+ public void sort() {
+ if (children == null)
+ return;
+ Comparator<UpdateNode> comparator = new Comparator<UpdateNode>() {
+ @Override
+ public int compare(UpdateNode o1, UpdateNode o2) {
+ return o1.getLabel().compareTo(o2.getLabel());
+ }
+ };
+ Collections.sort(this.children, comparator );
+ for (UpdateNode n : this.children) {
+ n.sort(comparator);
+ }
+ }
+
+ public void sort(Comparator<UpdateNode> comparator ) {
+ if (children == null)
+ return;
+ Collections.sort(this.children, comparator );
+ for (UpdateNode n : this.children) {
+ n.sort(comparator);
+ }