cleanups (no functional changes)

this makes pmd and javac on linux happier


git-svn-id: http://google-refine.googlecode.com/svn/trunk@427 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Stefano Mazzocchi 2010-04-08 20:46:02 +00:00
parent be084ff0da
commit 7526c4e582
14 changed files with 80 additions and 113 deletions

View File

@ -110,23 +110,19 @@ public class InterProjectModel {
for (Row fromRow : fromProject.rows) {
Object value = fromRow.getCellValue(fromColumn.getCellIndex());
if (ExpressionUtils.isNonBlankData(value)) {
if (!join.valueToRowIndices.containsKey(value)) {
if (ExpressionUtils.isNonBlankData(value) && !join.valueToRowIndices.containsKey(value)) {
join.valueToRowIndices.put(value, new ArrayList<Integer>());
}
}
}
int count = toProject.rows.size();
for (int r = 0; r < count; r++) {
Row toRow = toProject.rows.get(r);
Object value = toRow.getCellValue(toColumn.getCellIndex());
if (ExpressionUtils.isNonBlankData(value)) {
if (join.valueToRowIndices.containsKey(value)) {
if (ExpressionUtils.isNonBlankData(value) && join.valueToRowIndices.containsKey(value)) {
join.valueToRowIndices.get(value).add(r);
}
}
}
}
}

View File

@ -49,10 +49,10 @@ public class ConjunctiveFilteredRows implements FilteredRows {
// and this row is a dependent row since it's not a record row
row.recordIndex < 0 &&
row.contextRows != null &&
row.contextRows.size() > 0
) {
row.contextRows.size() > 0 &&
if (row.contextRows.get(0) == lastRecordRowAcceptedRowIndex) {
row.contextRows.get(0) == lastRecordRowAcceptedRowIndex
) {
// this row depends on the last previously matched record row,
// so we visit it as well as a dependent row
@ -61,7 +61,6 @@ public class ConjunctiveFilteredRows implements FilteredRows {
}
}
}
}
protected void visitRow(Project project, RowVisitor visitor, int rowIndex, Row row, int lastVisitedRow) {
if (_includeContextual && // we need to include any context row and

View File

@ -5,8 +5,6 @@ import java.io.OutputStream;
import java.io.Writer;
import java.util.Properties;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import com.metaweb.gridworks.ProjectManager;
import com.metaweb.gridworks.browsing.Engine;
import com.metaweb.gridworks.browsing.FilteredRows;
@ -27,7 +25,7 @@ public class HtmlTableExporter implements Exporter {
public void export(Project project, Properties options, Engine engine,
OutputStream outputStream) throws IOException {
throw new NotImplementedException();
throw new RuntimeException("Not implemented");
}
public void export(Project project, Properties options, Engine engine, Writer writer) throws IOException {

View File

@ -5,8 +5,6 @@ import java.io.OutputStream;
import java.io.Writer;
import java.util.Properties;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import com.metaweb.gridworks.browsing.Engine;
import com.metaweb.gridworks.model.Project;
import com.metaweb.gridworks.protograph.Protograph;
@ -24,7 +22,7 @@ public class TripleloaderExporter implements Exporter {
public void export(Project project, Properties options, Engine engine,
OutputStream outputStream) throws IOException {
throw new NotImplementedException();
throw new RuntimeException("Not implemented");
}
public void export(Project project, Properties options, Engine engine,

View File

@ -5,8 +5,6 @@ import java.io.OutputStream;
import java.io.Writer;
import java.util.Properties;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import com.metaweb.gridworks.browsing.Engine;
import com.metaweb.gridworks.browsing.FilteredRows;
import com.metaweb.gridworks.browsing.RowVisitor;
@ -26,7 +24,7 @@ public class TsvExporter implements Exporter {
public void export(Project project, Properties options, Engine engine,
OutputStream outputStream) throws IOException {
throw new NotImplementedException();
throw new RuntimeException("Not implemented");
}
public void export(Project project, Properties options, Engine engine, Writer writer) throws IOException {

View File

@ -12,8 +12,6 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import com.metaweb.gridworks.ProjectManager;
import com.metaweb.gridworks.browsing.Engine;
import com.metaweb.gridworks.browsing.FilteredRows;
@ -33,7 +31,7 @@ public class XlsExporter implements Exporter {
}
public void export(Project project, Properties options, Engine engine, Writer writer) throws IOException {
throw new NotImplementedException();
throw new RuntimeException("Not implemented");
}
public void export(Project project, Properties options, Engine engine,

View File

@ -20,8 +20,7 @@ public class Diff implements Function {
if (o1 != null && o2 != null) {
if (o1 instanceof String && o2 instanceof String) {
return StringUtils.difference((String) o1,(String) o2);
} else if (o1 instanceof Calendar) {
if (args.length == 3) {
} else if (o1 instanceof Calendar && args.length == 3) {
Object o3 = args[3];
if (o3 != null && o3 instanceof String) {
try {
@ -46,7 +45,6 @@ public class Diff implements Function {
}
}
}
}
return null;
}

View File

@ -36,15 +36,13 @@ public class ColumnGroup implements Jsonizable {
writer.key("columnSpan"); writer.value(columnSpan);
writer.key("keyColumnIndex"); writer.value(keyColumnIndex);
if (!"save".equals(options.get("mode"))) {
if (subgroups != null && subgroups.size() > 0) {
if (!"save".equals(options.get("mode")) && (subgroups != null) && (subgroups.size() > 0)) {
writer.key("subgroups"); writer.array();
for (ColumnGroup g : subgroups) {
g.write(writer, options);
}
writer.endArray();
}
}
writer.endObject();
}

View File

@ -69,16 +69,12 @@ public class CellChange implements Change {
row = Integer.parseInt(value);
} else if ("cell".equals(field)) {
cellIndex = Integer.parseInt(value);
} else if ("new".equals(field)) {
if (value.length() > 0) {
} else if ("new".equals(field) && value.length() > 0) {
newCell = Cell.load(value);
}
} else if ("old".equals(field)) {
if (value.length() > 0) {
} else if ("old".equals(field) && value.length() > 0) {
oldCell = Cell.load(value);
}
}
}
return new CellChange(row, cellIndex, oldCell, newCell);
}

View File

@ -7,8 +7,6 @@ import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONWriter;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import com.metaweb.gridworks.model.Cell;
import com.metaweb.gridworks.model.Project;
import com.metaweb.gridworks.model.Recon;
@ -36,13 +34,12 @@ public class DataExtensionReconConfig extends StrictReconConfig {
@Override
public ReconJob createJob(Project project, int rowIndex, Row row,
String columnName, Cell cell) {
throw new NotImplementedException();
throw new RuntimeException("Not implemented");
}
@Override
public int getBatchSize() {
throw new NotImplementedException();
throw new RuntimeException("Not implemented");
}
public void write(JSONWriter writer, Properties options)
@ -56,12 +53,12 @@ public class DataExtensionReconConfig extends StrictReconConfig {
@Override
public List<Recon> batchRecon(List<ReconJob> jobs) {
throw new NotImplementedException();
throw new RuntimeException("Not implemented");
}
@Override
public String getBriefDescription(Project project, String columnName) {
throw new NotImplementedException();
throw new RuntimeException("Not implemented");
}
}

View File

@ -25,9 +25,7 @@ public class SaveProtographOperation extends AbstractOperation {
);
}
public SaveProtographOperation(
Protograph protograph
) {
public SaveProtographOperation(Protograph protograph) {
_protograph = protograph;
}
@ -91,18 +89,13 @@ public class SaveProtographOperation extends AbstractOperation {
CharSequence field = line.subSequence(0, equal);
String value = line.substring(equal + 1);
if ("oldProtograph".equals(field)) {
if (value.length() > 0) {
if ("oldProtograph".equals(field) && value.length() > 0) {
oldProtograph = Protograph.reconstruct(ParsingUtilities.evaluateJsonStringToObject(value));
}
} else if ("newProtograph".equals(field)) {
if (value.length() > 0) {
} else if ("newProtograph".equals(field) && value.length() > 0) {
newProtograph = Protograph.reconstruct(ParsingUtilities.evaluateJsonStringToObject(value));
}
}
}
ProtographChange change = new ProtographChange(newProtograph);
change._oldProtograph = oldProtograph;

View File

@ -81,8 +81,7 @@ public class Protograph implements Jsonizable {
node = new AnonymousNode(reconstructType(o.getJSONObject("type")));
}
if (node != null) {
if (node instanceof NodeWithLinks && o.has("links")) {
if (node != null && node instanceof NodeWithLinks && o.has("links")) {
NodeWithLinks node2 = (NodeWithLinks) node;
JSONArray links = o.getJSONArray("links");
@ -97,7 +96,6 @@ public class Protograph implements Jsonizable {
));
}
}
}
return node;
}
@ -123,9 +121,7 @@ public class Protograph implements Jsonizable {
);
}
public void write(JSONWriter writer, Properties options)
throws JSONException {
public void write(JSONWriter writer, Properties options) throws JSONException {
writer.object();
writer.key("rootNodes"); writer.array();

View File

@ -55,12 +55,11 @@ public class Transposer {
Column column = project.columnModel.getColumnByName(node2.columnName);
Cell cell = row.getCell(column.getCellIndex());
if (cell != null && ExpressionUtils.isNonBlankData(cell.value)) {
if (node2 instanceof CellTopicNode) {
if (!((CellTopicNode) node2).createForNoReconMatch &&
if (node2 instanceof CellTopicNode &&
!((CellTopicNode) node2).createForNoReconMatch &&
(cell.recon == null || cell.recon.judgment == Judgment.None)) {
return;
}
}
context.count++;
if (context.limit > 0 && context.count > context.limit) {

View File

@ -37,7 +37,10 @@ import com.metaweb.util.threads.ThreadPoolExecutorAdapter;
public class Gridworks {
static private final String version = "1.0a";
static private final String VERSION = "1.0a";
static private final String DEFAULT_HOST = "127.0.0.1";
static private final int DEFAULT_PORT = 3333;
static private File tempDir;
private static Logger root = Logger.getRootLogger();
@ -64,7 +67,7 @@ public class Gridworks {
}
public static String getVersion() {
return version;
return VERSION;
}
public static File getTempFile(String name) {
@ -99,8 +102,8 @@ public class Gridworks {
public void init(String[] args) throws Exception {
int port = Configurations.getInteger("gridworks.port",3333);
String host = Configurations.get("gridworks.host","127.0.0.1");
int port = Configurations.getInteger("gridworks.port",DEFAULT_PORT);
String host = Configurations.get("gridworks.host",DEFAULT_HOST);
GridworksServer server = new GridworksServer();
server.init(host,port);