예제 #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(Keys.Aggregate(0, (current, key) => (current * 333) ^ (key != null ? key.GetHashCode() : 0)));
     }
 }
예제 #2
0
 public override string ToString()
 {
     if (Keys.Length > 0)
     {
         return(Keys.Aggregate("Keys :", (current, next) => current + " " + next));
     }
     return("ClientData");
 }
예제 #3
0
        private void CacheState()
        {
            cachedHashCode = HashCodeUtils.Seed;
            cachedHashCode = HashCodeUtils.Hash(cachedHashCode, TypeName);
            cachedHashCode = HashCodeUtils.Hash(cachedHashCode, Keys);

            var keys = Keys.Aggregate((s, t) => $"{s}:{t}");

            cachedToString = $"{(IsTransient ? "T" : "")}VMOID#{keys}{(previous == null ? "" : "+")}";
        }
예제 #4
0
        private void CacheState()
        {
            cachedHashCode = HashCodeUtils.Seed;
            cachedHashCode = HashCodeUtils.Hash(cachedHashCode, TypeName);
            cachedHashCode = HashCodeUtils.Hash(cachedHashCode, Keys);

            object keys = Keys.Aggregate((s, t) => s + ":" + t);

            cachedToString = string.Format("{0}VMOID#{1}{2}", IsTransient ? "T" : "", keys, previous == null ? "" : "+");
        }
예제 #5
0
        protected Dictionary <K2, V> GetByKeyOrClosest(K1 key1)
        {
            if (ContainsKey(key1))
            {
                return(this[key1]);
            }
            else if (K1Comparer == null)
            {
                throw new KeyNotFoundException("Key not found and comparer not set [k1]");
            }
            var closest = Keys.Aggregate((x, y) => K1Comparer(x, y, key1));

            return(this[closest]);
        }
예제 #6
0
        public override string ToString()
        {
            var keys = Keys.Length == 0 ? string.Empty : Keys.Aggregate((a, b) => a + "," + b);

            return($"{Left.ToString()} union all ({keys}) {Right.ToString()}");
        }
예제 #7
0
파일: Properties.cs 프로젝트: valmac/nesper
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 /// <returns>
 /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
 /// </returns>
 public override int GetHashCode()
 {
     return(Keys.Aggregate(0, (current, key) => current * 397 + key.GetHashCode()));
 }
 ///
 ///<summary>The toString method loops through the mappings contained in this map and returns the string of each
 /// entry's key and value.</summary>
 ///
 ///<returns>String of the each entry's key and value.</returns>
 ///
 public override string ToString()
 {
     return(Keys.Aggregate("", (current, entry) => current + (entry.ToString() + " " + this[entry] + "\n")));
 }
예제 #9
0
 public int GetMeasurementNumber(Measurement measurement)
 {
     return(Keys.Aggregate(1, (current, elem) => current + ((elem < measurement.EntityId) ? 1 : 0)));
 }