private static NodeValue Combine(NodeValue left, NodeValue?right, Func <double, double, double> operation) { if (!right.HasValue) { return(left); } return(NodeValue.Combine(left, right.Value, operation)); }
private NodeValue?Calculate(IValueCalculationContext context, NodeValue value) { if (Stat.Minimum != null) { var minimum = context.GetValue(Stat.Minimum) ?? new NodeValue(double.MinValue); value = NodeValue.Combine(value, minimum, Math.Max); } if (Stat.Maximum != null) { var maximum = context.GetValue(Stat.Maximum) ?? new NodeValue(double.MaxValue); value = NodeValue.Combine(value, maximum, Math.Min); } return(value); }
private static NodeValue Combine(NodeValue left, NodeValue?right, Func <double, double, double> operation) => NodeValue.Combine(left, right ?? left, operation);