public string GetPlot( Func <M, R> f, IEnumerable <M> inputs, int plotWidth = 50, R?minP = null, R?maxP = null, bool asPercentage = false, bool centered = true) { var setMinP = minP ?? BaseRealField.Min(inputs.Select(k => f(k))); var setMaxP = maxP ?? BaseRealField.Max(inputs.Select(k => f(k))); var formatString = asPercentage ? "{0:>12}\t{1:>12.2%}\t{2}" : "{0:>12}\t{1:>12}\t{2}"; if (centered) { var result = string.Join(Environment.NewLine, inputs.Select(k => GetPlotLine(f(k), setMinP, setMaxP, plotWidth))); return(result); } else { var result = string.Join(Environment.NewLine, inputs.Select(k => GetCenteredPlotLine(f(k), setMinP, setMaxP, plotWidth))); return(result); } // return str.join("\n",list(map(lambda k:\ // formatString.format(\ // round(k,4),\ // round(p(k), 4),\ // plotFunction(p(k),setMinP,setMaxP,plotWidth)\ // ), inputs))) }
public ValidationResult Validate(R?value) { if (value.HasValue) { return(ValidationResult.Success); } else { return(ValidationResult.Fail()); } }
public string GetSimplePlot( Func <M, R> f, IEnumerable <M> inputs, int plotWidth = 50, R?minP = null, R?maxP = null, bool asPercentage = false, bool centered = true) { var formatString = asPercentage ? "{0:.2%}" : "{0}"; var result = string.Join(Environment.NewLine, inputs.Select(k => f(k).ToString())); return(result); // return str.join("\n",list(map(lambda k:\ // formatString.format(round(p(k), 4)),\ // inputs))) }
public TokenParserAttribute(R tokenType) { this.tokenType = tokenType; }
public object NullOrValue <R>(R?value) where R : struct { return(value.HasValue ? (object)value.Value : DBNull.Value); }
/// <summary> /// Initializes an execution exception with given {@code message}, {@code innerException} and application-specific /// {@code details}. /// </summary> /// <param name="message"></param> /// <param name="innerException"></param> /// <param name="details"></param> public HandlerExecutionException(string message, Exception?innerException, R?details) : base(message, innerException) { _details = details; }
public UnlockingSpecification(ItemIdentifier item, R unlocks, R?additionalUnlocks = null) { Item = item; Unlocks = unlocks; AdditionalUnlocks = additionalUnlocks ?? R.None; }
public static Either <L, R> Right <L, R>(R?value) where R : struct => isnull(value) ? raise <Either <L, R> >(new ValueIsNullException()) : Either <L, R> .Right(value.Value);
public R() { mCurrent = this; }