/// <summary>Check whether two Spans in the same document are ordered.</summary>
		/// <param name="spans1">
		/// </param>
		/// <param name="spans2">
		/// </param>
		/// <returns> true iff spans1 starts before spans2
		/// or the spans start at the same position,
		/// and spans1 ends before spans2.
		/// </returns>
		internal static bool DocSpansOrdered(Spans spans1, Spans spans2)
		{
			System.Diagnostics.Debug.Assert(spans1.Doc() == spans2.Doc(), "doc1 " + spans1.Doc() + " != doc2 " + spans2.Doc());
			int start1 = spans1.Start();
			int start2 = spans2.Start();
			/* Do not call docSpansOrdered(int,int,int,int) to avoid invoking .end() : */
			return (start1 == start2)?(spans1.End() < spans2.End()):(start1 < start2);
		}