Skip to content

Commit

Permalink
Backport from g3 to github
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Mar 13, 2019
1 parent afcc53d commit 2f06801
Show file tree
Hide file tree
Showing 19 changed files with 148 additions and 239 deletions.
2 changes: 2 additions & 0 deletions ortools/algorithms/csharp/knapsack_solver.i
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ typedef uint64_t uint64;
%rename (UseReduction) operations_research::KnapsackSolver::use_reduction;
%rename (SetUseReduction) operations_research::KnapsackSolver::set_use_reduction;

// TODO(user): Replace with %ignoreall/%unignoreall
//swiglint: disable include-h-allglobals
%include "ortools/algorithms/knapsack_solver.h"
1 change: 1 addition & 0 deletions ortools/base/base.i
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

%{
#include <cstdint>
#include <string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
*/
@FunctionalInterface
public interface IntIntToLongFunction {
/**
* Applies this function to the given arguments.
*
* @param left the first argument
* @param right the second argument
* @return the function result
*/
long applyAsLong(int left, int right);
/**
* Applies this function to the given arguments.
*
* @param left the first argument
* @param right the second argument
* @return the function result
*/
long applyAsLong(int left, int right);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
*/
@FunctionalInterface
public interface LongTernaryOperator {
/**
* Applies this operator to the given operands.
*
* @param left the first operand
* @param center the second operand
* @param right the third operand
* @return the operator result
*/
long applyAsLong(long left, long center, long right);
/**
* Applies this operator to the given operands.
*
* @param left the first operand
* @param center the second operand
* @param right the third operand
* @return the operator result
*/
long applyAsLong(long left, long center, long right);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@
*/
@FunctionalInterface
public interface LongTernaryPredicate {
/**
* Evaluates this predicate on the given arguments.
*
* @param left the first operand
* @param center the second operand
* @param right the third operand
* @return {@code true} if the input argument matches the predicate,
* otherwise {@code false}
*/
boolean test(long left, long center, long right);
/**
* Evaluates this predicate on the given arguments.
*
* @param left the first operand
* @param center the second operand
* @param right the third operand
* @return {@code true} if the input argument matches the predicate,
* otherwise {@code false}
*/
boolean test(long left, long center, long right);

/**
* Returns a predicate that represents the logical negation of this
* predicate.
*
* @return a predicate that represents the logical negation of this
* predicate
*/
default LongTernaryPredicate negate() {
return (left, center, right) -> !test(left, center, right);
}
/**
* Returns a predicate that represents the logical negation of this
* predicate.
*
* @return a predicate that represents the logical negation of this
* predicate
*/
default LongTernaryPredicate negate() {
return (left, center, right) -> !test(left, center, right);
}
}
4 changes: 2 additions & 2 deletions ortools/constraint_solver/csharp/IntArrayHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static implicit operator CpIntVectorVector(int[,] inVal) {
return outVal;
}

// cast from C# int[][] two-dimensional rray
// cast from C# int[][] two-dimensional array
public static implicit operator CpIntVectorVector(int[][] inVal) {
int x_size = inVal.GetLength(0);
CpIntVectorVector outVal = new CpIntVectorVector();
Expand Down Expand Up @@ -173,7 +173,7 @@ public static implicit operator CpInt64VectorVector(long[,] inVal) {
return outVal;
}

// cast from C# long[][] two-dimensional rray
// cast from C# long[][] two-dimensional array
public static implicit operator CpInt64VectorVector(long[][] inVal) {
int x_size = inVal.GetLength(0);
CpInt64VectorVector outVal = new CpInt64VectorVector();
Expand Down
33 changes: 0 additions & 33 deletions ortools/constraint_solver/csharp/constraint_solver.i
Original file line number Diff line number Diff line change
Expand Up @@ -238,39 +238,6 @@ DEFINE_ARGS_TO_R_CALLBACK(
#undef DEFINE_ARGS_TO_R_CALLBACK
#undef DEFINE_VOID_TO_STRING_CALLBACK

// Convert in module_csharp_wrap.cc input argument (delegate marshaled in C function pointer) to original std::function<...>
//%typemap(in) Solver::DisplayCallback %{
// $1 = [$input]() -> std::string {
// std::string result;
// return result.assign((*(char* (*)())$input)());
// };
//%}
//
//%typemap(in) Solver::IndexEvaluator1 %{
// $1 = [$input](int64 u) -> int64 {
// return (*(int64 (*)(int64))$input)(u);
// };
//%}
//%typemap(in) Solver::IndexEvaluator2 %{
// $1 = [$input](int64 u, int64 v) -> int64 {
// return (*(int64 (*)(int64, int64))$input)(u, v);};
//%}
//%typemap(in) Solver::IndexEvaluator3 %{
// $1 = [$input](int64 u, int64 v, int64 w) -> int64 {
// return (*(int64 (*)(int64, int64, int64))$input)(u, v, w);};
//%}
//
//%typemap(in) Solver::IndexFilter1 %{
// $1 = [$input](int64 u) -> bool {
// return (*(bool (*)(int64))$input)(u);};
//%}
//%typemap(in) Solver::ObjectiveWatcher %{
// $1 = [$input](int64 u) -> void {
// return (*(void (*)(int64))$input)(u);};
//%}



// Renaming
namespace operations_research {

Expand Down
Loading

0 comments on commit 2f06801

Please sign in to comment.