/// <summary> /// Parses the given <paramref name="text"/> into an <see cref="EdiPath"/>. /// </summary> /// <param name="text"></param> /// <returns></returns> public static EdiPath Parse(string text) { var match = Regex.Match(text, PARSE_PATTERN); if (match != null) { var segment = new EdiPathFragment(match.Groups[1].Value); var element = new EdiPathFragment(match.Groups[3].Value); var component = new EdiPathFragment(match.Groups[5].Value); return(new EdiPath(segment, element, component)); } else { return(new EdiPath()); } }
/// <summary> /// Constructs an <see cref="EdiPath"/>. /// </summary> /// <param name="segment">The <see cref="EdiContainerType.Segment"/> name</param> /// <param name="element">Zero based index of the <see cref="EdiContainerType.Element"/> location inside the <seealso cref="EdiContainerType.Segment"/></param> /// <param name="component">Zero based index of the <see cref="EdiContainerType.Component"/> location inside an <seealso cref="EdiContainerType.Element"/></param> public EdiPath(EdiPathFragment segment, EdiPathFragment element, EdiPathFragment component) { _SegmentPart = segment; _ElementPart = element; _ComponentPart = component; }
/// <summary> /// Constructs an <see cref="EdiPath"/> and the <paramref name="element"/>. The index of the component defaults to zero. /// </summary> /// <param name="segment">The <see cref="EdiContainerType.Segment"/> name</param> /// <param name="element">Zero based index of the <see cref="EdiContainerType.Element"/> location inside the <seealso cref="EdiContainerType.Segment"/></param> public EdiPath(EdiPathFragment segment, EdiPathFragment element) : this(segment, element, (EdiPathFragment)0) { }
/// <summary> /// constructs an <see cref="EdiPath"/> given the <paramref name="segment"/> name. Componet and Element idexes default to zero. /// </summary> /// <param name="segment">The <see cref="EdiContainerType.Segment"/> name</param> public EdiPath(EdiPathFragment segment) : this(segment, (EdiPathFragment)0, (EdiPathFragment)0) { }