Exemple #1
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            var production = obj as Production;

            if (production == null)
            {
                return(false);
            }
            if (!LeftHandSide.Equals(production.LeftHandSide))
            {
                return(false);
            }
            var rightHandSideCount = RightHandSide.Count;

            if (rightHandSideCount != production.RightHandSide.Count)
            {
                return(false);
            }
            for (int i = 0; i < rightHandSideCount; i++)
            {
                if (!RightHandSide[i].Equals(production.RightHandSide[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #2
0
 /// <summary>
 ///     Returns whether the value(s) contained by the given other LRItem equals this object.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool Equals(LRItem <T> other)
 {
     if (LookaheadElement != null &&
         other.LookaheadElement != null)
     {
         return(LeftHandSide.Equals(other.LeftHandSide) && DotIndex == other.DotIndex && ProductionElements.SequenceEqual(other.ProductionElements) && LookaheadElement.Equals(other.LookaheadElement));
     }
     return(LeftHandSide.Equals(other.LeftHandSide) && DotIndex == other.DotIndex && ProductionElements.SequenceEqual(other.ProductionElements));
 }
Exemple #3
0
 protected override bool ThisEquals(Production other)
 {
     return(LeftHandSide.Equals(other.LeftHandSide) && this.rightHandSide.SequenceEqual(other.rightHandSide));
 }