Ejemplo n.º 1
0
        public void Remove(PQHandle handle)
        {
            Debug.Assert(_initialized);

            int hCurr = handle._handle;

            Debug.Assert(hCurr >= 1 && hCurr <= _max && _handles[hCurr]._key != null);

            int curr = _handles[hCurr]._node;

            _nodes[curr] = _nodes[_size];
            _handles[_nodes[curr]].SetNode(curr);

            if (curr <= --_size)
            {
                if (curr <= 1 || _leq(_handles[_nodes[curr >> 1]]._key, _handles[_nodes[curr]]._key))
                {
                    FloatDown(curr);
                }
                else
                {
                    FloatUp(curr);
                }
            }

            _handles[hCurr] = new HandleElem {
                _key = null, _node = _freeList
            };
            _freeList = hCurr;
        }
 public void Reset(IPool pool)
 {
     _prev     = _next = null;
     _anEdge   = null;
     _coords   = Vec3.Zero;
     _s        = 0;
     _t        = 0;
     _pqHandle = new PQHandle();
     _n        = 0;
     _data     = null;
 }
Ejemplo n.º 3
0
 public override void Reset()
 {
     _prev = _next = null;
     _anEdge = null;
     _coords = Vec3.Zero;
     _s = 0;
     _t = 0;
     _pqHandle = new PQHandle();
     _n = 0;
     _data = null;
 }
Ejemplo n.º 4
0
        public void Remove(PQHandle handle)
        {
            Debug.Assert(_initialized);

            int curr = handle._handle;
            if (curr >= 0)
            {
                _heap.Remove(handle);
                return;
            }
            curr = -(curr + 1);
            Debug.Assert(curr < _max && _keys[curr] != null);

            _keys[curr] = null;
            while (_size > 0 && _keys[_order[_size - 1]] == null)
            {
                --_size;
            }
        }