public virtual global::haxe.ds.TreeNode removeLoop(object k, global::haxe.ds.TreeNode node)
        {
                        #line 164 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
            if ((node == null))
            {
                                #line 165 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                throw global::haxe.lang.HaxeException.wrap("Not_found");
            }

                        #line 166 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
            int c = this.compare(k, node.key);
            if ((c == 0))
            {
                                #line 167 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                return(this.merge(node.left, node.right));
            }
            else if ((c < 0))
            {
                                #line 168 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                return(this.balance(this.removeLoop(k, node.left), node.key, node.@value, node.right));
            }
            else
            {
                                #line 169 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                return(this.balance(node.left, node.key, node.@value, this.removeLoop(k, node.right)));
            }
        }
Exemple #2
0
        public virtual bool exists(K key)
        {
                        #line 102 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            global::haxe.ds.TreeNode <K, V> node = this.root;
            while ((node != null))
            {
                                #line 104 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                int c = this.compare(key, node.key);
                if ((c == 0))
                {
                                        #line 106 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    return(true);
                }
                else if ((c < 0))
                {
                                        #line 108 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    node = node.left;
                }
                else
                {
                                        #line 110 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    node = node.right;
                }
            }

                        #line 112 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            return(false);
        }
        public virtual bool exists(object key)
        {
                        #line 102 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
            global::haxe.ds.TreeNode node = this.root;
            while ((node != null))
            {
                                #line 104 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                int c = this.compare(key, node.key);
                if ((c == 0))
                {
                                        #line 106 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    return(true);
                }
                else if ((c < 0))
                {
                                        #line 108 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    node = node.left;
                }
                else
                {
                                        #line 110 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    node = node.right;
                }
            }

                        #line 112 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
            return(false);
        }
        public override object __hx_setField(string field, int hash, object @value, bool handleProperties)
        {
            unchecked {
                                #line 244 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                switch (hash)
                {
                case 1891834246:
                {
                                                #line 244 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    this._height = ((int)(global::haxe.lang.Runtime.toInt(@value)));
                                                #line 244 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    return(@value);
                }


                case 834174833:
                {
                                                #line 244 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    this.@value = ((object)(@value));
                                                #line 244 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    return(@value);
                }


                case 5343647:
                {
                                                #line 244 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    this.key = ((object)(@value));
                                                #line 244 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    return(@value);
                }


                case 1768164316:
                {
                                                #line 244 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    this.right = ((global::haxe.ds.TreeNode)(@value));
                                                #line 244 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    return(@value);
                }


                case 1202718727:
                {
                                                #line 244 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    this.left = ((global::haxe.ds.TreeNode)(@value));
                                                #line 244 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    return(@value);
                }


                default:
                {
                                                #line 244 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    return(base.__hx_setField(field, hash, @value, handleProperties));
                }
                }
            }
                        #line default
        }
Exemple #5
0
        public virtual global::haxe.lang.Null <V> @get(K key)
        {
                        #line 62 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            global::haxe.ds.TreeNode <K, V> node = this.root;
            while ((node != null))
            {
                                #line 64 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                int c = this.compare(key, node.key);
                if ((c == 0))
                {
                                        #line 66 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    return(new global::haxe.lang.Null <V>(node.@value, true));
                }

                                #line 67 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                if ((c < 0))
                {
                                        #line 68 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    node = node.left;
                }
                else
                {
                                        #line 70 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    node = node.right;
                }
            }

                        #line 72 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            return(default(global::haxe.lang.Null <V>));
        }
 public virtual bool @remove(object key)
 {
                 #line 86 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
     try {
                         #line 87 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
         this.root = this.removeLoop(key, this.root);
         return(true);
     }
     catch (global::System.Exception catchallException) {
                         #line 86 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
         global::haxe.lang.Exceptions.exception = catchallException;
                         #line 90 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
         object realException = (((catchallException is global::haxe.lang.HaxeException)) ? (((global::haxe.lang.HaxeException)(catchallException)).obj) : ((object)(catchallException)));
                         #line 90 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
         if ((realException is string))
         {
                                 #line 90 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
             string e = global::haxe.lang.Runtime.toString(realException);
                                 #line 90 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
             return(false);
         }
         else
         {
                                 #line 90 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
             throw;
         }
     }
 }
        public virtual global::haxe.ds.TreeNode setLoop(object k, object v, global::haxe.ds.TreeNode node)
        {
                        #line 151 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
            if ((node == null))
            {
                                #line 152 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                return(new global::haxe.ds.TreeNode(null, k, v, null, null));
            }

                        #line 153 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
            int c = this.compare(k, node.key);
            if ((c == 0))
            {
                                #line 154 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                return(new global::haxe.ds.TreeNode(node.left, k, v, node.right, (((node == null)) ? (0) : (node._height))));
            }
            else if ((c < 0))
            {
                                #line 155 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                global::haxe.ds.TreeNode nl = this.setLoop(k, v, node.left);
                return(this.balance(nl, node.key, node.@value, node.right));
            }
            else
            {
                                #line 158 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                global::haxe.ds.TreeNode nr = this.setLoop(k, v, node.right);
                return(this.balance(node.left, node.key, node.@value, nr));
            }
        }
Exemple #8
0
        public virtual global::haxe.ds.TreeNode <K, V> removeLoop(K k, global::haxe.ds.TreeNode <K, V> node)
        {
                        #line 164 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            if ((node == null))
            {
                                #line 165 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                throw ((global::System.Exception)(global::haxe.Exception.thrown("Not_found")));
            }

                        #line 166 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            int c = this.compare(k, node.key);
            if ((c == 0))
            {
                                #line 167 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                return(this.merge(node.left, node.right));
            }
            else if ((c < 0))
            {
                                #line 168 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                return(this.balance(this.removeLoop(k, node.left), node.key, node.@value, node.right));
            }
            else
            {
                                #line 169 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                return(this.balance(node.left, node.key, node.@value, this.removeLoop(k, node.right)));
            }
        }
        public virtual object @get(object key)
        {
                        #line 62 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
            global::haxe.ds.TreeNode node = this.root;
            while ((node != null))
            {
                                #line 64 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                int c = this.compare(key, node.key);
                if ((c == 0))
                {
                                        #line 66 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    return(node.@value);
                }

                                #line 67 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                if ((c < 0))
                {
                                        #line 68 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    node = node.left;
                }
                else
                {
                                        #line 70 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    node = node.right;
                }
            }

                        #line 72 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
            return(null);
        }
Exemple #10
0
        public virtual object haxe_ds_TreeNode_cast <K_c, V_c>()
        {
                        #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            if ((global::haxe.lang.Runtime.eq(typeof(K), typeof(K_c)) && global::haxe.lang.Runtime.eq(typeof(V), typeof(V_c))))
            {
                                #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                return(this);
            }

                        #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            global::haxe.ds.TreeNode <K_c, V_c> new_me = new global::haxe.ds.TreeNode <K_c, V_c>(global::haxe.lang.EmptyObject.EMPTY);
                        #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            global::Array <string> fields = global::Reflect.fields(this);
                        #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            int i = 0;
                        #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            while ((i < fields.length))
            {
                                #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                string field = fields[i++];
                                #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                global::Reflect.setField(new_me, field, global::Reflect.field(this, field));
            }

                        #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            return(new_me);
        }
Exemple #11
0
        public override object __hx_setField(string field, int hash, object @value, bool handleProperties)
        {
            unchecked {
                                #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                switch (hash)
                {
                case 1891834246:
                {
                                                #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    this._height = ((int)(global::haxe.lang.Runtime.toInt(@value)));
                                                #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    return(@value);
                }


                case 834174833:
                {
                                                #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    this.@value = global::haxe.lang.Runtime.genericCast <V>(@value);
                                                #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    return(@value);
                }


                case 5343647:
                {
                                                #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    this.key = global::haxe.lang.Runtime.genericCast <K>(@value);
                                                #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    return(@value);
                }


                case 1768164316:
                {
                                                #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    this.right = ((global::haxe.ds.TreeNode <K, V>)(global::haxe.ds.TreeNode <object, object> .__hx_cast <K, V>(((global::haxe.ds.TreeNode)(@value)))));
                                                #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    return(@value);
                }


                case 1202718727:
                {
                                                #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    this.left = ((global::haxe.ds.TreeNode <K, V>)(global::haxe.ds.TreeNode <object, object> .__hx_cast <K, V>(((global::haxe.ds.TreeNode)(@value)))));
                                                #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    return(@value);
                }


                default:
                {
                                                #line 244 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    return(base.__hx_setField(field, hash, @value, handleProperties));
                }
                }
            }
                        #line default
        }
Exemple #12
0
        protected static void __hx_ctor_haxe_ds_TreeNode <K_c, V_c>(global::haxe.ds.TreeNode <K_c, V_c> __hx_this, global::haxe.ds.TreeNode <K_c, V_c> l, K_c k, V_c v, global::haxe.ds.TreeNode <K_c, V_c> r, global::haxe.lang.Null <int> h)
        {
            unchecked {
                int h1 = ((!(h.hasValue)) ? (-1) : ((h).@value));
                __hx_this.left   = l;
                __hx_this.key    = k;
                __hx_this.@value = v;
                __hx_this.right  = r;
                if ((h1 == -1))
                {
                    int tmp = default(int);
                    global::haxe.ds.TreeNode <K_c, V_c> _this  = __hx_this.left;
                    global::haxe.ds.TreeNode <K_c, V_c> _this1 = __hx_this.right;
                    if ((((((_this == null)) ? (0) : (_this._height))) > ((((_this1 == null)) ? (0) : (_this1._height)))))
                    {
                        global::haxe.ds.TreeNode <K_c, V_c> _this2 = __hx_this.left;
                        tmp = (((_this2 == null)) ? (0) : (_this2._height));
                    }
                    else
                    {
                        global::haxe.ds.TreeNode <K_c, V_c> _this3 = __hx_this.right;
                        tmp = (((_this3 == null)) ? (0) : (_this3._height));
                    }

                    __hx_this._height = (tmp + 1);
                }
                else
                {
                    __hx_this._height = h1;
                }
            }
        }
Exemple #13
0
        public virtual bool @remove(K key)
        {
                        #line 86 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            try {
                                #line 87 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                this.root = this.removeLoop(key, this.root);
                return(true);
            }
            catch (global::System.Exception _g) {
                {
                    global::haxe.NativeStackTrace.exception = ((global::System.Exception)(((object)(_g))));
                }

                                #line 86 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                if ((((object)(global::haxe.Exception.caught(_g).unwrap())) is string))
                {
                                        #line 90 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    return(false);
                }
                else
                {
                                        #line 86 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    throw _g;
                }
            }
        }
Exemple #14
0
        public virtual global::haxe.ds.TreeNode <K, V> setLoop(K k, V v, global::haxe.ds.TreeNode <K, V> node)
        {
                        #line 151 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            if ((node == null))
            {
                                #line 152 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                return(new global::haxe.ds.TreeNode <K, V>(null, k, v, null, default(global::haxe.lang.Null <int>)));
            }

                        #line 153 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            int c = this.compare(k, node.key);
            if ((c == 0))
            {
                                #line 154 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                return(new global::haxe.ds.TreeNode <K, V>(node.left, k, v, node.right, new global::haxe.lang.Null <int>((((node == null)) ? (0) : (node._height)), true)));
            }
            else if ((c < 0))
            {
                                #line 155 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                global::haxe.ds.TreeNode <K, V> nl = this.setLoop(k, v, node.left);
                return(this.balance(nl, node.key, node.@value, node.right));
            }
            else
            {
                                #line 158 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                global::haxe.ds.TreeNode <K, V> nr = this.setLoop(k, v, node.right);
                return(this.balance(node.left, node.key, node.@value, nr));
            }
        }
 public virtual void iteratorLoop(global::haxe.ds.TreeNode node, global::haxe.root.Array acc)
 {
                 #line 173 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
     if ((node != null))
     {
                         #line 174 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
         this.iteratorLoop(node.left, acc);
         acc.push(node.@value);
                         #line 176 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
         this.iteratorLoop(node.right, acc);
     }
 }
Exemple #16
0
 public virtual void keysLoop(global::haxe.ds.TreeNode <K, V> node, global::Array <K> acc)
 {
                 #line 181 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
     if ((node != null))
     {
                         #line 182 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
         this.keysLoop(node.left, acc);
         acc.push(node.key);
                         #line 184 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
         this.keysLoop(node.right, acc);
     }
 }
 public virtual void keysLoop(global::haxe.ds.TreeNode node, global::haxe.root.Array acc)
 {
                 #line 181 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
     if ((node != null))
     {
                         #line 182 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
         this.keysLoop(node.left, acc);
         acc.push(node.key);
                         #line 184 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
         this.keysLoop(node.right, acc);
     }
 }
Exemple #18
0
        public static void iteratorLoop <K1, V2>(global::haxe.ds.TreeNode <K1, V2> node, global::Array <V2> acc)
        {
                        #line 173 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            if ((node != null))
            {
                                #line 174 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                global::haxe.ds.BalancedTree <object, object> .iteratorLoop <K1, V2>(((global::haxe.ds.TreeNode <K1, V2>)(node.left)), ((global::Array <V2>)(acc)));

                acc.push(node.@value);
                                #line 176 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                global::haxe.ds.BalancedTree <object, object> .iteratorLoop <K1, V2>(((global::haxe.ds.TreeNode <K1, V2>)(node.right)), ((global::Array <V2>)(acc)));
            }
        }
Exemple #19
0
 public virtual global::haxe.ds.TreeNode <K, V> balance(global::haxe.ds.TreeNode <K, V> l, K k, V v, global::haxe.ds.TreeNode <K, V> r)
 {
     unchecked {
                         #line 206 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
         int hl = (((l == null)) ? (0) : (l._height));
         int hr = (((r == null)) ? (0) : (r._height));
                         #line 208 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
         if ((hl > (hr + 2)))
         {
                                 #line 209 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
             global::haxe.ds.TreeNode <K, V> _this = l.left;
                                 #line 209 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
             global::haxe.ds.TreeNode <K, V> _this1 = l.right;
                                 #line 209 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
             if ((((((_this == null)) ? (0) : (_this._height))) >= ((((_this1 == null)) ? (0) : (_this1._height)))))
             {
                                         #line 210 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                 return(new global::haxe.ds.TreeNode <K, V>(l.left, l.key, l.@value, new global::haxe.ds.TreeNode <K, V>(l.right, k, v, r, default(global::haxe.lang.Null <int>)), default(global::haxe.lang.Null <int>)));
             }
             else
             {
                                         #line 212 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                 return(new global::haxe.ds.TreeNode <K, V>(new global::haxe.ds.TreeNode <K, V>(l.left, l.key, l.@value, l.right.left, default(global::haxe.lang.Null <int>)), l.right.key, l.right.@value, new global::haxe.ds.TreeNode <K, V>(l.right.right, k, v, r, default(global::haxe.lang.Null <int>)), default(global::haxe.lang.Null <int>)));
             }
         }
         else if ((hr > (hl + 2)))
         {
                                 #line 215 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
             global::haxe.ds.TreeNode <K, V> _this2 = r.right;
                                 #line 215 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
             global::haxe.ds.TreeNode <K, V> _this3 = r.left;
                                 #line 215 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
             if ((((((_this2 == null)) ? (0) : (_this2._height))) > ((((_this3 == null)) ? (0) : (_this3._height)))))
             {
                                         #line 216 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                 return(new global::haxe.ds.TreeNode <K, V>(new global::haxe.ds.TreeNode <K, V>(l, k, v, r.left, default(global::haxe.lang.Null <int>)), r.key, r.@value, r.right, default(global::haxe.lang.Null <int>)));
             }
             else
             {
                                         #line 218 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                 return(new global::haxe.ds.TreeNode <K, V>(new global::haxe.ds.TreeNode <K, V>(l, k, v, r.left.left, default(global::haxe.lang.Null <int>)), r.left.key, r.left.@value, new global::haxe.ds.TreeNode <K, V>(r.left.right, r.key, r.@value, r.right, default(global::haxe.lang.Null <int>)), default(global::haxe.lang.Null <int>)));
             }
         }
         else
         {
                                 #line 221 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
             return(new global::haxe.ds.TreeNode <K, V>(l, k, v, r, new global::haxe.lang.Null <int>((((((hl > hr)) ? (hl) : (hr))) + 1), true)));
         }
     }
                 #line default
 }
 public virtual global::haxe.ds.TreeNode balance(global::haxe.ds.TreeNode l, object k, object v, global::haxe.ds.TreeNode r)
 {
     unchecked {
                         #line 206 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
         int hl = (((l == null)) ? (0) : (l._height));
         int hr = (((r == null)) ? (0) : (r._height));
                         #line 208 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
         if ((hl > (hr + 2)))
         {
                                 #line 209 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
             global::haxe.ds.TreeNode _this = l.left;
                                 #line 209 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
             global::haxe.ds.TreeNode _this1 = l.right;
                                 #line 209 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
             if ((((((_this == null)) ? (0) : (_this._height))) >= ((((_this1 == null)) ? (0) : (_this1._height)))))
             {
                                         #line 210 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                 return(new global::haxe.ds.TreeNode(l.left, l.key, l.@value, new global::haxe.ds.TreeNode(l.right, k, v, r, null), null));
             }
             else
             {
                                         #line 212 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                 return(new global::haxe.ds.TreeNode(new global::haxe.ds.TreeNode(l.left, l.key, l.@value, l.right.left, null), l.right.key, l.right.@value, new global::haxe.ds.TreeNode(l.right.right, k, v, r, null), null));
             }
         }
         else if ((hr > (hl + 2)))
         {
                                 #line 215 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
             global::haxe.ds.TreeNode _this2 = r.right;
                                 #line 215 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
             global::haxe.ds.TreeNode _this3 = r.left;
                                 #line 215 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
             if ((((((_this2 == null)) ? (0) : (_this2._height))) > ((((_this3 == null)) ? (0) : (_this3._height)))))
             {
                                         #line 216 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                 return(new global::haxe.ds.TreeNode(new global::haxe.ds.TreeNode(l, k, v, r.left, null), r.key, r.@value, r.right, null));
             }
             else
             {
                                         #line 218 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                 return(new global::haxe.ds.TreeNode(new global::haxe.ds.TreeNode(l, k, v, r.left.left, null), r.left.key, r.left.@value, new global::haxe.ds.TreeNode(r.left.right, r.key, r.@value, r.right, null), null));
             }
         }
         else
         {
                                 #line 221 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
             return(new global::haxe.ds.TreeNode(l, k, v, r, (((((hl > hr)) ? (hl) : (hr))) + 1)));
         }
     }
                 #line default
 }
 public virtual global::haxe.ds.TreeNode removeMinBinding(global::haxe.ds.TreeNode t)
 {
                 #line 202 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
     if ((t.left == null))
     {
                         #line 202 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
         return(t.right);
     }
     else
     {
                         #line 202 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
         return(this.balance(this.removeMinBinding(t.left), t.key, t.@value, t.right));
     }
 }
Exemple #22
0
 public virtual global::haxe.ds.TreeNode <K, V> removeMinBinding(global::haxe.ds.TreeNode <K, V> t)
 {
                 #line 202 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
     if ((t.left == null))
     {
                         #line 202 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
         return(t.right);
     }
     else
     {
                         #line 202 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
         return(this.balance(this.removeMinBinding(t.left), t.key, t.@value, t.right));
     }
 }
Exemple #23
0
        protected static void __hx_ctor_haxe_ds_TreeNode <K_c, V_c>(global::haxe.ds.TreeNode <K_c, V_c> __hx_this, global::haxe.ds.TreeNode <K_c, V_c> l, K_c k, V_c v, global::haxe.ds.TreeNode <K_c, V_c> r, global::haxe.lang.Null <int> h)
        {
            unchecked {
                                #line 252 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                int h1 = ((!(h.hasValue)) ? (-1) : ((h).@value));
                __hx_this.left = l;
                                #line 254 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                __hx_this.key    = k;
                __hx_this.@value = v;
                                #line 256 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                __hx_this.right = r;
                if ((h1 == -1))
                {
                                        #line 258 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    int tmp = default(int);
                                        #line 258 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    global::haxe.ds.TreeNode <K_c, V_c> _this = __hx_this.left;
                                        #line 258 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    global::haxe.ds.TreeNode <K_c, V_c> _this1 = __hx_this.right;
                                        #line 258 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    if ((((((_this == null)) ? (0) : (_this._height))) > ((((_this1 == null)) ? (0) : (_this1._height)))))
                    {
                                                #line 258 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                        global::haxe.ds.TreeNode <K_c, V_c> _this2 = __hx_this.left;
                                                #line 258 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                        tmp = (((_this2 == null)) ? (0) : (_this2._height));
                    }
                    else
                    {
                                                #line 258 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                        global::haxe.ds.TreeNode <K_c, V_c> _this3 = __hx_this.right;
                                                #line 258 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                        tmp = (((_this3 == null)) ? (0) : (_this3._height));
                    }

                                        #line 258 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    __hx_this._height = (tmp + 1);
                }
                else
                {
                                        #line 260 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                    __hx_this._height = h1;
                }
            }
                        #line default
        }
        protected static void __hx_ctor_haxe_ds_TreeNode(global::haxe.ds.TreeNode __hx_this, global::haxe.ds.TreeNode l, object k, object v, global::haxe.ds.TreeNode r, object h)
        {
            unchecked {
                                #line 255 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                int h1 = (((h == default(object))) ? (-1) : (((int)(global::haxe.lang.Runtime.toInt(h)))));
                __hx_this.left = l;
                                #line 257 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                __hx_this.key    = k;
                __hx_this.@value = v;
                                #line 259 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                __hx_this.right = r;
                if ((h1 == -1))
                {
                                        #line 261 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    int tmp = default(int);
                                        #line 261 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    global::haxe.ds.TreeNode _this = __hx_this.left;
                                        #line 261 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    global::haxe.ds.TreeNode _this1 = __hx_this.right;
                                        #line 261 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    if ((((((_this == null)) ? (0) : (_this._height))) > ((((_this1 == null)) ? (0) : (_this1._height)))))
                    {
                                                #line 261 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                        global::haxe.ds.TreeNode _this2 = __hx_this.left;
                                                #line 261 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                        tmp = (((_this2 == null)) ? (0) : (_this2._height));
                    }
                    else
                    {
                                                #line 261 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                        global::haxe.ds.TreeNode _this3 = __hx_this.right;
                                                #line 261 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                        tmp = (((_this3 == null)) ? (0) : (_this3._height));
                    }

                                        #line 261 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    __hx_this._height = (tmp + 1);
                }
                else
                {
                                        #line 263 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                    __hx_this._height = h1;
                }
            }
                        #line default
        }
Exemple #25
0
        public virtual object haxe_ds_TreeNode_cast <K_c, V_c>()
        {
            if ((global::haxe.lang.Runtime.eq(typeof(K), typeof(K_c)) && global::haxe.lang.Runtime.eq(typeof(V), typeof(V_c))))
            {
                return(this);
            }

            global::haxe.ds.TreeNode <K_c, V_c> new_me = new global::haxe.ds.TreeNode <K_c, V_c>(global::haxe.lang.EmptyObject.EMPTY);
            global::Array <string> fields = global::Reflect.fields(this);
            int i = 0;

            while ((i < fields.length))
            {
                string field = fields[i++];
                global::Reflect.setField(new_me, field, global::Reflect.field(this, field));
            }

            return(new_me);
        }
Exemple #26
0
        public override object __hx_setField(string field, int hash, object @value, bool handleProperties)
        {
            unchecked {
                switch (hash)
                {
                case 1269755426:
                {
                    this.root = ((global::haxe.ds.TreeNode <K, V>)(global::haxe.ds.TreeNode <object, object> .__hx_cast <K, V>(((global::haxe.ds.TreeNode)(@value)))));
                    return(@value);
                }


                default:
                {
                    return(base.__hx_setField(field, hash, @value, handleProperties));
                }
                }
            }
        }
 public virtual global::haxe.ds.TreeNode minBinding(global::haxe.ds.TreeNode t)
 {
                 #line 198 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
     if ((t == null))
     {
                         #line 198 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
         throw global::haxe.lang.HaxeException.wrap("Not_found");
     }
     else if ((t.left == null))
     {
                         #line 198 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
         return(t);
     }
     else
     {
                         #line 198 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
         return(this.minBinding(t.left));
     }
 }
Exemple #28
0
 public virtual global::haxe.ds.TreeNode <K, V> minBinding(global::haxe.ds.TreeNode <K, V> t)
 {
                 #line 198 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
     if ((t == null))
     {
                         #line 198 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
         throw ((global::System.Exception)(global::haxe.Exception.thrown("Not_found")));
     }
     else if ((t.left == null))
     {
                         #line 198 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
         return(t);
     }
     else
     {
                         #line 198 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
         return(this.minBinding(t.left));
     }
 }
        public virtual global::haxe.ds.TreeNode merge(global::haxe.ds.TreeNode t1, global::haxe.ds.TreeNode t2)
        {
                        #line 189 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
            if ((t1 == null))
            {
                                #line 190 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                return(t2);
            }

                        #line 191 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
            if ((t2 == null))
            {
                                #line 192 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
                return(t1);
            }

                        #line 193 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\BalancedTree.hx"
            global::haxe.ds.TreeNode t = this.minBinding(t2);
            return(this.balance(t1, t.key, t.@value, this.removeMinBinding(t2)));
        }
Exemple #30
0
        public virtual global::haxe.ds.TreeNode <K, V> merge(global::haxe.ds.TreeNode <K, V> t1, global::haxe.ds.TreeNode <K, V> t2)
        {
                        #line 189 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            if ((t1 == null))
            {
                                #line 190 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                return(t2);
            }

                        #line 191 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            if ((t2 == null))
            {
                                #line 192 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
                return(t1);
            }

                        #line 193 "/opt/haxe/std/haxe/ds/BalancedTree.hx"
            global::haxe.ds.TreeNode <K, V> t = this.minBinding(t2);
            return(this.balance(t1, t.key, t.@value, this.removeMinBinding(t2)));
        }