Ejemplo n.º 1
0
        /**
         * <summary>Returns a list of keys stored at this node that exist between the
         * two addresses.  Such keys returned are the storest path between the two
         * addresses.</summary>
         * <param name="add1">One of the address end points.</param>
         * <param name="add2">Another of the address end points.</param>
         * <returns>A LinkedList of key entries between add1 and add2</returns>
         */
        public LinkedList <MemBlock> GetKeysBetween(AHAddress add1, AHAddress add2)
        {
            LinkedList <MemBlock> keys = new LinkedList <MemBlock>();

            if (add1.IsRightOf(add2))
            {
                foreach (MemBlock key in list_of_keys)
                {
                    AHAddress key_addr = new AHAddress(key);
                    if (key_addr.IsBetweenFromLeft(add1, add2))
                    {
                        keys.AddLast(key);
                    }
                }
            }
            else
            {
                foreach (MemBlock key in list_of_keys)
                {
                    AHAddress key_addr = new AHAddress(key);
                    if (key_addr.IsBetweenFromRight(add1, add2))
                    {
                        keys.AddLast(key);
                    }
                }
            }
            return(keys);
        }
Ejemplo n.º 2
0
 /**
 <summary>Returns a list of keys stored at this node that exist between the
 two addresses.  Such keys returned are the storest path between the two
 addresses.</summary>
 <param name="add1">One of the address end points.</param>
 <param name="add2">Another of the address end points.</param>
 <returns>A LinkedList of key entries between add1 and add2</returns>
 */
 public LinkedList<MemBlock> GetKeysBetween(AHAddress add1, AHAddress add2) {
   LinkedList<MemBlock> keys = new LinkedList<MemBlock>();
   if(add1.IsRightOf(add2)) {
     foreach(MemBlock key in list_of_keys) {
       AHAddress key_addr = new AHAddress(key);
       if(key_addr.IsBetweenFromLeft(add1, add2)) {
         keys.AddLast(key);
       }
     }
   }
   else {
     foreach(MemBlock key in list_of_keys) {
       AHAddress key_addr = new AHAddress(key);
       if(key_addr.IsBetweenFromRight(add1, add2)) {
         keys.AddLast(key);
       }
     }
   }
   return keys;
 }