Jackson serialization for GREL functions
This commit is contained in:
parent
e661a647f3
commit
7648ca91ca
@ -35,9 +35,6 @@ package com.google.refine.expr.functions;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -60,13 +57,19 @@ public class Coalesce implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the first non-null from a series of values");
|
||||
writer.key("params"); writer.value("two or more objects");
|
||||
writer.key("returns"); writer.value("object or null");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns the first non-null from a series of values";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "two or more objects";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "object or null";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.InterProjectModel.ProjectJoin;
|
||||
import com.google.refine.ProjectManager;
|
||||
import com.google.refine.expr.EvalError;
|
||||
@ -78,13 +75,17 @@ public class Cross implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "join with another project by column";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("join with another project by column");
|
||||
writer.key("params"); writer.value("cell c or string value, string projectName, string columnName");
|
||||
writer.key("returns"); writer.value("array");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "cell c or string value, string projectName, string columnName";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "array";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.browsing.Engine;
|
||||
import com.google.refine.browsing.util.ExpressionNominalValueGrouper;
|
||||
import com.google.refine.expr.EvalError;
|
||||
@ -87,13 +84,17 @@ public class FacetCount implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the facet count corresponding to the given choice value";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the facet count corresponding to the given choice value");
|
||||
writer.key("params"); writer.value("choiceValue, string facetExpression, string columnName");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "choiceValue, string facetExpression, string columnName";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ import java.util.Properties;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.ExpressionUtils;
|
||||
import com.google.refine.expr.HasFields;
|
||||
@ -166,17 +165,21 @@ public class Get implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value(
|
||||
public String getDescription() {
|
||||
return
|
||||
"If o has fields, returns the field named 'from' of o. " +
|
||||
"If o is an array, returns o[from, to]. " +
|
||||
"if o is a string, returns o.substring(from, to)"
|
||||
);
|
||||
writer.key("params"); writer.value("o, number or string from, optional number to");
|
||||
writer.key("returns"); writer.value("Depends on actual arguments");
|
||||
writer.endObject();
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "o, number or string from, optional number to";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "Depends on actual arguments";
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.HasFields;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -67,13 +66,17 @@ public class HasField implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns whether o has field name";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns whether o has field name");
|
||||
writer.key("params"); writer.value("o, string name");
|
||||
writer.key("returns"); writer.value("boolean");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "o, string name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "boolean";
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ import java.util.Properties;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.grel.Function;
|
||||
|
||||
@ -79,13 +78,17 @@ public class Jsonize implements Function {
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Quotes a value as a JSON literal value";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Quotes a value as a JSON literal value");
|
||||
writer.key("params"); writer.value("value");
|
||||
writer.key("returns"); writer.value("JSON literal value");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "value";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "JSON literal value";
|
||||
}
|
||||
}
|
||||
|
@ -37,8 +37,6 @@ import java.util.Collection;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.expr.HasFieldsList;
|
||||
@ -72,13 +70,17 @@ public class Length implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the length of o";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the length of o");
|
||||
writer.key("params"); writer.value("array or string o");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "array or string o";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ import java.util.Properties;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.ExpressionUtils;
|
||||
import com.google.refine.expr.HasFieldsList;
|
||||
@ -130,16 +129,20 @@ public class Slice implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value(
|
||||
public String getDescription() {
|
||||
return
|
||||
"If o is an array, returns o[from, to]. " +
|
||||
"if o is a string, returns o.substring(from, to)"
|
||||
);
|
||||
writer.key("params"); writer.value("o, number from, optional number to");
|
||||
writer.key("returns"); writer.value("Depends on actual arguments");
|
||||
writer.endObject();
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "o, number from, optional number to";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "Depends on actual arguments";
|
||||
}
|
||||
}
|
||||
|
@ -46,12 +46,10 @@ import java.util.Properties;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.expr.util.CalendarParserException;
|
||||
import com.google.refine.expr.util.CalendarParser;
|
||||
import com.google.refine.expr.util.CalendarParserException;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
import com.google.refine.util.ParsingUtilities;
|
||||
@ -188,13 +186,17 @@ public class ToDate implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns o converted to a date object, you can hint if the day or the month is listed first, or give an ordered list of possible formats using this syntax: http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html");
|
||||
writer.key("params"); writer.value("o, boolean month_first / format1, format2, ... (all optional)");
|
||||
writer.key("returns"); writer.value("date");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns o converted to a date object, you can hint if the day or the month is listed first, or give an ordered list of possible formats using this syntax: http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "o, boolean month_first / format1, format2, ... (all optional)";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "date";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -71,14 +68,18 @@ public class ToNumber implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns o converted to a number";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns o converted to a number");
|
||||
writer.key("params"); writer.value("o");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "o";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,9 +37,6 @@ import java.time.OffsetDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -72,13 +69,17 @@ public class ToString implements Function {
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns o converted to a string";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns o converted to a string");
|
||||
writer.key("params"); writer.value("o, string format (optional)");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "o, string format (optional)";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -37,9 +37,6 @@ import java.time.OffsetDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -72,13 +69,17 @@ public class Type implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the type of o";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the type of o");
|
||||
writer.key("params"); writer.value("object o");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "object o";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.arrays;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.grel.Function;
|
||||
|
||||
public class ArgsToArray implements Function {
|
||||
@ -48,13 +45,17 @@ public class ArgsToArray implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns all arguments passed to it as an array";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns all arguments passed to it as an array");
|
||||
writer.key("params"); writer.value("a1, a2, ...");
|
||||
writer.key("returns"); writer.value("array");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "a1, a2, ...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "array";
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ import java.util.Properties;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.expr.ExpressionUtils;
|
||||
@ -101,13 +100,17 @@ public class Join implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the string obtained by joining the array a with the separator sep";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the string obtained by joining the array a with the separator sep");
|
||||
writer.key("params"); writer.value("array a, string sep");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "array a, string sep";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ import java.util.Properties;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.expr.ExpressionUtils;
|
||||
@ -88,13 +87,17 @@ public class Reverse implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Reverses array a";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Reverses array a");
|
||||
writer.key("params"); writer.value("array a");
|
||||
writer.key("returns"); writer.value("array");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "array a";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "array";
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ import java.util.Properties;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
@ -86,13 +85,17 @@ public class Sort implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Sorts array a";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Sorts array a");
|
||||
writer.key("params"); writer.value("array a");
|
||||
writer.key("returns"); writer.value("array");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "array a";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "array";
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ import java.util.Set;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.expr.ExpressionUtils;
|
||||
@ -86,13 +85,17 @@ public class Uniques implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns array a with duplicates removed";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns array a with duplicates removed");
|
||||
writer.key("params"); writer.value("array a");
|
||||
writer.key("returns"); writer.value("array");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "array a";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "array";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.booleans;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -58,13 +55,17 @@ public class And implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("AND two or more booleans to yield a boolean");
|
||||
writer.key("params"); writer.value("boolean a, boolean b");
|
||||
writer.key("returns"); writer.value("boolean");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "AND two or more booleans to yield a boolean";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "boolean a, boolean b";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "boolean";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.booleans;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -58,13 +55,17 @@ public class Not implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the opposite of b";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the opposite of b");
|
||||
writer.key("params"); writer.value("boolean b");
|
||||
writer.key("returns"); writer.value("boolean");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "boolean b";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "boolean";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.booleans;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -58,13 +55,17 @@ public class Or implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("OR two or more booleans to yield a boolean");
|
||||
writer.key("params"); writer.value("boolean a, boolean b");
|
||||
writer.key("returns"); writer.value("boolean");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "OR two or more booleans to yield a boolean";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "boolean a, boolean b";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "boolean";
|
||||
}
|
||||
}
|
||||
|
@ -27,9 +27,6 @@ package com.google.refine.expr.functions.booleans;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -45,16 +42,17 @@ public class Xor implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description");
|
||||
writer.value("XORs two or more boolean values");
|
||||
writer.key("params");
|
||||
writer.value("boolean a, boolean b");
|
||||
writer.key("returns");
|
||||
writer.value("boolean");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "XORs two or more boolean values";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "boolean a, boolean b";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "boolean";
|
||||
}
|
||||
}
|
||||
|
@ -33,18 +33,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package com.google.refine.expr.functions.date;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
import java.util.TimeZone;
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.temporal.TemporalField;
|
||||
import java.time.temporal.WeekFields;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
@ -141,11 +138,17 @@ public class DatePart implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options) throws JSONException {
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns part of a date");
|
||||
writer.key("params"); writer.value("date d, string part");
|
||||
writer.key("returns"); writer.value("date");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns part of a date";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "date d, string part";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "date";
|
||||
}
|
||||
}
|
||||
|
@ -38,9 +38,6 @@ import java.time.temporal.ChronoUnit;
|
||||
import java.time.temporal.TemporalUnit;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -88,11 +85,17 @@ public class Inc implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options) throws JSONException {
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns a date changed by the given amount in the given unit of time");
|
||||
writer.key("params"); writer.value("date d, number value, string unit (default to 'hour')");
|
||||
writer.key("returns"); writer.value("date");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns a date changed by the given amount in the given unit of time";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "date d, number value, string unit (default to 'hour')";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "date";
|
||||
}
|
||||
}
|
||||
|
@ -53,12 +53,12 @@ public class Now implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the current time";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the current time");
|
||||
writer.key("returns"); writer.value("date");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "date";
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,6 @@ package com.google.refine.expr.functions.html;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
import org.jsoup.nodes.Element;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
@ -61,14 +59,18 @@ public class InnerHtml implements Function {
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("The innerHtml of an HTML element");
|
||||
writer.key("params"); writer.value("Element e");
|
||||
writer.key("returns"); writer.value("String innerHtml");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "The innerHtml of an HTML element";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "Element e";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "String innerHtml";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,7 @@ package com.google.refine.expr.functions.html;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
import org.jsoup.Jsoup;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.expr.functions.xml.ParseXml;
|
||||
@ -58,14 +57,18 @@ public class ParseHtml implements Function {
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Parses a string as HTML");
|
||||
writer.key("params"); writer.value("string s");
|
||||
writer.key("returns"); writer.value("HTML object");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Parses a string as HTML";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "HTML object";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,13 +50,17 @@ public class ACos implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the arc cosine of an angle, in the range 0 through PI");
|
||||
writer.key("params"); writer.value("number d");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns the arc cosine of an angle, in the range 0 through PI";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,13 +50,17 @@ public class ASin implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the arc sine of an angle in the range of -PI/2 through PI/2");
|
||||
writer.key("params"); writer.value("number d");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns the arc sine of an angle in the range of -PI/2 through PI/2";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,13 +50,17 @@ public class ATan implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the arc tangent of an angle in the range of -PI/2 through PI/2");
|
||||
writer.key("params"); writer.value("number d");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns the arc tangent of an angle in the range of -PI/2 through PI/2";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -54,13 +51,17 @@ public class ATan2 implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Converts rectangular coordinates (x, y) to polar (r, theta)");
|
||||
writer.key("params"); writer.value("number x, number y");
|
||||
writer.key("returns"); writer.value("number theta");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Converts rectangular coordinates (x, y) to polar (r, theta)";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number x, number y";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number theta";
|
||||
}
|
||||
}
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,13 +50,17 @@ public class Abs implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the absolute value of a number";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the absolute value of a number");
|
||||
writer.key("params"); writer.value("number d");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,13 +50,17 @@ public class Ceil implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the ceiling of a number";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the ceiling of a number");
|
||||
writer.key("params"); writer.value("number d");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -87,13 +84,17 @@ public class Combin implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the number of combinations for n elements as divided into k");
|
||||
writer.key("params"); writer.value("number d");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns the number of combinations for n elements as divided into k";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,13 +50,17 @@ public class Cos implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the trigonometric cosine of an angle");
|
||||
writer.key("params"); writer.value("number d");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns the trigonometric cosine of an angle";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,13 +50,17 @@ public class Cosh implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the hyperbolic cosine of a value");
|
||||
writer.key("params"); writer.value("number d");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns the hyperbolic cosine of a value";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,13 +50,17 @@ public class Degrees implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Converts an angle from radians to degrees.");
|
||||
writer.key("params"); writer.value("number d");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Converts an angle from radians to degrees.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -58,13 +55,17 @@ public class Even implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Rounds the number up to the nearest even integer");
|
||||
writer.key("params"); writer.value("number d");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Rounds the number up to the nearest even integer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.grel.Function;
|
||||
|
||||
public class Exp implements Function {
|
||||
@ -51,13 +48,17 @@ public class Exp implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns e^n";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns e^n");
|
||||
writer.key("params"); writer.value("number n");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number n";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,13 +50,17 @@ public class Fact implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the factorial of a number");
|
||||
writer.key("params"); writer.value("number i");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns the factorial of a number";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number i";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -80,13 +77,17 @@ public class FactN implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the factorial of a number");
|
||||
writer.key("params"); writer.value("number i");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns the factorial of a number";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number i";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,14 +50,18 @@ public class Floor implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the floor of a number as an integer";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the floor of a number as an integer");
|
||||
writer.key("params"); writer.value("number d");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -58,13 +55,17 @@ public class GreatestCommonDenominator implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the greatest common denominator of the two numbers");
|
||||
writer.key("params"); writer.value("number d, number e");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns the greatest common denominator of the two numbers";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d, number e";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -70,13 +67,17 @@ public class LeastCommonMultiple implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the greatest common denominator of the two numbers");
|
||||
writer.key("params"); writer.value("number d, number e");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns the greatest common denominator of the two numbers";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d, number e";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,13 +50,17 @@ public class Ln implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the natural log of n";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the natural log of n");
|
||||
writer.key("params"); writer.value("number n");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number n";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,13 +50,17 @@ public class Log implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the base 10 log of n";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the base 10 log of n");
|
||||
writer.key("params"); writer.value("number n");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number n";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -57,13 +54,17 @@ public class Max implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the greater of two numbers";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the greater of two numbers");
|
||||
writer.key("params"); writer.value("number a, number b");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number a, number b";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -57,13 +54,17 @@ public class Min implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the smaller of two numbers";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the smaller of two numbers");
|
||||
writer.key("params"); writer.value("number a, number b");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number a, number b";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -58,13 +55,17 @@ public class Mod implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns a modulus b";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns a modulus b");
|
||||
writer.key("params"); writer.value("number a, number b");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number a, number b";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -63,13 +60,17 @@ public class Multinomial implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Calculates the multinomial of a series of numbers");
|
||||
writer.key("params"); writer.value("one or more numbers");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Calculates the multinomial of a series of numbers";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "one or more numbers";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -58,13 +55,17 @@ public class Odd implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Rounds the number up to the nearest even integer");
|
||||
writer.key("params"); writer.value("number d");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Rounds the number up to the nearest even integer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.grel.Function;
|
||||
|
||||
public class Pow implements Function {
|
||||
@ -54,13 +51,17 @@ public class Pow implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns a^b";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns a^b");
|
||||
writer.key("params"); writer.value("number a, number b");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number a, number b";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -54,13 +51,17 @@ public class Quotient implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the integer portion of a division");
|
||||
writer.key("params"); writer.value("number numerator, number denominator");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns the integer portion of a division";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number numerator, number denominator";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,13 +50,17 @@ public class Radians implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Converts an angle in degrees to radians");
|
||||
writer.key("params"); writer.value("number d");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Converts an angle in degrees to radians";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,13 +50,17 @@ public class Round implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns n rounded";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns n rounded");
|
||||
writer.key("params"); writer.value("number n");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number n";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,13 +50,17 @@ public class Sin implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the trigonometric sine of an angle");
|
||||
writer.key("params"); writer.value("number d");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns the trigonometric sine of an angle";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,13 +50,17 @@ public class Sinh implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the hyperbolic sine of an angle");
|
||||
writer.key("params"); writer.value("number d");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns the hyperbolic sine of an angle";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
@ -36,9 +36,6 @@ package com.google.refine.expr.functions.math;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.expr.ExpressionUtils;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
@ -82,13 +79,17 @@ public class Sum implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Sums numbers in array a";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Sums numbers in array a");
|
||||
writer.key("params"); writer.value("array a");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "array a";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,13 +50,17 @@ public class Tan implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the trigonometric tangent of an angle");
|
||||
writer.key("params"); writer.value("number d");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns the trigonometric tangent of an angle";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.math;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -53,13 +50,17 @@ public class Tanh implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the hyperbolic tangent of a value");
|
||||
writer.key("params"); writer.value("number d");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Returns the hyperbolic tangent of a value";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "number d";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
@ -36,8 +36,6 @@ package com.google.refine.expr.functions.strings;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.grel.Function;
|
||||
|
||||
@ -56,13 +54,17 @@ public class Chomp implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Removes separator from the end of str if it's there, otherwise leave it alone.";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Removes separator from the end of str if it's there, otherwise leave it alone.");
|
||||
writer.key("params"); writer.value("string str, string separator");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string str, string separator";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -37,9 +37,6 @@ import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.grel.Function;
|
||||
|
||||
public class Contains implements Function {
|
||||
@ -64,13 +61,17 @@ public class Contains implements Function {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns whether s contains frag";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns whether s contains frag");
|
||||
writer.key("params"); writer.value("string s, string frag");
|
||||
writer.key("returns"); writer.value("boolean");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, string frag";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "boolean";
|
||||
}
|
||||
}
|
||||
|
@ -37,8 +37,6 @@ import java.time.OffsetDateTime;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -104,12 +102,18 @@ public class Diff implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options) throws JSONException {
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("For strings, returns the portion where they differ. For dates, it returns the difference in given time units");
|
||||
writer.key("params"); writer.value("o1, o2, time unit (optional)");
|
||||
writer.key("returns"); writer.value("string for strings, number for dates");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "For strings, returns the portion where they differ. For dates, it returns the difference in given time units";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "o1, o2, time unit (optional)";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string for strings, number for dates";
|
||||
}
|
||||
|
||||
private long getNano(OffsetDateTime odt) {
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.strings;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -57,13 +54,17 @@ public class EndsWith implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns whether s ends with sub";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns whether s ends with sub");
|
||||
writer.key("params"); writer.value("string s, string sub");
|
||||
writer.key("returns"); writer.value("boolean");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, string sub";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "boolean";
|
||||
}
|
||||
}
|
||||
|
@ -38,8 +38,6 @@ import java.net.URLEncoder;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
@ -85,13 +83,17 @@ public class Escape implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Escapes a string depending on the given escaping mode.";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Escapes a string depending on the given escaping mode.");
|
||||
writer.key("params"); writer.value("string s, string mode ['html','xml','csv','url','javascript']");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, string mode ['html','xml','csv','url','javascript']";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -7,9 +7,6 @@ import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -41,13 +38,17 @@ public class Find implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns all the occurances of match given regular expression";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns all the occurances of match given regular expression");
|
||||
writer.key("params"); writer.value("string or regexp");
|
||||
writer.key("returns"); writer.value("array of strings");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string or regexp";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "array of strings";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.strings;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.clustering.binning.FingerprintKeyer;
|
||||
import com.google.refine.clustering.binning.Keyer;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -57,13 +54,17 @@ public class Fingerprint implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the fingerprint of s, a derived string that aims to be a more canonical form of it (this is mostly useful for finding clusters of strings related to the same information).";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the fingerprint of s, a derived string that aims to be a more canonical form of it (this is mostly useful for finding clusters of strings related to the same information).");
|
||||
writer.key("params"); writer.value("string s");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.strings;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -57,13 +54,17 @@ public class IndexOf implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the index of sub first ocurring in s";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the index of sub first ocurring in s");
|
||||
writer.key("params"); writer.value("string s, string sub");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, string sub";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.strings;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -57,14 +54,18 @@ public class LastIndexOf implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the index of sub last ocurring in s";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the index of sub last ocurring in s");
|
||||
writer.key("params"); writer.value("string s, string sub");
|
||||
writer.key("returns"); writer.value("number");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, string sub";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "number";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,8 +36,6 @@ package com.google.refine.expr.functions.strings;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
@ -56,13 +54,17 @@ public class MD5 implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the MD5 hash of s";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the MD5 hash of s");
|
||||
writer.key("params"); writer.value("string s");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -37,9 +37,6 @@ import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -78,13 +75,17 @@ public class Match implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns an array of the groups matching the given regular expression";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns an array of the groups matching the given regular expression");
|
||||
writer.key("params"); writer.value("string or regexp");
|
||||
writer.key("returns"); writer.value("array of strings");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string or regexp";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "array of strings";
|
||||
}
|
||||
}
|
||||
|
@ -36,8 +36,6 @@ package com.google.refine.expr.functions.strings;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
@ -79,13 +77,17 @@ public class NGram implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns an array of the word ngrams of s";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns an array of the word ngrams of s");
|
||||
writer.key("params"); writer.value("string s, number n");
|
||||
writer.key("returns"); writer.value("array of strings");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, number n";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "array of strings";
|
||||
}
|
||||
}
|
||||
|
@ -36,9 +36,6 @@ package com.google.refine.expr.functions.strings;
|
||||
import java.util.Properties;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.clustering.binning.Keyer;
|
||||
import com.google.refine.clustering.binning.NGramFingerprintKeyer;
|
||||
import com.google.refine.expr.EvalError;
|
||||
@ -76,13 +73,17 @@ public class NGramFingerprint implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the n-gram fingerprint of s";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the n-gram fingerprint of s");
|
||||
writer.key("params"); writer.value("string s, number n");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, number n";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONTokener;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
@ -62,13 +61,17 @@ public class ParseJson implements Function {
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Parses a string as JSON";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Parses a string as JSON");
|
||||
writer.key("params"); writer.value("string s");
|
||||
writer.key("returns"); writer.value("JSON object");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "JSON object";
|
||||
}
|
||||
}
|
||||
|
@ -37,9 +37,6 @@ import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.grel.Function;
|
||||
|
||||
public class Partition implements Function {
|
||||
@ -101,14 +98,18 @@ public class Partition implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return
|
||||
"Returns an array of strings [a,frag,b] where a is the string part before the first occurrence of frag in s and b is what's left. If omitFragment is true, frag is not returned.";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value(
|
||||
"Returns an array of strings [a,frag,b] where a is the string part before the first occurrence of frag in s and b is what's left. If omitFragment is true, frag is not returned.");
|
||||
writer.key("params"); writer.value("string s, string or regex frag, optional boolean omitFragment");
|
||||
writer.key("returns"); writer.value("array");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, string or regex frag, optional boolean omitFragment";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "array";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.strings;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.clustering.binning.ColognePhoneticKeyer;
|
||||
import com.google.refine.clustering.binning.DoubleMetaphoneKeyer;
|
||||
import com.google.refine.clustering.binning.Metaphone3Keyer;
|
||||
@ -100,13 +97,17 @@ public class Phonetic implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the a phonetic encoding of s (optionally indicating which encoding to use')";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the a phonetic encoding of s (optionally indicating which encoding to use')");
|
||||
writer.key("params"); writer.value("string s, string encoding (optional, defaults to 'metaphone3')");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, string encoding (optional, defaults to 'metaphone3')";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -37,9 +37,6 @@ import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.grel.Function;
|
||||
|
||||
public class RPartition implements Function {
|
||||
@ -102,14 +99,18 @@ public class RPartition implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return
|
||||
"Returns an array of strings [a,frag,b] where a is the string part before the last occurrence of frag in s and b is what's left. If omitFragment is true, frag is not returned.";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value(
|
||||
"Returns an array of strings [a,frag,b] where a is the string part before the last occurrence of frag in s and b is what's left. If omitFragment is true, frag is not returned.");
|
||||
writer.key("params"); writer.value("string s, string or regex frag, optional boolean omitFragment");
|
||||
writer.key("returns"); writer.value("array");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, string or regex frag, optional boolean omitFragment";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "array";
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,8 @@
|
||||
package com.google.refine.expr.functions.strings;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
@ -295,14 +292,18 @@ public class Range implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value(
|
||||
"Returns an array where a and b are the start and the end of the range respectively and c is the step (increment).");
|
||||
writer.key("params"); writer.value("A single string 'a', 'a, b' or 'a, b, c' or one, two or three integers a or a, b or a, b, c");
|
||||
writer.key("returns"); writer.value("array");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return
|
||||
"Returns an array where a and b are the start and the end of the range respectively and c is the step (increment).";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "A single string 'a', 'a, b' or 'a, b, c' or one, two or three integers a or a, b or a, b, c";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "array";
|
||||
}
|
||||
}
|
||||
|
@ -36,9 +36,6 @@ package com.google.refine.expr.functions.strings;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.ProjectManager;
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
@ -99,13 +96,17 @@ public class Reinterpret implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns s reinterpreted thru the given encoder.";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns s reinterpreted thru the given encoder.");
|
||||
writer.key("params"); writer.value("string s, string encoder");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, string encoder";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -36,9 +36,6 @@ package com.google.refine.expr.functions.strings;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -67,13 +64,17 @@ public class Replace implements Function {
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the string obtained by replacing f with r in s";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the string obtained by replacing f with r in s");
|
||||
writer.key("params"); writer.value("string s, string or regex f, string r");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, string or regex f, string r";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -36,8 +36,6 @@ package com.google.refine.expr.functions.strings;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
@ -61,13 +59,17 @@ public class ReplaceChars implements Function {
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the string obtained by replacing all chars in f with the char in s at that same position";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the string obtained by replacing all chars in f with the char in s at that same position");
|
||||
writer.key("params"); writer.value("string s, string f, string r");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, string f, string r";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -36,8 +36,6 @@ package com.google.refine.expr.functions.strings;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
@ -56,13 +54,17 @@ public class SHA1 implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the SHA-1 hash of s";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the SHA-1 hash of s");
|
||||
writer.key("params"); writer.value("string s");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -36,15 +36,12 @@ package com.google.refine.expr.functions.strings;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import au.com.bytecode.opencsv.CSVParser;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
|
||||
import au.com.bytecode.opencsv.CSVParser;
|
||||
|
||||
public class SmartSplit implements Function {
|
||||
|
||||
static final protected CSVParser s_tabParser = new CSVParser(
|
||||
@ -104,13 +101,17 @@ public class SmartSplit implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the array of strings obtained by splitting s with separator sep. Handles quotes properly. Guesses tab or comma separator if \"sep\" is not given.";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the array of strings obtained by splitting s with separator sep. Handles quotes properly. Guesses tab or comma separator if \"sep\" is not given.");
|
||||
writer.key("params"); writer.value("string s, optional string sep");
|
||||
writer.key("returns"); writer.value("array");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, optional string sep";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "array";
|
||||
}
|
||||
}
|
||||
|
@ -37,8 +37,6 @@ import java.util.Properties;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
@ -76,13 +74,17 @@ public class Split implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the array of strings obtained by splitting s with separator sep. If preserveAllTokens is true, then empty segments are preserved.";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the array of strings obtained by splitting s with separator sep. If preserveAllTokens is true, then empty segments are preserved.");
|
||||
writer.key("params"); writer.value("string s, string or regex sep, optional boolean preserveAllTokens");
|
||||
writer.key("returns"); writer.value("array");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, string or regex sep, optional boolean preserveAllTokens";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "array";
|
||||
}
|
||||
}
|
||||
|
@ -36,8 +36,6 @@ package com.google.refine.expr.functions.strings;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
@ -58,13 +56,17 @@ public class SplitByCharType implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns an array of strings obtained by splitting s grouping consecutive chars by their unicode type";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns an array of strings obtained by splitting s grouping consecutive chars by their unicode type");
|
||||
writer.key("params"); writer.value("string s");
|
||||
writer.key("returns"); writer.value("array");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "array";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.strings;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -71,13 +68,17 @@ public class SplitByLengths implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns the array of strings obtained by splitting s into substrings with the given lengths";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns the array of strings obtained by splitting s into substrings with the given lengths");
|
||||
writer.key("params"); writer.value("string s, number n, ...");
|
||||
writer.key("returns"); writer.value("array");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, number n, ...";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "array";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.strings;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -56,13 +53,17 @@ public class StartsWith implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects 2 strings");
|
||||
}
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns whether s starts with sub";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns whether s starts with sub");
|
||||
writer.key("params"); writer.value("string s, string sub");
|
||||
writer.key("returns"); writer.value("boolean");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, string sub";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "boolean";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.strings;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -54,13 +51,17 @@ public class ToLowercase implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns s converted to lowercase";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns s converted to lowercase");
|
||||
writer.key("params"); writer.value("string s");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -36,8 +36,6 @@ package com.google.refine.expr.functions.strings;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
@ -64,14 +62,18 @@ public class ToTitlecase implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns s converted to titlecase";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns s converted to titlecase");
|
||||
writer.key("params"); writer.value("string s");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.strings;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
import com.google.refine.grel.Function;
|
||||
@ -54,13 +51,17 @@ public class ToUppercase implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns s converted to uppercase";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns s converted to uppercase");
|
||||
writer.key("params"); writer.value("string s");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -35,11 +35,7 @@ package com.google.refine.expr.functions.strings;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.common.base.CharMatcher;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.Function;
|
||||
|
||||
@ -56,13 +52,17 @@ public class Trim implements Function {
|
||||
return new EvalError("Invalid parameters");
|
||||
}
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns copy of the string, with leading and trailing whitespace omitted.";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns copy of the string, with leading and trailing whitespace omitted.");
|
||||
writer.key("params"); writer.value("string s");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -38,8 +38,6 @@ import java.net.URLDecoder;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
@ -76,13 +74,17 @@ public class Unescape implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Unescapes all escaped parts of the string depending on the given escaping mode.";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Unescapes all escaped parts of the string depending on the given escaping mode.");
|
||||
writer.key("params"); writer.value("string s, string mode ['html','xml','csv','url','javascript']");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s, string mode ['html','xml','csv','url','javascript']";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.strings;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.grel.Function;
|
||||
|
||||
public class Unicode implements Function {
|
||||
@ -57,13 +54,17 @@ public class Unicode implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns an array of strings describing each character of s in their full unicode notation";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns an array of strings describing each character of s in their full unicode notation");
|
||||
writer.key("params"); writer.value("string s");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ package com.google.refine.expr.functions.strings;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.google.refine.grel.Function;
|
||||
|
||||
public class UnicodeType implements Function {
|
||||
@ -94,13 +91,17 @@ public class UnicodeType implements Function {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
public String getDescription() {
|
||||
return "Returns an array of strings describing each character of s in their full unicode notation";
|
||||
}
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Returns an array of strings describing each character of s in their full unicode notation");
|
||||
writer.key("params"); writer.value("string s");
|
||||
writer.key("returns"); writer.value("string");
|
||||
writer.endObject();
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "string s";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,6 @@ package com.google.refine.expr.functions.xml;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
import org.jsoup.nodes.Element;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
@ -62,14 +60,18 @@ public class OwnText implements Function {
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Gets the text owned by this XML/HTML element only; does not get the combined text of all children.");
|
||||
writer.key("params"); writer.value("Element e");
|
||||
writer.key("returns"); writer.value("String ownText");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Gets the text owned by this XML/HTML element only; does not get the combined text of all children.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "Element e";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "String ownText";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,6 @@ package com.google.refine.expr.functions.xml;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
import org.jsoup.nodes.Element;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
@ -64,14 +62,18 @@ public class SelectXml implements Function {
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Selects an element from an XML or HTML element using selector syntax.");
|
||||
writer.key("params"); writer.value("Element e, String s");
|
||||
writer.key("returns"); writer.value("XML/HTML Elements");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Selects an element from an XML or HTML elementn using selector syntax.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "Element e, String s";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "HTML Elements";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,6 @@ package com.google.refine.expr.functions.xml;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
import org.jsoup.nodes.Element;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
@ -64,14 +62,18 @@ public class XmlAttr implements Function {
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Selects a value from an attribute on an xml or html Element.");
|
||||
writer.key("params"); writer.value("Element e, String s");
|
||||
writer.key("returns"); writer.value("String attribute Value");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Selects a value from an attribute on an XML or HTML Element";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "Element e, String s";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "String attribute Value";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,6 @@ package com.google.refine.expr.functions.xml;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONWriter;
|
||||
import org.jsoup.nodes.Element;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
@ -62,14 +60,18 @@ public class XmlText implements Function {
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
writer.object();
|
||||
writer.key("description"); writer.value("Selects the text from within an element (including all child elements)");
|
||||
writer.key("params"); writer.value("Element e");
|
||||
writer.key("returns"); writer.value("String text");
|
||||
writer.endObject();
|
||||
public String getDescription() {
|
||||
return "Selects the text from within an element (including all child elements)";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParams() {
|
||||
return "Element e";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReturns() {
|
||||
return "String text";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,11 @@ package com.google.refine.grel;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONWriter;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.google.refine.Jsonizable;
|
||||
|
||||
/**
|
||||
@ -43,4 +48,27 @@ import com.google.refine.Jsonizable;
|
||||
*/
|
||||
public interface Function extends Jsonizable {
|
||||
public Object call(Properties bindings, Object[] args);
|
||||
|
||||
@JsonProperty("description")
|
||||
public String getDescription();
|
||||
|
||||
@JsonProperty("params")
|
||||
@JsonInclude(Include.NON_EMPTY)
|
||||
default public String getParams() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@JsonProperty("returns")
|
||||
public String getReturns();
|
||||
|
||||
@Override
|
||||
default public void write(JSONWriter writer, Properties options) {
|
||||
writer.object();
|
||||
writer.key("description"); writer.value(getDescription());
|
||||
if (!getParams().isEmpty()) {
|
||||
writer.key("params"); writer.value(getParams());
|
||||
}
|
||||
writer.key("returns"); writer.value(getReturns());
|
||||
writer.endObject();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user