internal Type ResolveOnDemandFunction(string name, Type[] argumentTypes) { ResolveFunctionEventArgs args = new ResolveFunctionEventArgs(name, argumentTypes); ResolveFunction?.Invoke(this, args); return(args.ReturnType); }
public LazySegTree(int N, MergeFunction <T> merge, ResolveFunction <T, U> resolve, T fill = default(T)) { Count = N; this.merge = merge; this.resolve = resolve; n_layer = 1; for (int k = 1; k < N; k <<= 1) { n_layer += 1; } segsize = new int[n_layer]; data = new T[n_layer][]; lazy = new bool[n_layer][]; lazyData = new U[n_layer][]; for (int l = 0; l < n_layer; ++l) { segsize[l] = 1 << (n_layer - 1 - l); data[l] = new T[1 << l]; lazy[l] = new bool[1 << l]; lazyData[l] = new U[1 << l]; for (int j = 0; j < (1 << l); ++j) { data[l][j] = fill; } } }
public Task <string> ResolveQueryAsync(string name, BlockParameter blockParameter = null) { var resolveFunction = new ResolveFunction(); resolveFunction.Name = name; return(ContractHandler.QueryAsync <ResolveFunction, string>(resolveFunction, blockParameter)); }
public LazySegTree(int N, MergeFunction <T> merge, ResolveFunction <T, U> resolve, PostponeFunction <U> postpone, T fill = default(T)) { Count = N; this.merge = merge; this.resolve = resolve; this.postpone = postpone; n_layer = 1; for (int k = 1; k < N; k <<= 1) { n_layer += 1; } segsize = new int[n_layer]; data = new T[n_layer][]; lazy = new bool[n_layer][]; lazyData = new U[n_layer][]; for (int l = 0; l < n_layer; ++l) { segsize[l] = 1 << (n_layer - 1 - l); data[l] = new T[1 << l]; lazy[l] = new bool[1 << l]; lazyData[l] = new U[1 << l]; } for (int j = 0; j < data[n_layer - 1].Length; ++j) { data[n_layer - 1][j] = fill; } for (int l = n_layer - 2; l >= 0; --l) { for (int j = 0; j < (1 << l); ++j) { data[l][j] = merge(data[l + 1][j * 2], data[l + 1][j * 2 + 1], new STParams(layer: l, segsize: segsize[l], index: j)); } } }
public Task <string> ResolveQueryAsync(ResolveFunction resolveFunction, BlockParameter blockParameter = null) { return(ContractHandler.QueryAsync <ResolveFunction, string>(resolveFunction, blockParameter)); }