Exemplo n.º 1
0
 /// <summary>
 /// Indicates whether the CFG is exactly equivelant to the specified CFG
 /// </summary>
 /// <param name="rhs">The CFG to compare</param>
 /// <returns>True if the CFGs are equal, otherwise false.</returns>
 public bool Equals(Cfg rhs)
 {
     if (!CollectionUtility.Equals(this.Rules, rhs.Rules))
     {
         return(false);
     }
     if (AttributeSets.Count != rhs.AttributeSets.Count)
     {
         return(false);
     }
     foreach (var attrs in AttributeSets)
     {
         AttributeSet d;
         if (!rhs.AttributeSets.TryGetValue(attrs.Key, out d))
         {
             if (d.Count != attrs.Value.Count)
             {
                 return(false);
             }
             foreach (var attr in attrs.Value)
             {
                 object o;
                 if (!d.TryGetValue(attr.Key, out o) || !Equals(o, attr.Value))
                 {
                     return(false);
                 }
             }
         }
     }
     return(true);
 }
Exemplo n.º 2
0
Arquivo: FA.cs Projeto: sndjones002/LL
 public bool Equals(IDictionary <FA <TInput, TAccept>, ICollection <TInput> > lhs, IDictionary <FA <TInput, TAccept>, ICollection <TInput> > rhs)
 {
     if (lhs.Count != rhs.Count)
     {
         return(false);
     }
     if (ReferenceEquals(lhs, rhs))
     {
         return(true);
     }
     else if (ReferenceEquals(null, lhs) || ReferenceEquals(null, rhs))
     {
         return(false);
     }
     using (var xe = lhs.GetEnumerator())
         using (var ye = rhs.GetEnumerator())
             while (xe.MoveNext() && ye.MoveNext())
             {
                 if (xe.Current.Key != ye.Current.Key)
                 {
                     return(false);
                 }
                 if (!CollectionUtility.Equals(xe.Current.Value, ye.Current.Value))
                 {
                     return(false);
                 }
             }
     return(true);
 }