public virtual void TestEquals()
        {
            TreeShapedStack <string> t1 = new TreeShapedStack <string>();

            t1 = t1.Push("foo");
            t1 = t1.Push("bar");
            t1 = t1.Push("bar");
            t1 = t1.Push("diet");
            t1 = t1.Push("coke");
            TreeShapedStack <string> t2 = new TreeShapedStack <string>();

            t2 = t2.Push("foo");
            t2 = t2.Push("bar");
            t2 = t2.Push("bar");
            t2 = t2.Push("diet");
            t2 = t2.Push("coke");
            TreeShapedStack <string> t3 = t2.Pop().Push("pepsi");

            NUnit.Framework.Assert.AreEqual(t1, t2);
            NUnit.Framework.Assert.IsFalse(t1.Pop().Equals(t2));
            NUnit.Framework.Assert.IsFalse(t2.Pop().Equals(t1));
            NUnit.Framework.Assert.IsFalse(t2.Equals(t3));
        }
示例#2
0
 /// <summary>
 /// Whether or not the transitions that built the two states are
 /// equal.
 /// </summary>
 /// <remarks>
 /// Whether or not the transitions that built the two states are
 /// equal.  Doesn't check anything else.  Useful for training using
 /// an agenda, for example, when you know the underlying information
 /// such as the words are the same and all you care about checking is
 /// the transition sequence
 /// </remarks>
 public virtual bool AreTransitionsEqual(Edu.Stanford.Nlp.Parser.Shiftreduce.State other)
 {
     return(transitions.Equals(other.transitions));
 }