JAL-1807 includes ?j2sdebug flag and DebugJS._(msg)
[jalviewjs.git] / bin / jalview / datamodel / BinaryNode.js
1 Clazz.declarePackage ("jalview.datamodel");
2 c$ = Clazz.decorateAsClass (function () {
3 this.$element = null;
4 this.name = null;
5 this.$left = null;
6 this.$right = null;
7 this.$parent = null;
8 this.bootstrap = 0;
9 Clazz.instantialize (this, arguments);
10 }, jalview.datamodel, "BinaryNode");
11 Clazz.makeConstructor (c$, 
12 function () {
13 this.$left = this.$right = this.$parent = null;
14 this.bootstrap = 0;
15 });
16 Clazz.makeConstructor (c$, 
17 function (element, parent, name) {
18 this.$element = element;
19 this.$parent = parent;
20 this.name = name;
21 this.$left = this.$right = null;
22 }, "~O,jalview.datamodel.BinaryNode,~S");
23 Clazz.defineMethod (c$, "element", 
24 function () {
25 return this.$element;
26 });
27 Clazz.defineMethod (c$, "setElement", 
28 function (v) {
29 return this.$element = v;
30 }, "~O");
31 Clazz.defineMethod (c$, "left", 
32 function () {
33 return this.$left;
34 });
35 Clazz.defineMethod (c$, "setLeft", 
36 function (n) {
37 return this.$left = n;
38 }, "jalview.datamodel.BinaryNode");
39 Clazz.defineMethod (c$, "right", 
40 function () {
41 return this.$right;
42 });
43 Clazz.defineMethod (c$, "setRight", 
44 function (n) {
45 return this.$right = n;
46 }, "jalview.datamodel.BinaryNode");
47 Clazz.defineMethod (c$, "parent", 
48 function () {
49 return this.$parent;
50 });
51 Clazz.defineMethod (c$, "setParent", 
52 function (n) {
53 return this.$parent = n;
54 }, "jalview.datamodel.BinaryNode");
55 Clazz.defineMethod (c$, "isLeaf", 
56 function () {
57 return (this.$left == null) && (this.$right == null);
58 });
59 Clazz.defineMethod (c$, "SetChildren", 
60 function (leftchild, rightchild) {
61 if (leftchild != null) {
62 this.setLeft (leftchild);
63 leftchild.detach ();
64 leftchild.setParent (this);
65 }if (rightchild != null) {
66 this.setRight (rightchild);
67 rightchild.detach ();
68 rightchild.setParent (this);
69 }}, "jalview.datamodel.BinaryNode,jalview.datamodel.BinaryNode");
70 Clazz.defineMethod (c$, "detach", 
71 function () {
72 if (this.$parent != null) {
73 if (this.$parent.$left === this) {
74 this.$parent.$left = null;
75 } else {
76 if (this.$parent.$right === this) {
77 this.$parent.$right = null;
78 }}}this.$parent = null;
79 return this;
80 });
81 Clazz.defineMethod (c$, "ascendLeft", 
82 function () {
83 var c = this;
84 do {
85 c = c.parent ();
86 } while ((c != null) && (c.left () != null) && !c.left ().isLeaf ());
87 return c;
88 });
89 Clazz.defineMethod (c$, "ascendRight", 
90 function () {
91 var c = this;
92 do {
93 c = c.parent ();
94 } while ((c != null) && (c.right () != null) && !c.right ().isLeaf ());
95 return c;
96 });
97 Clazz.defineMethod (c$, "setName", 
98 function (name) {
99 this.name = name;
100 }, "~S");
101 Clazz.defineMethod (c$, "getName", 
102 function () {
103 return this.name;
104 });
105 Clazz.defineMethod (c$, "setBootstrap", 
106 function (boot) {
107 this.bootstrap = boot;
108 }, "~N");
109 Clazz.defineMethod (c$, "getBootstrap", 
110 function () {
111 return this.bootstrap;
112 });