示例#1
0
 public static ValueBuilder Minimum(this IValueBuilders valueFactory, ValueBuilder left, IValueBuilder right)
 => valueFactory.If(left > right).Then(right).Else(left);
示例#2
0
 public static ValueBuilder Maximum(this IValueBuilders valueFactory, ValueBuilder left, double right)
 => valueFactory.If(left < right).Then(right).Else(left);
示例#3
0
 public static ValueBuilder Floor(this ValueBuilder value)
 => value.Select(Math.Floor, o => "Floor(" + o + ")");
示例#4
0
 public static ValueBuilder Ceiling(this ValueBuilder value)
 => value.Select(Math.Ceiling, o => "Ceiling(" + o + ")");
示例#5
0
 /// <summary>
 /// Returns a value converter multiplying values by <c>(stat.Value / divideBy).Ceiling</c>.
 /// </summary>
 public static Func <ValueBuilder, ValueBuilder> PerStatCeiled(IStatBuilder stat, ValueBuilder divideBy) =>
 v => v * (stat.Value / divideBy).Ceiling();
示例#6
0
 /// <summary>
 /// Returns <c>value.AsPercentage * stat.Value</c>.
 /// </summary>
 public static ValueBuilder PercentOf(this ValueBuilder value, IStatBuilder stat) =>
 value.AsPercentage * stat.Value;
示例#7
0
 public static Func <ValueBuilder, ValueBuilder> PerStat(ValueBuilder statValue, ValueBuilder divideBy) =>
 v => v * (statValue / divideBy).Floor();
示例#8
0
 /// <summary>
 /// Returns a value converter multiplying values by <c>(stat.Value / divideBy).Floor</c>.
 /// </summary>
 public static Func <ValueBuilder, ValueBuilder> PerStat(IStatBuilder stat, ValueBuilder divideBy) =>
 PerStat(stat.Value, divideBy);
 public static ValueBuilder PerStat(this ValueBuilder value, ValueBuilder multiplierValue, ValueBuilder divideBy) =>
 value * (multiplierValue / divideBy).Floor();
 public static ValueBuilder PerStat(this ValueBuilder value, IStatBuilder multiplier, ValueBuilder divideBy) =>
 value.PerStat(multiplier.Value, divideBy);
 public static Func <ValueBuilder, ValueBuilder> PerStat(ValueBuilder statValue, ValueBuilder divideBy) =>
 v => PerStat(v, statValue, divideBy);