예제 #1
0
 /// <summary>
 ///     Returns the args from the read head to the end
 /// </summary>
 /// <param name="info">The information.</param>
 /// <returns>IEnumerable&lt;System.String&gt;.</returns>
 public static IEnumerable <string> Rest(this IterationInfo info) => info.Args.Skip(info.Index + 1);
예제 #2
0
 /// <summary>
 ///     Determines whether this parameter can consume the specified instance.
 /// </summary>
 /// <param name="instance">The instance.</param>
 /// <param name="info">The information.</param>
 /// <returns>The result of the consumption</returns>
 public abstract ConsumptionResult CanConsume(object instance, IterationInfo info);
예제 #3
0
 /// <summary>
 ///     Returns the next arg after the read head
 /// </summary>
 /// <param name="info">The information.</param>
 /// <returns>System.String.</returns>
 public static string Next(this IterationInfo info) => info.Args[info.Index + 1];
예제 #4
0
 /// <summary>
 ///     Determines whether the specified information has reached the end
 /// </summary>
 /// <param name="info">The information.</param>
 /// <returns><c>true</c> if the specified information is complete; otherwise, <c>false</c>.</returns>
 public static bool IsComplete(this IterationInfo info) => info.Index >= info.Args.Length;
예제 #5
0
 /// <summary>
 ///     Determines whether there is another argument after the read head
 /// </summary>
 /// <param name="info">The information.</param>
 /// <returns><c>true</c> if the specified information has next; otherwise, <c>false</c>.</returns>
 public static bool HasNext(this IterationInfo info) => info.Index + 1 < info.Args.Length;
예제 #6
0
 /// <summary>
 ///     Returns the arguments at the readhead and beyond
 /// </summary>
 /// <param name="info">The information.</param>
 /// <returns>IEnumerable&lt;System.String&gt;.</returns>
 public static IEnumerable <string> FromNowOn(this IterationInfo info) => info.Args.Skip(info.Index);
예제 #7
0
 /// <summary>
 ///     Determines whether this instance can consume the args and populate the provided instance
 /// </summary>
 /// <param name="instance">The instance.</param>
 /// <param name="info">The information.</param>
 /// <returns>ConsumptionResult.</returns>
 public virtual ConsumptionResult CanConsume(object instance, IterationInfo info)
 {
     return(Parameters.Select(x => x.CanConsume(instance, info)).FirstOrDefault(x => x.Info != info) ??
            new ConsumptionResult(info, 0, null));
 }