Beispiel #1
0
    public bool Attach(ViPriorityNode <T> node)
    {
        ViPriorityNode <T> oldTop = TopNode;

        Detach(node);
        _Attach(node);
        return(!(Object.ReferenceEquals(oldTop, node)));
    }
Beispiel #2
0
 bool _Attach(ViPriorityNode <T> node)
 {
     int where = 0;
     for (; where < _nodes.Count; ++where)
     {
         if (node.Weight >= _nodes[where].Weight)
         {
             break;
         }
     }
     _nodes.Insert(where, node);
     return(where == 0);
 }
Beispiel #3
0
 public bool Detach(ViPriorityNode <T> node)
 {
     int where = 0;
     for (; where < _nodes.Count; ++where)
     {
         if (Object.ReferenceEquals(node, _nodes[where]))
         {
             _nodes.RemoveAt(where);
             return(where == 0);
         }
     }
     return(false);
 }