Remove assert from constructor

This commit is contained in:
serso 2016-01-23 11:41:53 +01:00
parent 81510d18ea
commit dd23f0a906

View File

@ -4,7 +4,8 @@ import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.text.TextUtils; import android.text.TextUtils;
import jscl.math.function.CustomFunction;
import jscl.math.function.IFunction;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -13,15 +14,11 @@ import org.solovyev.android.calculator.json.Json;
import org.solovyev.android.calculator.json.Jsonable; import org.solovyev.android.calculator.json.Jsonable;
import org.solovyev.common.text.Strings; import org.solovyev.common.text.Strings;
import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import javax.annotation.Nonnull;
import jscl.math.function.CustomFunction;
import jscl.math.function.IFunction;
public class CppFunction implements Jsonable, Parcelable { public class CppFunction implements Jsonable, Parcelable {
public static final Json.Creator<CppFunction> JSON_CREATOR = new Json.Creator<CppFunction>() { public static final Json.Creator<CppFunction> JSON_CREATOR = new Json.Creator<CppFunction>() {
@ -58,8 +55,6 @@ public class CppFunction implements Jsonable, Parcelable {
protected String description = ""; protected String description = "";
private CppFunction(@Nonnull String name, @Nonnull String body) { private CppFunction(@Nonnull String name, @Nonnull String body) {
Check.isNotEmpty(name);
Check.isNotEmpty(body);
this.id = NO_ID; this.id = NO_ID;
this.name = name; this.name = name;
this.body = body; this.body = body;
@ -123,6 +118,9 @@ public class CppFunction implements Jsonable, Parcelable {
@Nonnull @Nonnull
@Override @Override
public JSONObject toJson() throws JSONException { public JSONObject toJson() throws JSONException {
Check.isNotEmpty(name);
Check.isNotEmpty(body);
final JSONObject json = new JSONObject(); final JSONObject json = new JSONObject();
if (!parameters.isEmpty()) { if (!parameters.isEmpty()) {
final JSONArray array = new JSONArray(); final JSONArray array = new JSONArray();