Ejemplo n.º 1
0
 protected void ValidatePOSDictionary(POSDictionary posDic, AbstractModel posModel)
 {
     if (!posModel.ContainsOutcomes(posDic))
     {
         throw new InvalidFormatException("Tag dictionary contains tags which are unknown by the model!");
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.</param>
 public bool Equals(POSDictionary other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(items, other.items));
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
        /// </returns>
        /// <param name="other">An object to compare with this object.</param>
        public bool Equals(POSDictionary other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            var keys = items.Keys;

            if (keys.Count != other.items.Keys.Count)
            {
                return(false);
            }

            var equal = true;

            foreach (var key in keys)
            {
                var a = items[key];
                if (!other.items.TryGetValue(key, out var b))
                {
                    equal = false;
                    break;
                }

                if (a.Equals(b))
                {
                    continue;
                }

                equal = false;
                break;
            }

            return(equal);
        }