From eebc225abc01cd2b91d3664083b49443066524e1 Mon Sep 17 00:00:00 2001 From: Tom Morris Date: Mon, 6 Jun 2011 22:35:01 +0000 Subject: [PATCH] Add missing @Override annotations (issue 316, 317, 319, 320 among others) git-svn-id: http://google-refine.googlecode.com/svn/trunk@2089 7d457c2a-affb-35e4-300a-418c747d4874 --- .../google/refine/browsing/facets/NominalFacetChoice.java | 1 + main/src/com/google/refine/browsing/facets/RangeFacet.java | 6 ++++++ .../com/google/refine/browsing/facets/ScatterplotFacet.java | 6 ++++++ .../com/google/refine/browsing/facets/TextSearchFacet.java | 2 ++ .../com/google/refine/browsing/facets/TimeRangeFacet.java | 6 ++++++ .../filters/DualExpressionsNumberComparisonRowFilter.java | 1 + .../refine/browsing/filters/ExpressionEqualRowFilter.java | 1 + .../filters/ExpressionNumberComparisonRowFilter.java | 1 + .../filters/ExpressionStringComparisonRowFilter.java | 1 + .../browsing/filters/ExpressionTimeComparisonRowFilter.java | 2 ++ .../refine/browsing/util/ConjunctiveFilteredRows.java | 1 + .../refine/browsing/util/ExpressionNominalValueGrouper.java | 1 + .../google/refine/clustering/binning/BinningClusterer.java | 6 ++++++ .../refine/clustering/binning/DoubleMetaphoneKeyer.java | 1 + .../google/refine/clustering/binning/FingerprintKeyer.java | 1 + .../google/refine/clustering/binning/Metaphone3Keyer.java | 1 + .../google/refine/clustering/binning/MetaphoneKeyer.java | 1 + .../refine/clustering/binning/NGramFingerprintKeyer.java | 1 + .../com/google/refine/clustering/binning/SoundexKeyer.java | 1 + 19 files changed, 41 insertions(+) diff --git a/main/src/com/google/refine/browsing/facets/NominalFacetChoice.java b/main/src/com/google/refine/browsing/facets/NominalFacetChoice.java index a21bf4ee9..96d5674d0 100644 --- a/main/src/com/google/refine/browsing/facets/NominalFacetChoice.java +++ b/main/src/com/google/refine/browsing/facets/NominalFacetChoice.java @@ -54,6 +54,7 @@ public class NominalFacetChoice implements Jsonizable { this.decoratedValue = decoratedValue; } + @Override public void write(JSONWriter writer, Properties options) throws JSONException { writer.object(); diff --git a/main/src/com/google/refine/browsing/facets/RangeFacet.java b/main/src/com/google/refine/browsing/facets/RangeFacet.java index 536bb1adf..ca7d7ff91 100644 --- a/main/src/com/google/refine/browsing/facets/RangeFacet.java +++ b/main/src/com/google/refine/browsing/facets/RangeFacet.java @@ -110,6 +110,7 @@ public class RangeFacet implements Facet { protected static final String TO = "to"; protected static final String FROM = "from"; + @Override public void write(JSONWriter writer, Properties options) throws JSONException { @@ -157,6 +158,7 @@ public class RangeFacet implements Facet { writer.endObject(); } + @Override public void initializeFromJSON(Project project, JSONObject o) throws Exception { _name = o.getString("name"); _expression = o.getString("expression"); @@ -195,11 +197,13 @@ public class RangeFacet implements Facet { } } + @Override public RowFilter getRowFilter(Project project) { if (_eval != null && _errorMessage == null && _selected) { return new ExpressionNumberComparisonRowFilter( getRowEvaluable(project), _selectNumeric, _selectNonNumeric, _selectBlank, _selectError) { + @Override protected boolean checkValue(double d) { return d >= _from && d < _to; }; @@ -215,6 +219,7 @@ public class RangeFacet implements Facet { return rowFilter == null ? null : new AnyRowRecordFilter(rowFilter); } + @Override public void computeChoices(Project project, FilteredRows filteredRows) { if (_eval != null && _errorMessage == null) { RowEvaluable rowEvaluable = getRowEvaluable(project); @@ -237,6 +242,7 @@ public class RangeFacet implements Facet { } } + @Override public void computeChoices(Project project, FilteredRecords filteredRecords) { if (_eval != null && _errorMessage == null) { RowEvaluable rowEvaluable = getRowEvaluable(project); diff --git a/main/src/com/google/refine/browsing/facets/ScatterplotFacet.java b/main/src/com/google/refine/browsing/facets/ScatterplotFacet.java index a53421097..1a36f8913 100644 --- a/main/src/com/google/refine/browsing/facets/ScatterplotFacet.java +++ b/main/src/com/google/refine/browsing/facets/ScatterplotFacet.java @@ -163,6 +163,7 @@ public class ScatterplotFacet implements Facet { } } + @Override public void write(JSONWriter writer, Properties options) throws JSONException { writer.object(); @@ -204,6 +205,7 @@ public class ScatterplotFacet implements Facet { writer.endObject(); } + @Override public void initializeFromJSON(Project project, JSONObject o) throws Exception { name = o.getString(NAME); l = size = (o.has(SIZE)) ? o.getInt(SIZE) : 100; @@ -285,6 +287,7 @@ public class ScatterplotFacet implements Facet { } + @Override public RowFilter getRowFilter(Project project) { if (selected && eval_x != null && errorMessage_x == null && @@ -298,6 +301,7 @@ public class ScatterplotFacet implements Facet { double from_y_pixels = from_y * l; double to_y_pixels = to_y * l; + @Override protected boolean checkValues(double x, double y) { Point2D.Double p = new Point2D.Double(x,y); p = translateCoordinates(p, min_x, max_x, min_y, max_y, dim_x, dim_y, l, t); @@ -315,6 +319,7 @@ public class ScatterplotFacet implements Facet { return rowFilter == null ? null : new AnyRowRecordFilter(rowFilter); } + @Override public void computeChoices(Project project, FilteredRows filteredRows) { if (eval_x != null && eval_y != null && errorMessage_x == null && errorMessage_y == null) { Column column_x = project.columnModel.getColumnByCellIndex(columnIndex_x); @@ -345,6 +350,7 @@ public class ScatterplotFacet implements Facet { } } + @Override public void computeChoices(Project project, FilteredRecords filteredRecords) { if (eval_x != null && eval_y != null && errorMessage_x == null && errorMessage_y == null) { Column column_x = project.columnModel.getColumnByCellIndex(columnIndex_x); diff --git a/main/src/com/google/refine/browsing/facets/TextSearchFacet.java b/main/src/com/google/refine/browsing/facets/TextSearchFacet.java index a610cf196..19a2c6186 100644 --- a/main/src/com/google/refine/browsing/facets/TextSearchFacet.java +++ b/main/src/com/google/refine/browsing/facets/TextSearchFacet.java @@ -124,12 +124,14 @@ public class TextSearchFacet implements Facet { if ("regex".equals(_mode)) { return new ExpressionStringComparisonRowFilter(eval, _columnName, _cellIndex) { + @Override protected boolean checkValue(String s) { return _pattern.matcher(s).find(); }; }; } else { return new ExpressionStringComparisonRowFilter(eval, _columnName, _cellIndex) { + @Override protected boolean checkValue(String s) { return (_caseSensitive ? s : s.toLowerCase()).contains(_query); }; diff --git a/main/src/com/google/refine/browsing/facets/TimeRangeFacet.java b/main/src/com/google/refine/browsing/facets/TimeRangeFacet.java index 634252b6d..d930d9835 100644 --- a/main/src/com/google/refine/browsing/facets/TimeRangeFacet.java +++ b/main/src/com/google/refine/browsing/facets/TimeRangeFacet.java @@ -65,6 +65,7 @@ public class TimeRangeFacet extends RangeFacet { protected int _timeCount; protected int _nonTimeCount; + @Override public void write(JSONWriter writer, Properties options) throws JSONException { writer.object(); @@ -109,6 +110,7 @@ public class TimeRangeFacet extends RangeFacet { writer.endObject(); } + @Override public void initializeFromJSON(Project project, JSONObject o) throws Exception { _name = o.getString("name"); _expression = o.getString("expression"); @@ -147,11 +149,13 @@ public class TimeRangeFacet extends RangeFacet { } } + @Override public RowFilter getRowFilter(Project project) { if (_eval != null && _errorMessage == null && _selected) { return new ExpressionTimeComparisonRowFilter( getRowEvaluable(project), _selectTime, _selectNonTime, _selectBlank, _selectError) { + @Override protected boolean checkValue(long t) { return t >= _from && t < _to; }; @@ -161,6 +165,7 @@ public class TimeRangeFacet extends RangeFacet { } } + @Override public void computeChoices(Project project, FilteredRows filteredRows) { if (_eval != null && _errorMessage == null) { RowEvaluable rowEvaluable = getRowEvaluable(project); @@ -182,6 +187,7 @@ public class TimeRangeFacet extends RangeFacet { } } + @Override public void computeChoices(Project project, FilteredRecords filteredRecords) { if (_eval != null && _errorMessage == null) { RowEvaluable rowEvaluable = getRowEvaluable(project); diff --git a/main/src/com/google/refine/browsing/filters/DualExpressionsNumberComparisonRowFilter.java b/main/src/com/google/refine/browsing/filters/DualExpressionsNumberComparisonRowFilter.java index 32d4a002b..72ef3c32b 100644 --- a/main/src/com/google/refine/browsing/filters/DualExpressionsNumberComparisonRowFilter.java +++ b/main/src/com/google/refine/browsing/filters/DualExpressionsNumberComparisonRowFilter.java @@ -72,6 +72,7 @@ abstract public class DualExpressionsNumberComparisonRowFilter implements RowFil _y_cellIndex = y_cellIndex; } + @Override public boolean filterRow(Project project, int rowIndex, Row row) { Cell x_cell = _x_cellIndex < 0 ? null : row.getCell(_x_cellIndex); Properties x_bindings = ExpressionUtils.createBindings(project); diff --git a/main/src/com/google/refine/browsing/filters/ExpressionEqualRowFilter.java b/main/src/com/google/refine/browsing/filters/ExpressionEqualRowFilter.java index 6d4efb85f..b5380a90f 100644 --- a/main/src/com/google/refine/browsing/filters/ExpressionEqualRowFilter.java +++ b/main/src/com/google/refine/browsing/filters/ExpressionEqualRowFilter.java @@ -82,6 +82,7 @@ public class ExpressionEqualRowFilter implements RowFilter { _invert = invert; } + @Override public boolean filterRow(Project project, int rowIndex, Row row) { return _invert ? internalInvertedFilterRow(project, rowIndex, row) : diff --git a/main/src/com/google/refine/browsing/filters/ExpressionNumberComparisonRowFilter.java b/main/src/com/google/refine/browsing/filters/ExpressionNumberComparisonRowFilter.java index 141c197a3..1a3462017 100644 --- a/main/src/com/google/refine/browsing/filters/ExpressionNumberComparisonRowFilter.java +++ b/main/src/com/google/refine/browsing/filters/ExpressionNumberComparisonRowFilter.java @@ -72,6 +72,7 @@ abstract public class ExpressionNumberComparisonRowFilter implements RowFilter { _selectError = selectError; } + @Override public boolean filterRow(Project project, int rowIndex, Row row) { Properties bindings = ExpressionUtils.createBindings(project); diff --git a/main/src/com/google/refine/browsing/filters/ExpressionStringComparisonRowFilter.java b/main/src/com/google/refine/browsing/filters/ExpressionStringComparisonRowFilter.java index e15f8fb35..569966e16 100644 --- a/main/src/com/google/refine/browsing/filters/ExpressionStringComparisonRowFilter.java +++ b/main/src/com/google/refine/browsing/filters/ExpressionStringComparisonRowFilter.java @@ -61,6 +61,7 @@ abstract public class ExpressionStringComparisonRowFilter implements RowFilter { _cellIndex = cellIndex; } + @Override public boolean filterRow(Project project, int rowIndex, Row row) { Cell cell = _cellIndex < 0 ? null : row.getCell(_cellIndex); diff --git a/main/src/com/google/refine/browsing/filters/ExpressionTimeComparisonRowFilter.java b/main/src/com/google/refine/browsing/filters/ExpressionTimeComparisonRowFilter.java index 1c8a86db5..a2e3cdae5 100644 --- a/main/src/com/google/refine/browsing/filters/ExpressionTimeComparisonRowFilter.java +++ b/main/src/com/google/refine/browsing/filters/ExpressionTimeComparisonRowFilter.java @@ -61,6 +61,7 @@ abstract public class ExpressionTimeComparisonRowFilter extends ExpressionNumber _selectNonTime = selectNonTime; } + @Override protected boolean checkValue(Object v) { if (ExpressionUtils.isError(v)) { return _selectError; @@ -77,6 +78,7 @@ abstract public class ExpressionTimeComparisonRowFilter extends ExpressionNumber } // not really needed for operation, just to make extending the abstract class possible + @Override protected boolean checkValue(double d) { return false; } diff --git a/main/src/com/google/refine/browsing/util/ConjunctiveFilteredRows.java b/main/src/com/google/refine/browsing/util/ConjunctiveFilteredRows.java index ede401a37..756110377 100644 --- a/main/src/com/google/refine/browsing/util/ConjunctiveFilteredRows.java +++ b/main/src/com/google/refine/browsing/util/ConjunctiveFilteredRows.java @@ -53,6 +53,7 @@ public class ConjunctiveFilteredRows implements FilteredRows { _rowFilters.add(rowFilter); } + @Override public void accept(Project project, RowVisitor visitor) { try { visitor.start(project); diff --git a/main/src/com/google/refine/browsing/util/ExpressionNominalValueGrouper.java b/main/src/com/google/refine/browsing/util/ExpressionNominalValueGrouper.java index 3b5669750..19511f029 100644 --- a/main/src/com/google/refine/browsing/util/ExpressionNominalValueGrouper.java +++ b/main/src/com/google/refine/browsing/util/ExpressionNominalValueGrouper.java @@ -101,6 +101,7 @@ public class ExpressionNominalValueGrouper implements RowVisitor, RecordVisitor // nothing to do } + @Override public boolean visit(Project project, int rowIndex, Row row) { hasError = false; hasBlank = false; diff --git a/main/src/com/google/refine/clustering/binning/BinningClusterer.java b/main/src/com/google/refine/clustering/binning/BinningClusterer.java index 4bdbf88c7..dfac209b3 100644 --- a/main/src/com/google/refine/clustering/binning/BinningClusterer.java +++ b/main/src/com/google/refine/clustering/binning/BinningClusterer.java @@ -110,6 +110,7 @@ public class BinningClusterer 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) { @@ -139,6 +140,7 @@ public class BinningClusterer extends Clusterer { public static class SizeComparator implements Comparator>, Serializable { private static final long serialVersionUID = -1390696157208674054L; + @Override public int compare(Map o1, Map o2) { int s1 = o1.size(); int s2 = o2.size(); @@ -160,16 +162,19 @@ public class BinningClusterer extends Clusterer { public static class EntriesComparator implements Comparator>, Serializable { private static final long serialVersionUID = 2763378036791777964L; + @Override public int compare(Entry o1, Entry o2) { return o2.getValue() - o1.getValue(); } } + @Override public void initializeFromJSON(Project project, JSONObject o) throws Exception { super.initializeFromJSON(project, o); _keyer = _keyers.get(o.getString("function").toLowerCase()); } + @Override public void computeClusters(Engine engine) { BinningRowVisitor visitor = new BinningRowVisitor(_keyer,_config); FilteredRows filteredRows = engine.getAllFilteredRows(); @@ -180,6 +185,7 @@ public class BinningClusterer extends Clusterer { Collections.sort(_clusters, new SizeComparator()); } + @Override public void write(JSONWriter writer, Properties options) throws JSONException { EntriesComparator c = new EntriesComparator(); diff --git a/main/src/com/google/refine/clustering/binning/DoubleMetaphoneKeyer.java b/main/src/com/google/refine/clustering/binning/DoubleMetaphoneKeyer.java index 7d3f20333..2eeef3ec8 100644 --- a/main/src/com/google/refine/clustering/binning/DoubleMetaphoneKeyer.java +++ b/main/src/com/google/refine/clustering/binning/DoubleMetaphoneKeyer.java @@ -44,6 +44,7 @@ public class DoubleMetaphoneKeyer extends Keyer { _metaphone2.setMaxCodeLen(2000); } + @Override public String key(String s, Object... o) { return _metaphone2.doubleMetaphone(s); } diff --git a/main/src/com/google/refine/clustering/binning/FingerprintKeyer.java b/main/src/com/google/refine/clustering/binning/FingerprintKeyer.java index 73e3bc48c..50921043a 100644 --- a/main/src/com/google/refine/clustering/binning/FingerprintKeyer.java +++ b/main/src/com/google/refine/clustering/binning/FingerprintKeyer.java @@ -43,6 +43,7 @@ public class FingerprintKeyer extends Keyer { static final Pattern alphanum = Pattern.compile("\\p{Punct}|\\p{Cntrl}"); + @Override public String key(String s, Object... o) { s = s.trim(); // first off, remove whitespace around the string s = s.toLowerCase(); // then lowercase it diff --git a/main/src/com/google/refine/clustering/binning/Metaphone3Keyer.java b/main/src/com/google/refine/clustering/binning/Metaphone3Keyer.java index 6688cf42e..7f53d6175 100644 --- a/main/src/com/google/refine/clustering/binning/Metaphone3Keyer.java +++ b/main/src/com/google/refine/clustering/binning/Metaphone3Keyer.java @@ -38,6 +38,7 @@ public class Metaphone3Keyer extends Keyer { public Metaphone3Keyer() { } + @Override public String key(String s, Object... o) { Metaphone3 _metaphone3 = new Metaphone3(); //_metaphone3.SetEncodeVowels(true); diff --git a/main/src/com/google/refine/clustering/binning/MetaphoneKeyer.java b/main/src/com/google/refine/clustering/binning/MetaphoneKeyer.java index 1123b4161..92b5f09d4 100644 --- a/main/src/com/google/refine/clustering/binning/MetaphoneKeyer.java +++ b/main/src/com/google/refine/clustering/binning/MetaphoneKeyer.java @@ -44,6 +44,7 @@ public class MetaphoneKeyer extends Keyer { _metaphone.setMaxCodeLen(2000); } + @Override public String key(String s, Object... o) { return _metaphone.metaphone(s); } diff --git a/main/src/com/google/refine/clustering/binning/NGramFingerprintKeyer.java b/main/src/com/google/refine/clustering/binning/NGramFingerprintKeyer.java index e477afc72..e5e27264d 100644 --- a/main/src/com/google/refine/clustering/binning/NGramFingerprintKeyer.java +++ b/main/src/com/google/refine/clustering/binning/NGramFingerprintKeyer.java @@ -41,6 +41,7 @@ public class NGramFingerprintKeyer extends FingerprintKeyer { static final Pattern alphanum = Pattern.compile("\\p{Punct}|\\p{Cntrl}|\\p{Space}"); + @Override public String key(String s, Object... o) { int ngram_size = 2; if (o != null && o.length > 0 && o[0] instanceof Number) { diff --git a/main/src/com/google/refine/clustering/binning/SoundexKeyer.java b/main/src/com/google/refine/clustering/binning/SoundexKeyer.java index 33b1117b0..751c95f2d 100644 --- a/main/src/com/google/refine/clustering/binning/SoundexKeyer.java +++ b/main/src/com/google/refine/clustering/binning/SoundexKeyer.java @@ -43,6 +43,7 @@ public class SoundexKeyer extends Keyer { _soundex = new Soundex(); } + @Override public String key(String s, Object... o) { return _soundex.soundex(s); }