Ejemplo n.º 1
0
            /// <summary>
            /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
            /// </summary>
            /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>.</param>
            /// <returns>
            /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
            /// </returns>
            /// <exception cref="T:System.NullReferenceException">
            /// The <paramref name="obj"/> parameter is null.
            /// </exception>
            public override bool Equals(object obj)
            {
                GroupingId other = obj as GroupingId;

                if (other == null)
                {
                    return(false);
                }
                if (_values.Count != other._values.Count)
                {
                    return(false);
                }
                foreach (Dimension d in _values.Keys)
                {
                    ValueFactoryWithOptionalConcreteValue thisValue = _values[d], otherValue;
                    Debug.Assert(thisValue != null);
                    if (!other._values.TryGetValue(d, out otherValue))
                    {
                        return(false);
                    }
                    if (!thisValue.ValueFactory.Equals(otherValue.ValueFactory))
                    {
                        return(false);
                    }
                }
                return(true);
            }
Ejemplo n.º 2
0
        /// <summary>
        /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>.</param>
        /// <returns>
        /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
        /// </returns>
        /// <exception cref="T:System.NullReferenceException">
        /// The <paramref name="obj"/> parameter is null.
        /// </exception>
        public override bool Equals(object obj)
        {
            ValueFactoryWithOptionalConcreteValue asMyType = obj as ValueFactoryWithOptionalConcreteValue;

            return(asMyType != null &&
                   _valueFactory.Equals(asMyType._valueFactory) &&
                   _isConcrete == asMyType._isConcrete &&
                   (_isConcrete ? EqualsImplementationUtils.SafeEquals(_value, asMyType._value) : true));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// (Internal use/required for VectorInfo) Sets the value for the given dimension.
 /// </summary>
 /// <param name="dimension">The dimension.</param>
 /// <param name="value">The value.</param>
 /// <exception cref="ArgumentNullException"><paramref name="dimension"/> is null</exception>
 internal void SetBaseValue(QualifiedDimension dimension, ValueFactoryWithOptionalConcreteValue value)
 {
     if (dimension.Path.Any())
     {
         Vector innerVector;
         ValueFactoryWithOptionalConcreteValue valueFactory;
         if (_dimensionValues.TryGetValue(dimension.Path[0], out valueFactory))
         {
             innerVector = (Vector)valueFactory.MakeConcrete().GetConcreteValue();
         }
         else
         {
             innerVector = new Vector();
             SetBaseValue(dimension.Path[0], innerVector);
         }
         innerVector.SetBaseValue(QualifiedDimension.Create(dimension.BaseDimension, dimension.Path.Skip(1)), value);
     }
     else
     {
         _dimensionValues[dimension.BaseDimension] = value;
     }
 }