Registering new XOR command

This commit is contained in:
Jesus M. Castagnetto 2013-02-01 22:42:01 -05:00
parent ebec459cfd
commit df450b20f7
2 changed files with 13 additions and 8 deletions

View File

@ -2,7 +2,7 @@
Implementing a naive XOR operation Implementing a naive XOR operation
Copyright 2013, Jesus M. Castagnetto Copyright 2013, Jesus M. Castagnetto
License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause) License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
*/ */
package com.google.refine.expr.functions.booleans; package com.google.refine.expr.functions.booleans;
@ -34,9 +34,12 @@ public class Xor implements Function {
throws JSONException { throws JSONException {
writer.object(); writer.object();
writer.key("description"); writer.value("XORs two boolean values"); writer.key("description");
writer.key("params"); writer.value("boolean a, boolean b"); writer.value("XORs two boolean values");
writer.key("returns"); writer.value("boolean"); writer.key("params");
writer.value("boolean a, boolean b");
writer.key("returns");
writer.value("boolean");
writer.endObject(); writer.endObject();
} }
} }

View File

@ -56,6 +56,7 @@ import com.google.refine.expr.functions.arrays.Uniques;
import com.google.refine.expr.functions.booleans.And; import com.google.refine.expr.functions.booleans.And;
import com.google.refine.expr.functions.booleans.Not; import com.google.refine.expr.functions.booleans.Not;
import com.google.refine.expr.functions.booleans.Or; import com.google.refine.expr.functions.booleans.Or;
import com.google.refine.expr.functions.booleans.Xor;
import com.google.refine.expr.functions.date.DatePart; import com.google.refine.expr.functions.date.DatePart;
import com.google.refine.expr.functions.date.Inc; import com.google.refine.expr.functions.date.Inc;
import com.google.refine.expr.functions.date.Now; import com.google.refine.expr.functions.date.Now;
@ -284,6 +285,7 @@ public class ControlFunctionRegistry {
registerFunction("and", new And()); registerFunction("and", new And());
registerFunction("or", new Or()); registerFunction("or", new Or());
registerFunction("not", new Not()); registerFunction("not", new Not());
registerFunction("xor", new Xor());
registerFunction("cross", new Cross()); registerFunction("cross", new Cross());