GetNextValidSpan() 공개 메소드

Gets the next valid span or null if there's none left. This includes the input (position) if it happens to lie within this valid span. This method merges all consecutive valid spans.
public GetNextValidSpan ( HexPosition position, HexPosition upperBounds, bool fullSpan ) : HexSpan?
position HexPosition Start position to check
upperBounds HexPosition End position
fullSpan bool true if positions before should be included /// in the returned result. This could result in worse performance.
리턴 HexSpan?
예제 #1
0
		protected IEnumerable<HexSpan> GetValidSpans(HexBuffer buffer, HexPosition start, HexPosition upperBounds) {
			var pos = start;
			bool fullSpan = true;
			while (pos < HexPosition.MaxEndPosition) {
				var span = buffer.GetNextValidSpan(pos, upperBounds, fullSpan);
				if (span == null)
					break;

				var newStart = HexPosition.Max(pos, span.Value.Start);
				var newEnd = HexPosition.Min(upperBounds, span.Value.End);
				if (newStart < newEnd)
					yield return HexSpan.FromBounds(newStart, newEnd);

				pos = span.Value.End;
				fullSpan = false;
			}
		}