public BiFunctionNode(BiFunction <D1, D2, C> map, Node <D1> node1, Node <D2> node2, List <SimplificationRule <C> > rules) { this.node1 = node1; this.node2 = node2; this.map = map; this.rules = rules; }
public DFA(Set <Q> states, Set <C> alphabet, BiFunction <Q, C, Q> transition, Q start, Set <Q> accept) { States = states; Alphabet = alphabet; Transition = transition; Start = start; Accept = accept; }
internal static List <U> eagerMapWithIndex <T, U>(Iterable <T> iterable, BiFunction <int, T, U> function) { var result = FromJava.IterableToEnumerable(iterable) .Select((value, index) => function.apply(index, value)) .ToList(); return(ToJava.ListToList(result)); }
/// <summary> /// Creates a new AStar algorithm instance with the provided start and goal nodes. /// </summary> /// <param name="g">a function that, given a particular node, computes what is the cost for reaching such node</param> /// <param name="h">a function that, given a particular node, computes an estimate for reaching the goal state</param> /// <param name="totalCostComputer">A function that, given the output of both "g" and "h", retrieve the total cost of the state</param> public AStar(CostEvaluator <NODE> g, HeuristicEvaluator <NODE> h, BiFunction totalCostComputer) { var duplicateComparer = new DuplicateComparer(); this.Heuristic = h; this.CostFunction = g; this.TotalCostComputer = totalCostComputer; openList = new SortedList <int, Triple <NODE, int, int> >(duplicateComparer); closedList = new SortedList <int, Triple <NODE, int, int> >(duplicateComparer); }
public static Matrix <R> import <D1, D2>(BiFunction <D1, D2, R> func, D1[] rows, D2[] cols) where D1 : ValueType where D2 : ValueType { var entries = new R[rows.Length, cols.Length]; Parallel.For(0, rows.Length, i => { Parallel.For(0, rows.Length, j => { entries[i, j] = func.evaluate(rows[i], cols[j]); }); }); return(entries); }
public static void Main(string [] args) { Supplyer <string> sup1 = Funcs.Foo; Supplyer <object> sup2 = Funcs.Bar; // Incompatible types: // * Expected: () -> object // * Actual: object -> void Supplyer <object> sup3 = Funcs.Zoo; // No overload for 'Zoo' matches delegate 'Supplyer<object>' Consumer <object> cons1 = Funcs.Zoo; Consumer <object> cons2 = System.Console.WriteLine; cons2.Invoke("Invoke println through function reference"); BiFunction <int, int, int> f = App.Add; cons2.Invoke(f.Invoke(5, 3)); // 8 f = App.Sub; cons2.Invoke(f.Invoke(5, 3)); // 2 }
/// <summary> /// Constructs a {@code TerminalOp} that implements a functional reduce on /// reference values. /// </summary> /// @param <T> the type of the input elements </param> /// @param <U> the type of the result </param> /// <param name="seed"> the identity element for the reduction </param> /// <param name="reducer"> the accumulating function that incorporates an additional /// input element into the result </param> /// <param name="combiner"> the combining function that combines two intermediate /// results </param> /// <returns> a {@code TerminalOp} implementing the reduction </returns> //JAVA TO C# CONVERTER TODO TASK: There is no .NET equivalent to the Java 'super' constraint: //ORIGINAL LINE: public static <T, U> TerminalOp<T, U> makeRef(U seed, java.util.function.BiFunction<U, ? base T, U> reducer, java.util.function.BinaryOperator<U> combiner) public static TerminalOp <T, U> makeRef <T, U, T1>(U seed, BiFunction <T1> reducer, BinaryOperator <U> combiner) { Objects.RequireNonNull(reducer); Objects.RequireNonNull(combiner); //JAVA TO C# CONVERTER TODO TASK: Local classes are not converted by Java to C# Converter: // class ReducingSink extends Box<U> implements AccumulatingSink<T, U, ReducingSink> // { // @@Override public void begin(long size) // { // state = seed; // } // // @@Override public void accept(T t) // { // state = reducer.apply(state, t); // } // // @@Override public void combine(ReducingSink other) // { // state = combiner.apply(state, other.state); // } // } return(new ReduceOpAnonymousInnerClassHelper()); }
public BiFunctionNode(BiFunction <D1, D2, C> map, Node <D1> node1, Node <D2> node2) { this.node1 = node1; this.node2 = node2; this.map = map; }