Example #1
0
 public override bool Equals(object other)
 {
     if (other is Raster4DInteger)
     {
         Raster4DInteger other_typed = (Raster4DInteger)other;
         return(ToolsCollection.EqualsArray(SizeArray, other_typed.SizeArray));
     }
     return(false);
 }
Example #2
0
        public bool ContainsKey(KeyElement[] key)
        {
            int hash_code = GetHashCode(key);

            if (hash_code_to_key_value_list.ContainsKey(hash_code))
            {
                foreach (Tuple <KeyElement[], ValueType> tuple in hash_code_to_key_value_list[hash_code])
                {
                    if (ToolsCollection.EqualsArray(key, tuple.Item1))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Example #3
0
        public ValueType this[KeyElement[] key]
        {
            get
            {
                int hash_code = GetHashCode(key);
                foreach (Tuple <KeyElement[], ValueType> tuple in hash_code_to_key_value_list[hash_code])
                {
                    if (ToolsCollection.EqualsArray(key, tuple.Item1))
                    {
                        return(tuple.Item2);
                    }
                }
                throw new Exception("No such key");
            }

            set
            {
                Add(key, value);
            }
        }
Example #4
0
        public void Add(KeyElement[] key, ValueType value)
        {
            int hash_code = GetHashCode(key);

            if (hash_code_to_key_value_list.ContainsKey(hash_code))
            {
                foreach (Tuple <KeyElement[], ValueType> tuple in hash_code_to_key_value_list[hash_code])
                {
                    if (ToolsCollection.EqualsArray(key, tuple.Item1))
                    {
                        throw new Exception("Value already present");
                    }
                }
            }
            else
            {
                hash_code_to_key_value_list[hash_code] = new List <Tuple <KeyElement[], ValueType> >();
            }
            hash_code_to_key_value_list[hash_code].Add(new Tuple <KeyElement[], ValueType>(key, value));
            Count++;
        }