Example #1
0
        private static int hashCode <H>(ArraySlice_t <H> data)
        {
            //TODO: This breaks on a 0mer.  Must make those illegal.

            int hash = data[0].GetHashCode();
            int s    = data.StartIndex + 1;
            int e    = data.StartIndex + data.Count;

            for (int i = s; i < e; i++)
            {
                //Console.WriteLine ("s: " + s + ", i: " + i + ", e: " + e);
                hash = ((int)RotateLeft((int)hash, 1)) ^ data.Array[i].GetHashCode();
            }

            return(hash);

            //return (int)this.Aggregate((int)0, (sum, val) => RotateLeft(sum, 1) ^ (int)val.GetHashCode () );
        }
Example #2
0
        //CONSTRUCTOR:

        public Kmer(ArraySlice_t <A> data)
        {
            this.data = data;
            hash      = hashCode(data);
        }