示例#1
0
        /// <summary>
        ///  Find key (long)
        /// </summary>
        /// <param name="key"></param>
        /// <param name="op">0 - equal; -1 - nearest left (less than); 1 - nearest right (more than) </param>
        /// <returns>Value</returns>
        public BTResult Find(long key, int op)
        {
            int      i   = find(VSLib.ConvertLongToByteReverse(key), op);
            BTResult ret = new BTResult();

            ret.Key   = (i < 0) ? -1 : VSLib.ConvertByteToLongReverse(BTree[i].Key);
            ret.Value = (i < 0) ? -1 : BTree[i].Value[0];

            return(ret);
        }
示例#2
0
        /// <summary>
        ///  Find all keys (non-unique), long
        /// </summary>
        /// <param name="key"></param>
        /// <param name="op">0 - equal; -1 - nearest left (less than); 1 - nearest right (more than) </param>
        /// <returns></returns>
        public BTResultList FindAll(long key, int op)
        {
            int i = find(VSLib.ConvertLongToByteReverse(key), op);

            BTResultList ret = new BTResultList();

            ret.Key   = (i < 0) ? -1 : VSLib.ConvertByteToLongReverse(BTree[i].Key);
            ret.Value = (i < 0) ? new long[0] : BTree[i].Value.ToArray();

            return(ret);
        }