예제 #1
0
        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)))
        }
예제 #2
0
 public ValidationResult Validate(R?value)
 {
     if (value.HasValue)
     {
         return(ValidationResult.Success);
     }
     else
     {
         return(ValidationResult.Fail());
     }
 }
예제 #3
0
        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)))
        }
예제 #4
0
 public TokenParserAttribute(R tokenType)
 {
     this.tokenType = tokenType;
 }
예제 #5
0
 public object NullOrValue <R>(R?value) where R : struct
 {
     return(value.HasValue ? (object)value.Value : DBNull.Value);
 }
예제 #6
0
 /// <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;
 }
예제 #7
0
 public UnlockingSpecification(ItemIdentifier item, R unlocks, R?additionalUnlocks = null)
 {
     Item              = item;
     Unlocks           = unlocks;
     AdditionalUnlocks = additionalUnlocks ?? R.None;
 }
예제 #8
0
 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);
예제 #9
0
 public TokenParserAttribute(R tokenType)
 {
     this.tokenType = tokenType;
 }
예제 #10
0
 public R()
 {
     mCurrent = this;
 }