/// <summary> /// Adds a segment to the beginning of the segment part of the URL /// </summary> /// <remarks><scheme>://<host>:<port>/<path segment 1>/<path segment 2>?<query key 1>=<query value 1>&<query key 2>=<query value 2>#<fragment></remarks> /// <param name="segment">The segment to add</param> /// <returns>The UrlBuilder so you can chain/build</returns> public UrlBuilder AddPathSegmentToBeginning(string segment) { segment = segment.Replace("/", "").Trim(); if (!string.IsNullOrWhiteSpace(segment)) { Segments.Insert(0, segment); } return(this); }
public void InsertFirst(DcColumn col) // Insert a new segment at the beginning of the path { Debug.Assert(Size == 0 || col.Output == Input, "A path must continue the first segment inserted in the beginning."); Segments.Insert(0, col); Input = col.Input; if (Output == null) { Output = col.Output; } }
/// ------------------------------------------------------------------------------------ public BoundaryModificationResult InsertSegmentBoundary(float newBoundary, Func <AnnotationSegment, bool, bool, bool> allowDeletionOfOralAnnotations = null) { float newSegStart = 0f; var segBeingSplit = Segments.FirstOrDefault( seg => seg.TimeRange.Contains(TimeSpan.FromSeconds(newBoundary), true)); if (segBeingSplit == null) { if (Segments.GetLast() != null) { newSegStart = Segments.GetLast().End; } if (!GetIsAcceptableSegmentLength(newSegStart, newBoundary)) { return(BoundaryModificationResult.SegmentWillBeTooShort); } AddSegment(newSegStart, newBoundary); return(BoundaryModificationResult.Success); } if (!GetIsAcceptableSegmentLength(segBeingSplit.Start, newBoundary)) { return(BoundaryModificationResult.SegmentWillBeTooShort); } if (!GetIsAcceptableSegmentLength(newBoundary, segBeingSplit.End)) { return(BoundaryModificationResult.NextSegmentWillBeTooShort); } if (segBeingSplit.TimeRange.EndSeconds > newBoundary) { var hasCarefulSpeech = segBeingSplit.GetHasOralAnnotation(OralAnnotationType.CarefulSpeech); var hasOralTranslation = segBeingSplit.GetHasOralAnnotation(OralAnnotationType.Translation); if ((hasCarefulSpeech || hasOralTranslation) && (allowDeletionOfOralAnnotations == null || !allowDeletionOfOralAnnotations(segBeingSplit, hasCarefulSpeech, hasOralTranslation))) { return(BoundaryModificationResult.BlockedByOralAnnotations); } } float newSegEnd = segBeingSplit.End; segBeingSplit.End = newBoundary; var newSegment = new AnnotationSegment(segBeingSplit.Tier, newBoundary, newSegEnd); Segments.Insert(GetIndexOfSegment(segBeingSplit) + 1, newSegment); return(BoundaryModificationResult.Success); }
public void AddModuleImport(ImageModuleImport import) { Segments.Insert(Segments.Count - 1, import); }