Add missing @Override annotations
git-svn-id: http://google-refine.googlecode.com/svn/trunk@2171 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
78edff6f7f
commit
123614539d
10
README.txt
10
README.txt
@ -52,8 +52,14 @@ This is the full list of contributors (in chronological order):
|
||||
- Iain Sproat <iainsproat@gmail.com>
|
||||
- Tom Morris <tfmorris@gmail.com>
|
||||
- Heather Campbell <campbellh@google.com>
|
||||
|
||||
|
||||
- Thad Guidry <thadguidry@gmail.com>
|
||||
- Paul Makepeace <paulm@paulm.com>
|
||||
- Tomaž Šolc <tomaz.solc@zemanta.com>
|
||||
- Gabriel Sjoberg <GabrielSjoberg@gmail.com>
|
||||
- Rod Salazar <rodrod.salazar@gmail.com>
|
||||
- pxb <pxb1988@gmail.com>
|
||||
|
||||
We welcome additional contributors if you'd like to help out.
|
||||
- o -
|
||||
|
||||
|
||||
|
@ -49,6 +49,7 @@ public class FreebaseTopic implements Jsonizable {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -46,6 +46,7 @@ public class FreebaseType extends FreebaseTopic implements Jsonizable {
|
||||
super(id, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -54,6 +54,7 @@ abstract public class ProtographTransposeExporter implements WriterExporter {
|
||||
_contentType = contentType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return "application/x-unknown";
|
||||
}
|
||||
@ -67,6 +68,7 @@ abstract public class ProtographTransposeExporter implements WriterExporter {
|
||||
throw new RuntimeException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void export(Project project, Properties options, Engine engine,
|
||||
Writer writer) throws IOException {
|
||||
|
||||
|
@ -52,6 +52,7 @@ public class CheckAuthorizationCommand extends Command {
|
||||
|
||||
final static Logger logger = LoggerFactory.getLogger("check-authorization_command");
|
||||
|
||||
@Override
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
|
||||
try {
|
||||
|
@ -53,6 +53,7 @@ public class MqlKeyQuote implements Function {
|
||||
final static private Pattern fullValidKeyPattern = Pattern.compile(fullValidKey);
|
||||
final static private Pattern keyCharMustQuotePattern = Pattern.compile(keyCharMustQuote);
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1) {
|
||||
Object o1 = args[0];
|
||||
@ -63,6 +64,7 @@ public class MqlKeyQuote implements Function {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -45,6 +45,7 @@ import com.google.refine.grel.Function;
|
||||
public class MqlKeyUnquote implements Function {
|
||||
final static private Pattern quotedCharPattern = Pattern.compile("\\$([0-9A-Fa-f]{4})");
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1) {
|
||||
Object o1 = args[0];
|
||||
@ -75,6 +76,7 @@ public class MqlKeyUnquote implements Function {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -126,6 +126,7 @@ public class DataExtensionChange implements Change {
|
||||
_newRows = newRows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
synchronized (project) {
|
||||
if (_firstNewCellIndex < 0) {
|
||||
@ -257,6 +258,7 @@ public class DataExtensionChange implements Change {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revert(Project project) {
|
||||
synchronized (project) {
|
||||
project.rows.clear();
|
||||
@ -270,6 +272,7 @@ public class DataExtensionChange implements Change {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(Writer writer, Properties options) throws IOException {
|
||||
writer.write("baseColumnName="); writer.write(_baseColumnName); writer.write('\n');
|
||||
writer.write("columnInsertIndex="); writer.write(Integer.toString(_columnInsertIndex)); writer.write('\n');
|
||||
|
@ -80,6 +80,7 @@ public class DataExtensionReconConfig extends StrictReconConfig {
|
||||
throw new RuntimeException(WARN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options) throws JSONException {
|
||||
writer.object();
|
||||
writer.key("mode"); writer.value("extend");
|
||||
|
@ -69,6 +69,7 @@ public class GuidBasedReconConfig extends StrictReconConfig {
|
||||
static protected class GuidBasedReconJob extends ReconJob {
|
||||
String guid;
|
||||
|
||||
@Override
|
||||
public int getKey() {
|
||||
return guid.hashCode();
|
||||
}
|
||||
@ -102,6 +103,7 @@ public class GuidBasedReconConfig extends StrictReconConfig {
|
||||
return "Reconcile cells in column " + columnName + " as Freebase IDs";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -69,6 +69,7 @@ public class IdBasedReconConfig extends StrictReconConfig {
|
||||
static protected class IdBasedReconJob extends ReconJob {
|
||||
String id;
|
||||
|
||||
@Override
|
||||
public int getKey() {
|
||||
return id.hashCode();
|
||||
}
|
||||
@ -106,6 +107,7 @@ public class IdBasedReconConfig extends StrictReconConfig {
|
||||
return "Reconcile cells in column " + columnName + " as Freebase IDs";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -80,6 +80,7 @@ public class KeyBasedReconConfig extends StrictReconConfig {
|
||||
static protected class KeyBasedReconJob extends ReconJob {
|
||||
String key;
|
||||
|
||||
@Override
|
||||
public int getKey() {
|
||||
return key.hashCode();
|
||||
}
|
||||
@ -106,6 +107,7 @@ public class KeyBasedReconConfig extends StrictReconConfig {
|
||||
return "Reconcile cells in column " + columnName + " to topics with keys in namespace " + namespace.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -50,14 +50,17 @@ public class FreebaseProvider extends Provider {
|
||||
super(host);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRequestTokenServiceURL() {
|
||||
return "https://" + host + "/api/oauth/request_token";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAccessTokenServiceURL() {
|
||||
return "https://" + host + "/api/oauth/access_token";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserAuthorizationURL() {
|
||||
return "https://" + host + "/signin/app";
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ public class FreebaseTimeCommonsHttpOAuthConsumer extends CommonsHttpOAuthConsum
|
||||
* NOTE: this call is potentially vulnerable to a man-in-the-middle (MITM) attack, but the same
|
||||
* could be said if we used an NTP client.
|
||||
*/
|
||||
@Override
|
||||
protected String generateTimestamp() {
|
||||
|
||||
long time = -1;
|
||||
|
@ -96,6 +96,7 @@ public class ExtendDataOperation extends EngineDependentOperation {
|
||||
_columnInsertIndex = columnInsertIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
@ -109,6 +110,7 @@ public class ExtendDataOperation extends EngineDependentOperation {
|
||||
writer.endObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBriefDescription(Project project) {
|
||||
return "Extend data at index " + _columnInsertIndex +
|
||||
" based on column " + _baseColumnName;
|
||||
@ -120,6 +122,7 @@ public class ExtendDataOperation extends EngineDependentOperation {
|
||||
" by filling " + cellsAtRows.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Process createProcess(Project project, Properties options) throws Exception {
|
||||
return new ExtendDataProcess(
|
||||
project,
|
||||
@ -148,6 +151,7 @@ public class ExtendDataOperation extends EngineDependentOperation {
|
||||
_job = new FreebaseDataExtensionJob(_extension);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
@ -160,6 +164,7 @@ public class ExtendDataOperation extends EngineDependentOperation {
|
||||
writer.endObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Runnable getRunnable() {
|
||||
return this;
|
||||
}
|
||||
@ -194,6 +199,7 @@ public class ExtendDataOperation extends EngineDependentOperation {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(Project project, int rowIndex, Row row) {
|
||||
Cell cell = row.getCell(_cellIndex);
|
||||
if (cell != null && cell.recon != null && cell.recon.match != null) {
|
||||
@ -246,6 +252,7 @@ public class ExtendDataOperation extends EngineDependentOperation {
|
||||
return end;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
List<Integer> rowIndices = new ArrayList<Integer>();
|
||||
List<DataExtension> dataExtensions = new ArrayList<DataExtension>();
|
||||
|
@ -64,6 +64,7 @@ public class ImportQADataOperation extends AbstractOperation {
|
||||
public ImportQADataOperation() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -64,6 +64,7 @@ public class SaveProtographOperation extends AbstractOperation {
|
||||
_protograph = protograph;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
@ -74,6 +75,7 @@ public class SaveProtographOperation extends AbstractOperation {
|
||||
writer.endObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBriefDescription(Project project) {
|
||||
return "Save schema alignment skeleton";
|
||||
}
|
||||
@ -93,6 +95,7 @@ public class SaveProtographOperation extends AbstractOperation {
|
||||
_newProtograph = protograph;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
synchronized (project) {
|
||||
_oldProtograph = (Protograph) project.overlayModels.get("freebaseProtograph");
|
||||
@ -101,6 +104,7 @@ public class SaveProtographOperation extends AbstractOperation {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revert(Project project) {
|
||||
synchronized (project) {
|
||||
if (_oldProtograph == null) {
|
||||
@ -111,6 +115,7 @@ public class SaveProtographOperation extends AbstractOperation {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(Writer writer, Properties options) throws IOException {
|
||||
writer.write("newProtograph="); writeProtograph(_newProtograph, writer); writer.write('\n');
|
||||
writer.write("oldProtograph="); writeProtograph(_oldProtograph, writer); writer.write('\n');
|
||||
|
@ -50,6 +50,7 @@ public class AnonymousNode implements Node, NodeWithLinks {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
@ -66,14 +67,17 @@ public class AnonymousNode implements Node, NodeWithLinks {
|
||||
writer.endObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLink(Link link) {
|
||||
links.add(link);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Link getLink(int index) {
|
||||
return links.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLinkCount() {
|
||||
return links.size();
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ public class CellKeyNode extends CellNode {
|
||||
this.namespace = namespace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -52,6 +52,7 @@ public class CellTopicNode extends CellNode implements NodeWithLinks {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
@ -77,14 +78,17 @@ public class CellTopicNode extends CellNode implements NodeWithLinks {
|
||||
writer.endObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLink(Link link) {
|
||||
links.add(link);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Link getLink(int index) {
|
||||
return links.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLinkCount() {
|
||||
return links.size();
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ public class CellValueNode extends CellNode {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -50,6 +50,7 @@ public class FreebaseTopicNode implements Node, NodeWithLinks {
|
||||
this.topic = topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
@ -67,14 +68,17 @@ public class FreebaseTopicNode implements Node, NodeWithLinks {
|
||||
writer.endObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLink(Link link) {
|
||||
links.add(link);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Link getLink(int index) {
|
||||
return links.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLinkCount() {
|
||||
return links.size();
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ public class Link implements Jsonizable {
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -186,6 +186,7 @@ public class Protograph implements OverlayModel {
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options) throws JSONException {
|
||||
writer.object();
|
||||
writer.key("rootNodes"); writer.array();
|
||||
|
@ -49,6 +49,7 @@ public class ValueNode implements Node {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -102,6 +102,7 @@ public class MqlwriteLikeTransposedNodeFactory implements TransposedNodeFactory
|
||||
|
||||
protected JSONObject obj;
|
||||
|
||||
@Override
|
||||
public Object getJSON() {
|
||||
return getJSONObject();
|
||||
}
|
||||
@ -122,6 +123,7 @@ public class MqlwriteLikeTransposedNodeFactory implements TransposedNodeFactory
|
||||
this.node = node;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getJSONObject() {
|
||||
if (obj == null) {
|
||||
obj = new JSONObject();
|
||||
@ -182,6 +184,7 @@ public class MqlwriteLikeTransposedNodeFactory implements TransposedNodeFactory
|
||||
this.cell = cell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getJSON() {
|
||||
if (obj == null) {
|
||||
obj = new JSONObject();
|
||||
@ -212,6 +215,7 @@ public class MqlwriteLikeTransposedNodeFactory implements TransposedNodeFactory
|
||||
this.cell = cell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getJSON() {
|
||||
if (obj == null) {
|
||||
obj = new JSONObject();
|
||||
@ -260,6 +264,7 @@ public class MqlwriteLikeTransposedNodeFactory implements TransposedNodeFactory
|
||||
this.node = node;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getJSON() {
|
||||
if (obj == null) {
|
||||
obj = new JSONObject();
|
||||
@ -278,6 +283,7 @@ public class MqlwriteLikeTransposedNodeFactory implements TransposedNodeFactory
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public TransposedNode transposeAnonymousNode(
|
||||
TransposedNode parentNode,
|
||||
Link link,
|
||||
@ -290,6 +296,7 @@ public class MqlwriteLikeTransposedNodeFactory implements TransposedNodeFactory
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransposedNode transposeCellNode(
|
||||
TransposedNode parentNode,
|
||||
Link link,
|
||||
@ -313,6 +320,7 @@ public class MqlwriteLikeTransposedNodeFactory implements TransposedNodeFactory
|
||||
return tnode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransposedNode transposeTopicNode(
|
||||
TransposedNode parentNode,
|
||||
Link link,
|
||||
@ -325,6 +333,7 @@ public class MqlwriteLikeTransposedNodeFactory implements TransposedNodeFactory
|
||||
return tnode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransposedNode transposeValueNode(
|
||||
TransposedNode parentNode,
|
||||
Link link,
|
||||
|
@ -349,6 +349,7 @@ public class TripleLoaderTransposedNodeFactory implements TransposedNodeFactory
|
||||
|
||||
//protected AnonymousTransposedNode(AnonymousNode node) { }
|
||||
|
||||
@Override
|
||||
public Object internalWrite(String subject, String predicate, Project project, int subjectRowIndex, int subjectCellIndex, Cell subjectCell) {
|
||||
if (children.size() == 0 || subject == null) {
|
||||
return null;
|
||||
@ -431,6 +432,7 @@ public class TripleLoaderTransposedNodeFactory implements TransposedNodeFactory
|
||||
this.cell = cell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object internalWrite(String subject, String predicate, Project project, int subjectRowIndex, int subjectCellIndex, Cell subjectCell) {
|
||||
String id = null;
|
||||
if (cell.recon != null && cell.recon.judgment != Recon.Judgment.None) {
|
||||
@ -505,6 +507,7 @@ public class TripleLoaderTransposedNodeFactory implements TransposedNodeFactory
|
||||
this.cell = cell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object internalWrite(String subject, String predicate, Project project, int subjectRowIndex, int subjectCellIndex, Cell subjectCell) {
|
||||
Object value = cell.value;
|
||||
if (value != null) {
|
||||
@ -541,6 +544,7 @@ public class TripleLoaderTransposedNodeFactory implements TransposedNodeFactory
|
||||
this.cell = cell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object internalWrite(String subject, String predicate, Project project, int subjectRowIndex, int subjectCellIndex, Cell subjectCell) {
|
||||
writeLine(subject, "key", node.namespace.id + "/" + cell.value, project,
|
||||
subjectRowIndex, subjectCellIndex, subjectCell,
|
||||
@ -557,6 +561,7 @@ public class TripleLoaderTransposedNodeFactory implements TransposedNodeFactory
|
||||
this.node = node;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object internalWrite(String subject, String predicate, Project project, int subjectRowIndex, int subjectCellIndex, Cell subjectCell) {
|
||||
writeLine(subject, predicate, node.topic.id, project,
|
||||
subjectRowIndex, subjectCellIndex, subjectCell,
|
||||
@ -575,6 +580,7 @@ public class TripleLoaderTransposedNodeFactory implements TransposedNodeFactory
|
||||
this.node = node;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object internalWrite(String subject, String predicate, Project project, int subjectRowIndex, int subjectCellIndex, Cell subjectCell) {
|
||||
Object value = node.value;
|
||||
if (value != null) {
|
||||
@ -597,6 +603,7 @@ public class TripleLoaderTransposedNodeFactory implements TransposedNodeFactory
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransposedNode transposeAnonymousNode(
|
||||
TransposedNode parentNode,
|
||||
Link link,
|
||||
@ -620,6 +627,7 @@ public class TripleLoaderTransposedNodeFactory implements TransposedNodeFactory
|
||||
return tnode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransposedNode transposeCellNode(
|
||||
TransposedNode parentNode,
|
||||
Link link,
|
||||
@ -662,6 +670,7 @@ public class TripleLoaderTransposedNodeFactory implements TransposedNodeFactory
|
||||
return tnode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransposedNode transposeTopicNode(
|
||||
TransposedNode parentNode,
|
||||
Link link,
|
||||
@ -686,6 +695,7 @@ public class TripleLoaderTransposedNodeFactory implements TransposedNodeFactory
|
||||
return tnode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransposedNode transposeValueNode(
|
||||
TransposedNode parentNode,
|
||||
Link link,
|
||||
|
@ -15,6 +15,7 @@ import com.google.refine.commands.Command;
|
||||
*/
|
||||
public class AuthorizeCommand extends Command {
|
||||
|
||||
@Override
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
|
||||
|
@ -16,6 +16,7 @@ import com.google.refine.commands.Command;
|
||||
*/
|
||||
public class AuthorizeCommand2 extends Command {
|
||||
|
||||
@Override
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
|
||||
|
@ -11,6 +11,7 @@ import com.google.refine.commands.Command;
|
||||
|
||||
public class DeAuthorizeCommand extends Command {
|
||||
|
||||
@Override
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
|
||||
|
@ -58,6 +58,7 @@ public class JythonEvaluable implements Evaluable {
|
||||
static public LanguageSpecificParser createParser() {
|
||||
return new LanguageSpecificParser() {
|
||||
|
||||
@Override
|
||||
public Evaluable parse(String s) throws ParsingException {
|
||||
return new JythonEvaluable(s);
|
||||
}
|
||||
@ -108,6 +109,7 @@ public class JythonEvaluable implements Evaluable {
|
||||
_engine.exec(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object evaluate(Properties bindings) {
|
||||
try {
|
||||
// call the temporary PyFunction directly
|
||||
|
@ -52,6 +52,7 @@ public class JythonHasFieldsWrapper extends PyObject {
|
||||
_bindings = bindings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PyObject __finditem__(PyObject key) {
|
||||
String k = (String) key.__tojava__(String.class);
|
||||
Object v = _obj.getField(k, _bindings);
|
||||
|
@ -44,6 +44,7 @@ public class JythonObjectWrapper extends PyObject {
|
||||
_obj = obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return _obj.getClass().getSimpleName();
|
||||
}
|
||||
|
@ -268,6 +268,7 @@ public abstract class ProjectManager {
|
||||
|
||||
if (records.size() > 0) {
|
||||
Collections.sort(records, new Comparator<SaveRecord>() {
|
||||
@Override
|
||||
public int compare(SaveRecord o1, SaveRecord o2) {
|
||||
if (o1.overdue < o2.overdue) {
|
||||
return 1;
|
||||
|
@ -76,6 +76,7 @@ public class ProjectMetadata implements Jsonizable {
|
||||
preparePreferenceStore(_preferenceStore);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -83,6 +83,7 @@ public class RefineServlet extends Butterfly {
|
||||
static final protected long s_autoSavePeriod = 1000 * 60 * 5; // 5 minutes
|
||||
|
||||
static protected class AutoSaveTimerTask extends TimerTask {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
ProjectManager.singleton.save(false); // quick, potentially incomplete save
|
||||
|
@ -56,6 +56,7 @@ public class DecoratedValue implements Jsonizable {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
writer.object();
|
||||
|
@ -231,6 +231,7 @@ public class Engine implements Jsonizable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -123,6 +123,7 @@ public class kNNClusterer extends Clusterer {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(Project project, int rowIndex, Row row) {
|
||||
Cell cell = row.getCell(_colindex);
|
||||
if (cell != null && cell.value != null) {
|
||||
@ -174,6 +175,7 @@ public class kNNClusterer extends Clusterer {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(Project project, int rowIndex, Row row) {
|
||||
Cell cell = row.getCell(_colindex);
|
||||
if (cell != null && cell.value != null) {
|
||||
@ -190,11 +192,13 @@ public class kNNClusterer extends Clusterer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeFromJSON(Project project, JSONObject o) throws Exception {
|
||||
super.initializeFromJSON(project, o);
|
||||
_distance = _distances.get(o.getString("function").toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void computeClusters(Engine engine) {
|
||||
//VPTreeClusteringRowVisitor visitor = new VPTreeClusteringRowVisitor(_distance,_config);
|
||||
BlockingClusteringRowVisitor visitor = new BlockingClusteringRowVisitor(_distance,_config);
|
||||
@ -206,11 +210,13 @@ public class kNNClusterer extends Clusterer {
|
||||
|
||||
public static class ValuesComparator implements Comparator<Entry<Serializable,Integer>>, Serializable {
|
||||
private static final long serialVersionUID = 204469656070583155L;
|
||||
@Override
|
||||
public int compare(Entry<Serializable,Integer> o1, Entry<Serializable,Integer> o2) {
|
||||
return o2.getValue() - o1.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options) throws JSONException {
|
||||
writer.array();
|
||||
for (Set<Serializable> m : _clusters) {
|
||||
|
@ -136,6 +136,7 @@ public class EditOneCellCommand extends Command {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HistoryEntry createHistoryEntry(long historyEntryID) throws Exception {
|
||||
Cell cell = _project.rows.get(rowIndex).getCell(cellIndex);
|
||||
Column column = _project.columnModel.getColumnByCellIndex(cellIndex);
|
||||
|
@ -243,6 +243,7 @@ public class GuessTypesOfColumnCommand extends Command {
|
||||
|
||||
List<TypeGroup> types = new ArrayList<TypeGroup>(map.values());
|
||||
Collections.sort(types, new Comparator<TypeGroup>() {
|
||||
@Override
|
||||
public int compare(TypeGroup o1, TypeGroup o2) {
|
||||
int c = Math.min(s_sampleSize, o2.count) - Math.min(s_sampleSize, o1.count);
|
||||
if (c != 0) {
|
||||
|
@ -118,6 +118,7 @@ public class ReconClearOneCellCommand extends Command {
|
||||
this.cellIndex = cellIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HistoryEntry createHistoryEntry(long historyEntryID) throws Exception {
|
||||
Cell cell = _project.rows.get(rowIndex).getCell(cellIndex);
|
||||
if (cell == null || !ExpressionUtils.isNonBlankData(cell.value)) {
|
||||
|
@ -154,6 +154,7 @@ public class ReconJudgeOneCellCommand extends Command {
|
||||
this.schemaSpace = schemaSpace;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HistoryEntry createHistoryEntry(long historyEntryID) throws Exception {
|
||||
Cell cell = _project.rows.get(rowIndex).getCell(cellIndex);
|
||||
if (cell == null || !ExpressionUtils.isNonBlankData(cell.value)) {
|
||||
|
@ -114,6 +114,7 @@ public class AnnotateOneRowCommand extends Command {
|
||||
this.starred = starred;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HistoryEntry createHistoryEntry(long historyEntryID) throws Exception {
|
||||
return new HistoryEntry(
|
||||
historyEntryID,
|
||||
@ -140,6 +141,7 @@ public class AnnotateOneRowCommand extends Command {
|
||||
this.flagged = flagged;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HistoryEntry createHistoryEntry(long historyEntryID) throws Exception {
|
||||
return new HistoryEntry(
|
||||
historyEntryID,
|
||||
|
@ -208,6 +208,7 @@ public class GetRowsCommand extends Command {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(Project project, int rowIndex, Row row) {
|
||||
if (total >= start && total < start + limit) {
|
||||
internalVisit(project, rowIndex, row);
|
||||
|
@ -84,6 +84,7 @@ public class CsvExporter implements WriterExporter{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(Project project, int rowIndex, Row row) {
|
||||
int size = project.columnModel.columns.size();
|
||||
|
||||
|
@ -92,6 +92,7 @@ public class HtmlTableExporter implements WriterExporter {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(Project project, int rowIndex, Row row) {
|
||||
try {
|
||||
writer.write("<tr>");
|
||||
|
@ -48,6 +48,7 @@ import com.google.refine.model.Project;
|
||||
|
||||
public class Cross implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 3) {
|
||||
// from project is implied
|
||||
@ -74,6 +75,7 @@ public class Cross implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a cell, a project name to join with, and a column name in that project");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -51,6 +51,7 @@ import com.google.refine.model.Project;
|
||||
|
||||
public class FacetCount implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 3 && args[1] instanceof String && args[2] instanceof String) {
|
||||
Object choiceValue = args[0]; // choice value to look up
|
||||
@ -85,6 +86,7 @@ public class FacetCount implements Function {
|
||||
" expects a choice value, an expression as a string, and a column name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -48,6 +48,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Get implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length > 1 && args.length <= 3) {
|
||||
Object v = args[0];
|
||||
@ -164,6 +165,7 @@ public class Get implements Function {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class HasField implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length > 1 && args.length <= 2) {
|
||||
Object v = args[0];
|
||||
@ -65,6 +66,7 @@ public class HasField implements Function {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -46,6 +46,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Jsonize implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length >= 1) {
|
||||
try {
|
||||
@ -77,6 +78,7 @@ public class Jsonize implements Function {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -47,6 +47,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Length implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1) {
|
||||
Object v = args[0];
|
||||
@ -70,6 +71,7 @@ public class Length implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects an array or a string");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -46,6 +46,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Slice implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length > 1 && args.length <= 3) {
|
||||
Object v = args[0];
|
||||
@ -128,6 +129,7 @@ public class Slice implements Function {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -47,6 +47,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class ToDate implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 0) {
|
||||
// missing value, can this happen?
|
||||
@ -98,6 +99,7 @@ public class ToDate implements Function {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -43,6 +43,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class ToNumber implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1 && args[0] != null) {
|
||||
if (args[0] instanceof Number) {
|
||||
@ -59,6 +60,7 @@ public class ToNumber implements Function {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -46,6 +46,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class ToString implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length >= 1) {
|
||||
Object o1 = args[0];
|
||||
@ -71,6 +72,7 @@ public class ToString implements Function {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -47,6 +47,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Type implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1) {
|
||||
Object v = args[0];
|
||||
@ -71,6 +72,7 @@ public class Type implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects one argument");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -42,10 +42,12 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class ArgsToArray implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
return args;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -47,6 +47,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Join implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 2) {
|
||||
Object v = args[0];
|
||||
@ -99,6 +100,7 @@ public class Join implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects an array and a string");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -48,6 +48,7 @@ import com.google.refine.util.JSONUtilities;
|
||||
|
||||
public class Reverse implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1) {
|
||||
Object v = args[0];
|
||||
@ -86,6 +87,7 @@ public class Reverse implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects an array");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -49,6 +49,7 @@ import com.google.refine.util.JSONUtilities;
|
||||
|
||||
public class Sort implements Function {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1) {
|
||||
@ -84,6 +85,7 @@ public class Sort implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects an array");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -50,6 +50,7 @@ import com.google.refine.util.JSONUtilities;
|
||||
|
||||
public class Uniques implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1) {
|
||||
Object v = args[0];
|
||||
@ -84,6 +85,7 @@ public class Uniques implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects an array");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -42,6 +42,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class And implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
for (Object o : args) {
|
||||
if (!Not.objectToBoolean(o)) {
|
||||
@ -51,6 +52,7 @@ public class And implements Function {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Not implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1) {
|
||||
return !objectToBoolean(args[0]);
|
||||
@ -56,6 +57,7 @@ public class Not implements Function {
|
||||
(o instanceof Boolean) ? ((Boolean) o).booleanValue() : Boolean.parseBoolean(o.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -42,6 +42,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Or implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
for (Object o : args) {
|
||||
if (Not.objectToBoolean(o)) {
|
||||
@ -51,6 +52,7 @@ public class Or implements Function {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -46,6 +46,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class DatePart implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 2 &&
|
||||
args[0] != null && (args[0] instanceof Calendar || args[0] instanceof Date) &&
|
||||
@ -91,6 +92,7 @@ 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");
|
||||
|
@ -46,6 +46,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Inc implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 3 &&
|
||||
args[0] != null && (args[0] instanceof Calendar || args[0] instanceof Date) &&
|
||||
@ -89,6 +90,7 @@ 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");
|
||||
|
@ -43,6 +43,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Now implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 0) {
|
||||
return Calendar.getInstance();
|
||||
@ -50,6 +51,7 @@ public class Now implements Function {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -45,6 +45,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class HtmlAttr implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length >= 2) {
|
||||
Object o1 = args[0];
|
||||
@ -62,6 +63,7 @@ public class HtmlAttr implements Function {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -45,6 +45,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class HtmlText implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length >= 1) {
|
||||
Object o1 = args[0];
|
||||
@ -60,6 +61,7 @@ public class HtmlText implements Function {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -45,6 +45,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class InnerHtml implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length >= 1) {
|
||||
Object o1 = args[0];
|
||||
@ -60,6 +61,7 @@ public class InnerHtml implements Function {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -43,6 +43,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class ParseHtml implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length >= 1) {
|
||||
Object o1 = args[0];
|
||||
@ -54,6 +55,7 @@ public class ParseHtml implements Function {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -45,6 +45,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class SelectHtml implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length >= 2) {
|
||||
Object o1 = args[0];
|
||||
@ -62,6 +63,7 @@ public class SelectHtml implements Function {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class ACos implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
|
||||
return Math.acos(((Number) args[0]).doubleValue());
|
||||
@ -51,6 +52,7 @@ public class ACos implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class ASin implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
|
||||
return Math.asin(((Number) args[0]).doubleValue());
|
||||
@ -51,6 +52,7 @@ public class ASin implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class ATan implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
|
||||
return Math.atan(((Number) args[0]).doubleValue());
|
||||
@ -51,6 +52,7 @@ public class ATan implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class ATan2 implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 2 && args[0] != null && args[0] instanceof Number
|
||||
&& args[1] != null && args[1] instanceof Number) {
|
||||
@ -52,6 +53,7 @@ public class ATan2 implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Abs implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
|
||||
return Math.abs(((Number) args[0]).doubleValue());
|
||||
@ -51,6 +52,7 @@ public class Abs implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Ceil implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
|
||||
return (long) Math.ceil(((Number) args[0]).doubleValue());
|
||||
@ -51,6 +52,7 @@ public class Ceil implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Combin implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if(args.length != 2)
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects two numbers");
|
||||
@ -66,6 +67,7 @@ public class Combin implements Function {
|
||||
return nFact / (rFact * nminusrFact);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Cos implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
|
||||
return Math.cos(((Number) args[0]).doubleValue());
|
||||
@ -51,6 +52,7 @@ public class Cos implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Cosh implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
|
||||
return StrictMath.cosh(((Number) args[0]).doubleValue());
|
||||
@ -51,6 +52,7 @@ public class Cosh implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Degrees implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
|
||||
return Math.toDegrees(((Number) args[0]).doubleValue());
|
||||
@ -51,6 +52,7 @@ public class Degrees implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Even implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
|
||||
return Even.RoundUpToEven(((Number) args[0]).doubleValue());
|
||||
@ -56,6 +57,7 @@ public class Even implements Function {
|
||||
return ((temp % 2) == 0) ? temp : temp+1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -42,6 +42,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Exp implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1 && args[0] instanceof Number) {
|
||||
return Math.exp(((Number) args[0]).doubleValue());
|
||||
@ -49,6 +50,7 @@ public class Exp implements Function {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Fact implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
|
||||
return FactN.factorial(((Number) args[0]).intValue(), 1);
|
||||
@ -51,6 +52,7 @@ public class Fact implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class FactN implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length != 2)
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects two numbers");
|
||||
@ -68,6 +69,7 @@ public class FactN implements Function {
|
||||
return i * FactN.factorial(i - step, step);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Floor implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
|
||||
return (long) Math.floor(((Number) args[0]).doubleValue());
|
||||
@ -51,6 +52,7 @@ public class Floor implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class GreatestCommonDenominator implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 2 && args[0] != null && args[0] instanceof Number
|
||||
&& args[1] != null && args[1] instanceof Number) {
|
||||
@ -56,6 +57,7 @@ public class GreatestCommonDenominator implements Function {
|
||||
return b == 0 ? a : GCD(b, a % b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class LeastCommonMultiple implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 2
|
||||
&& args[0] != null && args[0] instanceof Number
|
||||
@ -67,6 +68,7 @@ public class LeastCommonMultiple implements Function {
|
||||
return largerValue * smallerValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Ln implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
|
||||
return Math.log(((Number) args[0]).doubleValue());
|
||||
@ -51,6 +52,7 @@ public class Ln implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Log implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
|
||||
return Math.log10(((Number) args[0]).doubleValue());
|
||||
@ -51,6 +52,7 @@ public class Log implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Max implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 2 &&
|
||||
args[0] != null && args[0] instanceof Number &&
|
||||
@ -55,6 +56,7 @@ public class Max implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects 2 numbers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Min implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 2 &&
|
||||
args[0] != null && args[0] instanceof Number &&
|
||||
@ -55,6 +56,7 @@ public class Min implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects 2 numbers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Mod implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 2 &&
|
||||
args[0] != null && args[0] instanceof Number &&
|
||||
@ -56,6 +57,7 @@ public class Mod implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects 2 numbers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Multinomial implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length < 1)
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects one or more numbers");
|
||||
@ -59,6 +60,7 @@ public class Multinomial implements Function {
|
||||
return FactN.factorial(sum, 1) / product;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Odd implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
|
||||
return Odd.RoundUpToOdd(((Number) args[0]).doubleValue());
|
||||
@ -56,6 +57,7 @@ public class Odd implements Function {
|
||||
return ((temp % 2) == 0) ? temp + 1 : temp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -42,6 +42,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Pow implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 2 && args[0] instanceof Number && args[1] instanceof Number) {
|
||||
return Math.pow(
|
||||
@ -52,6 +53,7 @@ public class Pow implements Function {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.google.refine.grel.Function;
|
||||
|
||||
public class Quotient implements Function {
|
||||
|
||||
@Override
|
||||
public Object call(Properties bindings, Object[] args) {
|
||||
if (args.length == 2 && args[0] != null && args[0] instanceof Number
|
||||
&& args[1] != null && args[1] instanceof Number) {
|
||||
@ -52,6 +53,7 @@ public class Quotient implements Function {
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects two numbers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JSONWriter writer, Properties options)
|
||||
throws JSONException {
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user