// Summary:
        //     Compares the current object with another object of the same type.
        //
        // Parameters:
        //   other:
        //     An object to compare with this object.
        //
        // Returns:
        //     A value that indicates the relative order of the objects being compared.
        //     The return value has the following meanings: Value Meaning Less than zero
        //     This object is less than the other parameter.Zero This object is equal to
        //     other. Greater than zero This object is greater than other.
        public int CompareTo(ReturnValueElement other)
        {
            int retVal = 1;

            if (other != null)
            {
                if (Value == other.Value && AsType == other.AsType)
                {
                    // This seem to be the same return value
                    retVal = 0;

                    // Ensure that previous elements match.
                    if (PreviousElement != null)
                    {
                        retVal = PreviousElement.CompareTo(other.PreviousElement);
                    }
                    else
                    {
                        if (other.PreviousElement != null)
                        {
                            retVal = -1;
                        }
                    }
                }
            }

            return(retVal);
        }
Esempio n. 2
0
 public IEnumerable <StackElement <SYMBOL_ENUM, TREE_NODE> > Iterate()
 {
     if (PreviousElement == null)
     {
         return new StackElement <SYMBOL_ENUM, TREE_NODE>[] { this }
     }
     ;
     else
     {
         return(PreviousElement.Iterate().Concat(this));
     }
 }