Пример #1
0
 /// <summary>
 /// Creates a structurally equivalent ancestor path segment from a given segment.
 /// </summary>
 /// <param name="segment">The segment to copy the structure from.</param>
 /// <returns>A structurally equivalent copy of the given segment.</returns>
 public static IStonAncestorPathSegment Copy(IStonAncestorPathSegment segment)
 {
     if (segment == null)
     {
         throw new ArgumentNullException("segment");
     }
     return(new StonAncestorPathSegment(segment));
 }
Пример #2
0
 /// <summary>
 /// Checks the validity of a given STON ancestor path segment.
 /// </summary>
 /// <param name="segment">The path segment to check the validity of.</param>
 public static void ValidatePathSegment(IStonAncestorPathSegment segment)
 {
     if (segment == null)
     {
         throw new ArgumentNullException("segment");
     }
     if (segment.AncestorOrder <= 0)
     {
         throw new StonException("An ancestor path segment must have a positive ancestor order.");
     }
 }
Пример #3
0
 // writes an ancestor access path segment
 private void WritePathSegment(StonTokenWriter writer, IStonAncestorPathSegment segment)
 {
     writer.Write('.');
     writer.Write(new string('^', segment.AncestorOrder));
 }
Пример #4
0
 /// <summary>
 /// Creates a structurally equivalent ancestor path segment from a given segment.
 /// </summary>
 /// <param name="segment">The segment to copy the structure from.</param>
 public StonAncestorPathSegment(IStonAncestorPathSegment segment)
     : this(segment.AncestorOrder)
 {
 }