/// <summary> /// Create a new ZenStringLengthExpr. /// </summary> /// <param name="expr">The string expr.</param> /// <returns>The new Zen expr.</returns> public static Zen <BigInteger> Create(Zen <string> expr) { CommonUtilities.ValidateNotNull(expr); hashConsTable.GetOrAdd(expr.Id, () => Simplify(expr), out var value); return(value); }
/// <summary> /// Create a new ZenBitwiseNot expr. /// </summary> /// <param name="expr"></param> /// <returns></returns> public static Zen <T> Create(Zen <T> expr) { CommonUtilities.ValidateNotNull(expr); CommonUtilities.ValidateIsIntegerType(typeof(T)); hashConsTable.GetOrAdd(expr.Id, () => Simplify(expr), out var value); return(value); }
public static Zen <TResult> Create( Zen <IList <T> > listExpr, Zen <TResult> empty, Func <Zen <T>, Zen <IList <T> >, Zen <TResult> > cons) { CommonUtilities.ValidateNotNull(listExpr); CommonUtilities.ValidateNotNull(empty); CommonUtilities.ValidateNotNull(cons); return(Simplify(listExpr, empty, cons)); }
public static Zen <bool> Create(Zen <bool> expr) { CommonUtilities.ValidateNotNull(expr); if (hashConsTable.TryGetValue(expr, out var value)) { return(value); } var ret = Simplify(expr); hashConsTable[expr] = ret; return(ret); }
public static Zen <T> Create(Zen <T> expr) { CommonUtilities.ValidateNotNull(expr); CommonUtilities.ValidateIsIntegerType(typeof(T)); if (hashConsTable.TryGetValue(expr, out var value)) { return(value); } var ret = Simplify(expr); hashConsTable[expr] = ret; return(ret); }
public static Zen <TTo> CreateMulti(Zen <TFrom> expr, ImmutableList <Func <object, object> > converters, bool unroll = false) { CommonUtilities.ValidateNotNull(expr); var key = (expr, ConvertersHashCode(converters), unroll); if (hashConsTable.TryGetValue(key, out var value)) { return(value); } var ret = Simplify(expr, converters, unroll); hashConsTable[key] = ret; return(ret); }
public static Zen <string> Create(string value) { CommonUtilities.ValidateNotNull(value); CommonUtilities.ValidateStringLiteral(value); if (hashConsTable.TryGetValue(value, out var v)) { return(v); } var ret = new ZenConstantStringExpr(value); hashConsTable[value] = ret; return(ret); }
public static Zen <T2> Create(Zen <T1> expr, string fieldName, bool unroll = false) { CommonUtilities.ValidateNotNull(expr); CommonUtilities.ValidateNotNull(fieldName); ReflectionUtilities.ValidateFieldOrProperty(typeof(T1), typeof(T2), fieldName); var key = (expr, fieldName, unroll); if (hashConsTable.TryGetValue(key, out var value)) { return(value); } var ret = Simplify(expr, fieldName, unroll); hashConsTable[key] = ret; return(ret); }
/// <summary> /// Create a new instance of the <see cref="ZenFunction{T}"/> class. /// </summary> /// <param name="function">The function.</param> public ZenFunction(Func <Zen <T> > function) { CommonUtilities.ValidateNotNull(function); this.function = function; }