/// <summary>Compare with another Object for equality.</summary>
 /// <remarks>
 /// Compare with another Object for equality.
 /// Two Constituent objects are equal if they have the same start and end,
 /// and, if at least one of them has a non-null label, then their labels are equal.
 /// The score of a Constituent is not considered in the equality test.
 /// This seems to make sense for most of the applications we have in mind
 /// where one wants to assess equality independent of score, and then if
 /// necessary to relax a constituent if one with a better score is found.
 /// (Note, however, that if you do want to compare Constituent scores for
 /// equality, then you have to be careful,
 /// because two <code>double</code> NaN values are considered unequal in
 /// Java.)
 /// The general contract of equals() implies that one can't have a
 /// subclass of a concrete [non-abstract] class redefine equals() to use
 /// extra aspects, so subclasses shouldn't override this in ways that
 /// make use of extra fields.
 /// </remarks>
 /// <param name="obj">The object being compared with</param>
 /// <returns>true if the objects are equal</returns>
 public override bool Equals(object obj)
 {
     // unclear if this will be a speedup in general
     // if (this == o)
     //      return true;
     if (obj is Edu.Stanford.Nlp.Trees.Constituent)
     {
         Edu.Stanford.Nlp.Trees.Constituent c = (Edu.Stanford.Nlp.Trees.Constituent)obj;
         // System.out.println("Comparing " + this + " to " + c + "\n  " +
         //	"start: " + (start() == c.start()) + " end: " +
         //	(end() == c.end()) + " score: " + (score() == c.score()));
         if ((Start() == c.Start()) && (End() == c.End()))
         {
             ILabel lab1 = Label();
             ILabel lab2 = c.Label();
             if (lab1 == null)
             {
                 return(lab2 == null);
             }
             string lv1 = lab1.Value();
             string lv2 = lab2.Value();
             if (lv1 == null && lv2 == null)
             {
                 return(true);
             }
             if (lv1 != null && lv2 != null)
             {
                 return(lab1.Value().Equals(lab2.Value()));
             }
         }
     }
     return(false);
 }
 /// <summary>
 /// Detects whether this constituent contains a constituent, that is
 /// whether they are nested.
 /// </summary>
 /// <remarks>
 /// Detects whether this constituent contains a constituent, that is
 /// whether they are nested.  That is, the other constituent's yield is
 /// a sublist of this constituent's yield.
 /// </remarks>
 /// <param name="c">The constituent to check against</param>
 /// <returns>True if the other Constituent is contained in this one</returns>
 public virtual bool Contains(Edu.Stanford.Nlp.Trees.Constituent c)
 {
     return(Start() <= c.Start() && End() >= c.End());
 }
 /// <summary>
 /// Detects whether this constituent overlaps a constituent without
 /// nesting, that is, whether they "cross".
 /// </summary>
 /// <param name="c">The constituent to check against</param>
 /// <returns>True if the two constituents cross</returns>
 public virtual bool Crosses(Edu.Stanford.Nlp.Trees.Constituent c)
 {
     return((Start() < c.Start() && c.Start() < End() && End() < c.End()) || (c.Start() < Start() && Start() < c.End() && c.End() < End()));
 }