From 29d594ef2f4a4ec9cfca8cab989d3a7478b0eadc Mon Sep 17 00:00:00 2001 From: Jesus Castagnetto Date: Fri, 1 Feb 2013 19:34:50 -0500 Subject: [PATCH 1/4] Added Java 8 to version check --- refine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refine b/refine index fb03850b8..feaaa6704 100755 --- a/refine +++ b/refine @@ -854,7 +854,7 @@ if [ ! -x "$JAVA" ] ; then error "Could not find the 'java' executable at '$JAVA', are you sure your JAVA_HOME environment variable is pointing to a proper java installation?" fi -JAVA_VERSION=`$JAVA -version 2>&1 | grep version | cut -d ' ' -f 3 | egrep '^\"1\.(6|7)'` +JAVA_VERSION=`$JAVA -version 2>&1 | grep version | cut -d ' ' -f 3 | egrep '^\"1\.(6|7|8)'` if [ -z "$JAVA_VERSION" ] ; then error "OpenRefine requires Java version 6 or later. If you have multiple versions of Java installed, please set the environment variable JAVA_HOME to the correct version." fi From 473e2f367f1e4640655d03ba6694c594e2e542f7 Mon Sep 17 00:00:00 2001 From: Jesus Castagnetto Date: Fri, 1 Feb 2013 17:59:16 -0800 Subject: [PATCH 2/4] Implementing Xor operation --- .../refine/expr/functions/booleans/Xor.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 main/src/com/google/refine/expr/functions/booleans/Xor.java diff --git a/main/src/com/google/refine/expr/functions/booleans/Xor.java b/main/src/com/google/refine/expr/functions/booleans/Xor.java new file mode 100644 index 000000000..7ce081861 --- /dev/null +++ b/main/src/com/google/refine/expr/functions/booleans/Xor.java @@ -0,0 +1,42 @@ +/* + Implementing a naive XOR operation + Copyright 2013, Jesus M. Castagnetto + License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause) +*/ + +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; + +public class Xor implements Function { + + @Override + public Object call(Properties bindings, Object[] args) { + if (args.length == 2 && + args[0] != null && args[0] instanceof Boolean && + args[1] != null && args[0] instanceof Boolean) { + boolean o1 = ((Boolean) args[0]).booleanValue(); + boolean o2 = ((Boolean) args[1]).booleanValue(); + return o1 != o2; + } + return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects 2 booleans"); + } + + @Override + public void write(JSONWriter writer, Properties options) + throws JSONException { + + writer.object(); + writer.key("description"); writer.value("XORs two boolean values"); + writer.key("params"); writer.value("boolean a, boolean b"); + writer.key("returns"); writer.value("boolean"); + writer.endObject(); + } +} From ebec459cfd89f954169379240e7d59abf39cc43a Mon Sep 17 00:00:00 2001 From: Jesus Castagnetto Date: Fri, 1 Feb 2013 21:00:36 -0500 Subject: [PATCH 3/4] indentation change --- main/src/com/google/refine/expr/functions/booleans/Xor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/src/com/google/refine/expr/functions/booleans/Xor.java b/main/src/com/google/refine/expr/functions/booleans/Xor.java index 7ce081861..27e9ffc4e 100644 --- a/main/src/com/google/refine/expr/functions/booleans/Xor.java +++ b/main/src/com/google/refine/expr/functions/booleans/Xor.java @@ -20,8 +20,8 @@ public class Xor implements Function { @Override public Object call(Properties bindings, Object[] args) { if (args.length == 2 && - args[0] != null && args[0] instanceof Boolean && - args[1] != null && args[0] instanceof Boolean) { + args[0] != null && args[0] instanceof Boolean && + args[1] != null && args[0] instanceof Boolean) { boolean o1 = ((Boolean) args[0]).booleanValue(); boolean o2 = ((Boolean) args[1]).booleanValue(); return o1 != o2; From fec35a8bc6b0d7bf5a6f63248bd45154a17d8a4e Mon Sep 17 00:00:00 2001 From: Jesus Castagnetto Date: Fri, 1 Feb 2013 21:07:42 -0500 Subject: [PATCH 4/4] Update main/src/com/google/refine/expr/functions/booleans/Xor.java --- .../refine/expr/functions/booleans/Xor.java | 42 ------------------- 1 file changed, 42 deletions(-) diff --git a/main/src/com/google/refine/expr/functions/booleans/Xor.java b/main/src/com/google/refine/expr/functions/booleans/Xor.java index 27e9ffc4e..e69de29bb 100644 --- a/main/src/com/google/refine/expr/functions/booleans/Xor.java +++ b/main/src/com/google/refine/expr/functions/booleans/Xor.java @@ -1,42 +0,0 @@ -/* - Implementing a naive XOR operation - Copyright 2013, Jesus M. Castagnetto - License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause) -*/ - -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; - -public class Xor implements Function { - - @Override - public Object call(Properties bindings, Object[] args) { - if (args.length == 2 && - args[0] != null && args[0] instanceof Boolean && - args[1] != null && args[0] instanceof Boolean) { - boolean o1 = ((Boolean) args[0]).booleanValue(); - boolean o2 = ((Boolean) args[1]).booleanValue(); - return o1 != o2; - } - return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects 2 booleans"); - } - - @Override - public void write(JSONWriter writer, Properties options) - throws JSONException { - - writer.object(); - writer.key("description"); writer.value("XORs two boolean values"); - writer.key("params"); writer.value("boolean a, boolean b"); - writer.key("returns"); writer.value("boolean"); - writer.endObject(); - } -}