/// <summary> /// 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. /// </summary> /// <param name="c">The constituent to check against</param> /// <returns>True if the other Constituent is contained in this one</returns> public bool Contains(Constituent c) { return(Start() <= c.Start() && End() >= c.End()); }
/// <summary> /// 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. /// </summary> /// <param name="c">The constituent to check against</param> /// <returns>True if the other Constituent is contained in this one</returns> public bool Contains(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 bool Crosses(Constituent c) { return((Start() < c.Start() && c.Start() < End() && End() < c.End()) || (c.Start() < Start() && Start() < c.End() && c.End() < 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 bool Crosses(Constituent c) { return (Start() < c.Start() && c.Start() < End() && End() < c.End()) || (c.Start() < Start() && Start() < c.End() && c.End() < End()); }